Message ID | 1490340204-21319-1-git-send-email-xiong.y.zhang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 2017.03.24 15:23:24 +0800, Xiong Zhang wrote: > commit "04a68a3 drm/i915/gvt: Disable access to stolen memory as a guest" > isn't enough in GVT-d which will pass through IGD to guest and don't run > vgt code. While intel_vgpu_active() is true only when vgt code run on > host and guest in GVT-g. > > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> > --- > drivers/gpu/drm/i915/i915_drv.c | 1 + > drivers/gpu/drm/i915/i915_drv.h | 1 + > drivers/gpu/drm/i915/i915_gem_stolen.c | 4 ++-- > 3 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index 03d9e45..8b807a9 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -223,6 +223,7 @@ static void intel_detect_pch(struct drm_i915_private *dev_priv) > PCI_SUBVENDOR_ID_REDHAT_QUMRANET && > pch->subsystem_device == > PCI_SUBDEVICE_ID_QEMU)) { > + dev_priv->run_on_qemu = true; > dev_priv->pch_type = > intel_virt_detect_pch(dev_priv); > } else > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index a5947a4..ad95c87 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -2145,6 +2145,7 @@ struct drm_i915_private { > struct intel_uncore uncore; > > struct i915_virtual_gpu vgpu; > + bool run_on_qemu; > > struct intel_gvt *gvt; > > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c > index f3abdc2..07e1721 100644 > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c > @@ -409,8 +409,8 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv) > > mutex_init(&dev_priv->mm.stolen_lock); > > - if (intel_vgpu_active(dev_priv)) { > - DRM_INFO("iGVT-g active, disabling use of stolen memory\n"); > + if (dev_priv->run_on_qemu) { > + DRM_INFO("Run on qemu, disabling use of stolen memory\n"); > return 0; Shouldn't remove vgpu active check which is based on pvinfo, we don't want to depend on some qemu machine config but pvinfo interface is officially defined.
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 03d9e45..8b807a9 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -223,6 +223,7 @@ static void intel_detect_pch(struct drm_i915_private *dev_priv) PCI_SUBVENDOR_ID_REDHAT_QUMRANET && pch->subsystem_device == PCI_SUBDEVICE_ID_QEMU)) { + dev_priv->run_on_qemu = true; dev_priv->pch_type = intel_virt_detect_pch(dev_priv); } else diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a5947a4..ad95c87 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2145,6 +2145,7 @@ struct drm_i915_private { struct intel_uncore uncore; struct i915_virtual_gpu vgpu; + bool run_on_qemu; struct intel_gvt *gvt; diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index f3abdc2..07e1721 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -409,8 +409,8 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv) mutex_init(&dev_priv->mm.stolen_lock); - if (intel_vgpu_active(dev_priv)) { - DRM_INFO("iGVT-g active, disabling use of stolen memory\n"); + if (dev_priv->run_on_qemu) { + DRM_INFO("Run on qemu, disabling use of stolen memory\n"); return 0; }
commit "04a68a3 drm/i915/gvt: Disable access to stolen memory as a guest" isn't enough in GVT-d which will pass through IGD to guest and don't run vgt code. While intel_vgpu_active() is true only when vgt code run on host and guest in GVT-g. Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> --- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_stolen.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-)