All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4] drm/i915: Enhanced disable access to stolen memory as a guest
@ 2017-04-05  2:08 Xiong Zhang
  2017-04-05  2:19 ` ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev4) Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Xiong Zhang @ 2017-04-05  2:08 UTC (permalink / raw)
  To: daniel; +Cc: intel-gfx, intel-gvt-dev, stable, Xiong Zhang

Stolen memory is in RMRR and has identity mapping in iommu, so
gt could access stolen memory in host OS. While RMRR isn't supported
by kvm, both EPT and guest iommu domain lack of maaping for stolen memory,
so both vcpu and gt couldn't access stolen memory in guest.

commit "04a68a3 drm/i915/gvt: Disable access to stolen memory as a guest"
isn't enough in IGD passthrough environment where vgt code doesn't run. This
patch detects i915 running as a guest through the existence of emulated ISA
bridge.

v2:GVT-g may run in non qemu (Zhenyu)
v3:Make commit message clear (Daniel)
v4:Fix typo	

References: c875d2c iommu/vt-d: Exclude devices using RMRRs from IOMMU API domains
Link: https://access.redhat.com/sites/default/files/attachments/rmrr-wp1.pdf
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99028

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@vger.kernel.org
---
 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..6a011b0 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 || intel_vgpu_active(dev_priv)) {
+		DRM_INFO("Running in guest, disabling use of stolen memory\n");
 		return 0;
 	}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-04-18 11:26 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05  2:08 [PATCH V4] drm/i915: Enhanced disable access to stolen memory as a guest Xiong Zhang
2017-04-05  2:19 ` ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev4) Patchwork
2017-04-05  6:50 ` [PATCH V4] drm/i915: Enhanced disable access to stolen memory as a guest Daniel Vetter
2017-04-05  6:50   ` Daniel Vetter
2017-04-05  7:44   ` [Intel-gfx] " Jani Nikula
2017-04-12 12:20 ` [PATCH V5] drm/i915: Disable stolen memory when i915 runs on qemu Xiong Zhang
2017-04-12 12:20   ` Xiong Zhang
2017-04-12 13:21   ` Joonas Lahtinen
2017-04-13  4:15     ` Zhang, Xiong Y
2017-04-13  4:15       ` Zhang, Xiong Y
2017-04-13  7:23     ` Tian, Kevin
2017-04-13  7:23       ` Tian, Kevin
2017-04-12 18:01   ` [Intel-gfx] " Alex Williamson
2017-04-12 18:01     ` Alex Williamson
2017-04-13  5:44     ` [Intel-gfx] " Zhang, Xiong Y
2017-04-13 14:53       ` Alex Williamson
2017-04-13 14:53         ` Alex Williamson
2017-04-14  6:39         ` [Intel-gfx] " Zhang, Xiong Y
2017-04-18 11:26           ` Gerd Hoffmann
2017-04-12 12:32 ` ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev5) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.