drm/i915/vgpu: improve vgpu abstractions
Add intel_vgpu_register() abstraction, rename i915_detect_vgpu() to intel_vgpu_detect() to match other function naming, un-inline intel_vgpu_active(), intel_vgpu_has_full_ppgtt() and intel_vgpu_has_huge_gtt() to reduce header interdependencies. The i915_vgpu.[ch] filename and intel_vgpu_ prefix discrepancy remains. Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200227144408.24345-1-jani.nikula@intel.com
This commit is contained in:
parent
3a4a32d6d2
commit
9e859eb9d0
@ -42,6 +42,7 @@
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_trace.h"
|
||||
#include "i915_vgpu.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_fbc.h"
|
||||
#include "intel_frontbuffer.h"
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_trace.h"
|
||||
#include "i915_vgpu.h"
|
||||
#include "intel_atomic_plane.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_frontbuffer.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "gem/i915_gem_region.h"
|
||||
#include "i915_drv.h"
|
||||
#include "i915_gem_stolen.h"
|
||||
#include "i915_vgpu.h"
|
||||
|
||||
/*
|
||||
* The BIOS typically reserves some of the system's memory for the exclusive
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "gen8_ppgtt.h"
|
||||
#include "i915_scatterlist.h"
|
||||
#include "i915_trace.h"
|
||||
#include "i915_pvinfo.h"
|
||||
#include "i915_vgpu.h"
|
||||
#include "intel_gt.h"
|
||||
#include "intel_gtt.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_vgpu.h"
|
||||
#include "intel_gt.h"
|
||||
#include "intel_gt_pm.h"
|
||||
#include "intel_rc6.h"
|
||||
|
@ -759,13 +759,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
|
||||
i915_gem_driver_register(dev_priv);
|
||||
i915_pmu_register(dev_priv);
|
||||
|
||||
/*
|
||||
* Notify a valid surface after modesetting,
|
||||
* when running inside a VM.
|
||||
*/
|
||||
if (intel_vgpu_active(dev_priv))
|
||||
intel_uncore_write(&dev_priv->uncore, vgtif_reg(display_ready),
|
||||
VGT_DRV_DISPLAY_READY);
|
||||
intel_vgpu_register(dev_priv);
|
||||
|
||||
/* Reveal our presence to userspace */
|
||||
if (drm_dev_register(dev, 0) == 0) {
|
||||
@ -972,7 +966,7 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
|
||||
disable_rpm_wakeref_asserts(&i915->runtime_pm);
|
||||
|
||||
i915_detect_vgpu(i915);
|
||||
intel_vgpu_detect(i915);
|
||||
|
||||
ret = i915_driver_mmio_probe(i915);
|
||||
if (ret < 0)
|
||||
|
@ -1677,11 +1677,6 @@ static inline bool intel_gvt_active(struct drm_i915_private *dev_priv)
|
||||
return dev_priv->gvt;
|
||||
}
|
||||
|
||||
static inline bool intel_vgpu_active(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return dev_priv->vgpu.active;
|
||||
}
|
||||
|
||||
int i915_getparam_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_scatterlist.h"
|
||||
#include "i915_pvinfo.h"
|
||||
#include "i915_vgpu.h"
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_pvinfo.h"
|
||||
#include "i915_vgpu.h"
|
||||
|
||||
/**
|
||||
@ -51,13 +53,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* i915_detect_vgpu - detect virtual GPU
|
||||
* intel_vgpu_detect - detect virtual GPU
|
||||
* @dev_priv: i915 device private
|
||||
*
|
||||
* This function is called at the initialization stage, to detect whether
|
||||
* running on a vGPU.
|
||||
*/
|
||||
void i915_detect_vgpu(struct drm_i915_private *dev_priv)
|
||||
void intel_vgpu_detect(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
struct pci_dev *pdev = dev_priv->drm.pdev;
|
||||
u64 magic;
|
||||
@ -102,11 +104,36 @@ out:
|
||||
pci_iounmap(pdev, shared_area);
|
||||
}
|
||||
|
||||
void intel_vgpu_register(struct drm_i915_private *i915)
|
||||
{
|
||||
/*
|
||||
* Notify a valid surface after modesetting, when running inside a VM.
|
||||
*/
|
||||
if (intel_vgpu_active(i915))
|
||||
intel_uncore_write(&i915->uncore, vgtif_reg(display_ready),
|
||||
VGT_DRV_DISPLAY_READY);
|
||||
}
|
||||
|
||||
bool intel_vgpu_active(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return dev_priv->vgpu.active;
|
||||
}
|
||||
|
||||
bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return dev_priv->vgpu.caps & VGT_CAPS_FULL_PPGTT;
|
||||
}
|
||||
|
||||
bool intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return dev_priv->vgpu.caps & VGT_CAPS_HWSP_EMULATION;
|
||||
}
|
||||
|
||||
bool intel_vgpu_has_huge_gtt(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return dev_priv->vgpu.caps & VGT_CAPS_HUGE_GTT;
|
||||
}
|
||||
|
||||
struct _balloon_info_ {
|
||||
/*
|
||||
* There are up to 2 regions per mappable/unmappable graphic
|
||||
|
@ -24,24 +24,17 @@
|
||||
#ifndef _I915_VGPU_H_
|
||||
#define _I915_VGPU_H_
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_pvinfo.h"
|
||||
#include <linux/types.h>
|
||||
|
||||
void i915_detect_vgpu(struct drm_i915_private *dev_priv);
|
||||
struct drm_i915_private;
|
||||
struct i915_ggtt;
|
||||
|
||||
bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv);
|
||||
|
||||
static inline bool
|
||||
intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return dev_priv->vgpu.caps & VGT_CAPS_HWSP_EMULATION;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
intel_vgpu_has_huge_gtt(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return dev_priv->vgpu.caps & VGT_CAPS_HUGE_GTT;
|
||||
}
|
||||
void intel_vgpu_detect(struct drm_i915_private *i915);
|
||||
bool intel_vgpu_active(struct drm_i915_private *i915);
|
||||
void intel_vgpu_register(struct drm_i915_private *i915);
|
||||
bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *i915);
|
||||
bool intel_vgpu_has_hwsp_emulation(struct drm_i915_private *i915);
|
||||
bool intel_vgpu_has_huge_gtt(struct drm_i915_private *i915);
|
||||
|
||||
int intel_vgt_balloon(struct i915_ggtt *ggtt);
|
||||
void intel_vgt_deballoon(struct i915_ggtt *ggtt);
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_vgpu.h"
|
||||
#include "intel_gvt.h"
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user