summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/gvt/vgpu.c
diff options
context:
space:
mode:
authorZhi Wang <zhi.a.wang@intel.com>2016-07-20 01:14:38 -0400
committerZhenyu Wang <zhenyuw@linux.intel.com>2016-10-14 18:12:46 +0800
commit4d60c5fd3f8751ea751d6dc6cfe0c1620420ccf8 (patch)
treeb9825065a7318e731e1b8cf2a3302472bf300906 /drivers/gpu/drm/i915/gvt/vgpu.c
parent2707e44466881d6b0a8ed05a429dcf0940c22f60 (diff)
downloadblackbird-op-linux-4d60c5fd3f8751ea751d6dc6cfe0c1620420ccf8.tar.gz
blackbird-op-linux-4d60c5fd3f8751ea751d6dc6cfe0c1620420ccf8.zip
drm/i915/gvt: vGPU PCI configuration space virtualization
This patch introduces vGPU PCI configuration space virtualization. - Adjust the trapped GPFN(Guest Page Frame Number) window of virtual GEN PCI BAR 0 when guest initializes PCI BAR 0 address. - Emulate OpRegion when guest touches OpRegion. - Pass-through a part of aperture to guest when guest initializes aperture BAR. Signed-off-by: Zhi Wang <zhi.a.wang@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/gvt/vgpu.c')
-rw-r--r--drivers/gpu/drm/i915/gvt/vgpu.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index a610f5a32947..53308698929a 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -141,6 +141,7 @@ void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu)
vgpu->active = false;
idr_remove(&gvt->vgpu_idr, vgpu->id);
+ intel_vgpu_clean_opregion(vgpu);
intel_vgpu_clean_gtt(vgpu);
intel_gvt_hypervisor_detach_vgpu(vgpu);
intel_vgpu_free_resource(vgpu);
@@ -204,11 +205,19 @@ struct intel_vgpu *intel_gvt_create_vgpu(struct intel_gvt *gvt,
if (ret)
goto out_detach_hypervisor_vgpu;
+ if (intel_gvt_host.hypervisor_type == INTEL_GVT_HYPERVISOR_KVM) {
+ ret = intel_vgpu_init_opregion(vgpu, 0);
+ if (ret)
+ goto out_clean_gtt;
+ }
+
vgpu->active = true;
mutex_unlock(&gvt->lock);
return vgpu;
+out_clean_gtt:
+ intel_vgpu_clean_gtt(vgpu);
out_detach_hypervisor_vgpu:
intel_gvt_hypervisor_detach_vgpu(vgpu);
out_clean_vgpu_resource:
OpenPOWER on IntegriCloud