* [PATCH] drm/i915: Enhanced disable access to stolen memory as a guest
@ 2017-03-24 7:23 Xiong Zhang
2017-03-24 7:43 ` Zhenyu Wang
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Xiong Zhang @ 2017-03-24 7:23 UTC (permalink / raw)
To: intel-gfx
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;
}
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/i915: Enhanced disable access to stolen memory as a guest
2017-03-24 7:23 [PATCH] drm/i915: Enhanced disable access to stolen memory as a guest Xiong Zhang
@ 2017-03-24 7:43 ` Zhenyu Wang
2017-03-24 10:23 ` [PATCHi v2] " Xiong Zhang
` (3 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Zhenyu Wang @ 2017-03-24 7:43 UTC (permalink / raw)
To: Xiong Zhang; +Cc: intel-gfx, intel-gvt-dev
[-- Attachment #1.1: Type: text/plain, Size: 2344 bytes --]
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.
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCHi v2] drm/i915: Enhanced disable access to stolen memory as a guest
2017-03-24 7:23 [PATCH] drm/i915: Enhanced disable access to stolen memory as a guest Xiong Zhang
2017-03-24 7:43 ` Zhenyu Wang
@ 2017-03-24 10:23 ` Xiong Zhang
2017-03-27 2:21 ` Zhenyu Wang
2017-03-24 11:50 ` ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev2) Patchwork
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Xiong Zhang @ 2017-03-24 10:23 UTC (permalink / raw)
To: intel-gfx; +Cc: intel-gvt-dev
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.
v2:GVT-g may run in non qemu (Zhenyu)
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..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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev2)
2017-03-24 7:23 [PATCH] drm/i915: Enhanced disable access to stolen memory as a guest Xiong Zhang
2017-03-24 7:43 ` Zhenyu Wang
2017-03-24 10:23 ` [PATCHi v2] " Xiong Zhang
@ 2017-03-24 11:50 ` Patchwork
2017-03-30 10:04 ` Xiong Zhang
2017-03-30 12:53 ` ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev3) Patchwork
4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2017-03-24 11:50 UTC (permalink / raw)
To: Zhang, Xiong Y; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: Enhanced disable access to stolen memory as a guest (rev2)
URL : https://patchwork.freedesktop.org/series/21818/
State : success
== Summary ==
Series 21818v2 drm/i915: Enhanced disable access to stolen memory as a guest
https://patchwork.freedesktop.org/api/1.0/series/21818/revisions/2/mbox/
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 458s
fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time: 454s
fi-bsw-n3050 total:278 pass:239 dwarn:0 dfail:0 fail:0 skip:39 time: 578s
fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time: 542s
fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 time: 583s
fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 time: 506s
fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 time: 507s
fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 438s
fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 431s
fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 433s
fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 522s
fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 497s
fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 485s
fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 488s
fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 601s
fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 490s
fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 525s
fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time: 464s
fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 547s
fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time: 429s
fd27e1e4c9b5dc11966b4953432bd6e0510da308 drm-tip: 2017y-03m-24d-08h-39m-20s UTC integration manifest
f072895 drm/i915: Enhanced disable access to stolen memory as a guest
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4290/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCHi v2] drm/i915: Enhanced disable access to stolen memory as a guest
2017-03-24 10:23 ` [PATCHi v2] " Xiong Zhang
@ 2017-03-27 2:21 ` Zhenyu Wang
2017-03-27 11:55 ` Daniel Vetter
0 siblings, 1 reply; 11+ messages in thread
From: Zhenyu Wang @ 2017-03-27 2:21 UTC (permalink / raw)
To: Xiong Zhang; +Cc: intel-gfx, intel-gvt-dev
[-- Attachment #1.1: Type: text/plain, Size: 2337 bytes --]
On 2017.03.24 18:23:44 +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.
>
> v2:GVT-g may run in non qemu (Zhenyu)
>
> 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..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;
> }
>
> --
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCHi v2] drm/i915: Enhanced disable access to stolen memory as a guest
2017-03-27 2:21 ` Zhenyu Wang
@ 2017-03-27 11:55 ` Daniel Vetter
2017-03-28 1:28 ` Zhang, Xiong Y
0 siblings, 1 reply; 11+ messages in thread
From: Daniel Vetter @ 2017-03-27 11:55 UTC (permalink / raw)
To: Zhenyu Wang; +Cc: intel-gfx, intel-gvt-dev
On Mon, Mar 27, 2017 at 10:21:42AM +0800, Zhenyu Wang wrote:
> On 2017.03.24 18:23:44 +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.
> >
> > v2:GVT-g may run in non qemu (Zhenyu)
> >
> > 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..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;
> > }
> >
> > --
>
> Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Entirely disabling stolen is rather massive, this stuff is supposed to
work ... There should be special RMRR mappings in the iommu to help the
guest access the stolen range correctly from the gpu.
Which machine where does this blow up on?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCHi v2] drm/i915: Enhanced disable access to stolen memory as a guest
2017-03-27 11:55 ` Daniel Vetter
@ 2017-03-28 1:28 ` Zhang, Xiong Y
2017-03-29 11:58 ` Daniel Vetter
0 siblings, 1 reply; 11+ messages in thread
From: Zhang, Xiong Y @ 2017-03-28 1:28 UTC (permalink / raw)
To: Daniel Vetter, Zhenyu Wang; +Cc: intel-gfx, intel-gvt-dev
> > Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
>
> Entirely disabling stolen is rather massive, this stuff is supposed to
> work ... There should be special RMRR mappings in the iommu to help the
> guest access the stolen range correctly from the gpu.
>
> Which machine where does this blow up on?
> -Daniel
[Zhang, Xiong Y] Yes. Stolen memory is protected by RMRR on host. But Qemu couldn't support and don't have plan to support RMRR. Then EPT lack of mapping for stolen memory, guest couldn't access it.
The Qemu/Vfio is designed by Redhat engineers, Redhat has a white paper to explain why Qemu don't support RMRR:
https://access.redhat.com/sites/default/files/attachments/rmrr-wp1.pdf
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCHi v2] drm/i915: Enhanced disable access to stolen memory as a guest
2017-03-28 1:28 ` Zhang, Xiong Y
@ 2017-03-29 11:58 ` Daniel Vetter
0 siblings, 0 replies; 11+ messages in thread
From: Daniel Vetter @ 2017-03-29 11:58 UTC (permalink / raw)
To: Zhang, Xiong Y; +Cc: intel-gfx, intel-gvt-dev
On Tue, Mar 28, 2017 at 01:28:43AM +0000, Zhang, Xiong Y wrote:
> > > Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> >
> > Entirely disabling stolen is rather massive, this stuff is supposed to
> > work ... There should be special RMRR mappings in the iommu to help the
> > guest access the stolen range correctly from the gpu.
> >
> > Which machine where does this blow up on?
> > -Daniel
> [Zhang, Xiong Y] Yes. Stolen memory is protected by RMRR on host. But Qemu couldn't support and don't have plan to support RMRR. Then EPT lack of mapping for stolen memory, guest couldn't access it.
> The Qemu/Vfio is designed by Redhat engineers, Redhat has a white paper to explain why Qemu don't support RMRR:
> https://access.redhat.com/sites/default/files/attachments/rmrr-wp1.pdf
I chatted with Joonas, and he dug out the commit that changed this:
commit c875d2c1b8083cd627ea0463e20bf22c2d7421ee
Author: Alex Williamson <alex.williamson@redhat.com>
Date: Thu Jul 3 09:57:02 2014 -0600
iommu/vt-d: Exclude devices using RMRRs from IOMMU API domains
The user of the IOMMU API domain expects to have full control of
the IOVA space for the domain. RMRRs are fundamentally incompatible
with that idea. We can neither map the RMRR into the IOMMU API
domain, nor can we guarantee that the device won't continue DMA with
the area described by the RMRR as part of the new domain. Therefore
we must prevent such devices from being used by the IOMMU API.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Please reference that commit (plus the whitepaper if you want to) in your
commit message, and resubmit it with a Fixes: and cc: stable lines. This
sounds like a bugfix that we need to backport.
Thanks, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH V3] drm/i915: Enhanced disable access to stolen memory as a guest
2017-03-24 7:23 [PATCH] drm/i915: Enhanced disable access to stolen memory as a guest Xiong Zhang
@ 2017-03-30 10:04 ` Xiong Zhang
2017-03-24 10:23 ` [PATCHi v2] " Xiong Zhang
` (3 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Xiong Zhang @ 2017-03-30 10:04 UTC (permalink / raw)
To: intel-gfx; +Cc: intel-gvt-dev, stable, Xiong Zhang
Stolen memroy is in RMRR and have identity mapping in iommu, so
gt could access stolen memory in host OS. While RMRR isn't supported
in kvm, both EPT and guest iommu domain lack of maaping for stolen memory,
so both vcpu an gt couldn't access stolen memroy 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 don'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)
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] 11+ messages in thread
* [PATCH V3] drm/i915: Enhanced disable access to stolen memory as a guest
@ 2017-03-30 10:04 ` Xiong Zhang
0 siblings, 0 replies; 11+ messages in thread
From: Xiong Zhang @ 2017-03-30 10:04 UTC (permalink / raw)
To: intel-gfx; +Cc: intel-gvt-dev, stable
Stolen memroy is in RMRR and have identity mapping in iommu, so
gt could access stolen memory in host OS. While RMRR isn't supported
in kvm, both EPT and guest iommu domain lack of maaping for stolen memory,
so both vcpu an gt couldn't access stolen memroy 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 don'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)
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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev3)
2017-03-24 7:23 [PATCH] drm/i915: Enhanced disable access to stolen memory as a guest Xiong Zhang
` (3 preceding siblings ...)
2017-03-30 10:04 ` Xiong Zhang
@ 2017-03-30 12:53 ` Patchwork
4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2017-03-30 12:53 UTC (permalink / raw)
To: Zhang, Xiong Y; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: Enhanced disable access to stolen memory as a guest (rev3)
URL : https://patchwork.freedesktop.org/series/21818/
State : success
== Summary ==
Series 21818v3 drm/i915: Enhanced disable access to stolen memory as a guest
https://patchwork.freedesktop.org/api/1.0/series/21818/revisions/3/mbox/
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
fail -> PASS (fi-snb-2600) fdo#100007
Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass -> DMESG-WARN (fi-kbl-7560u) fdo#100125
pass -> DMESG-WARN (fi-bxt-t5700) fdo#100125
fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 430s
fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time: 426s
fi-bsw-n3050 total:278 pass:239 dwarn:0 dfail:0 fail:0 skip:39 time: 574s
fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time: 508s
fi-bxt-t5700 total:278 pass:257 dwarn:1 dfail:0 fail:0 skip:20 time: 562s
fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 time: 484s
fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 time: 480s
fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 407s
fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 408s
fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 423s
fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 486s
fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 487s
fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 450s
fi-kbl-7560u total:278 pass:267 dwarn:1 dfail:0 fail:0 skip:10 time: 567s
fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 448s
fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 572s
fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 459s
fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 492s
fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time: 434s
fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 535s
fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time: 401s
71dab8f683b2d609926524f9a6a60b00e4bfa543 drm-tip: 2017y-03m-30d-11h-44m-46s UTC integration manifest
aac3617 drm/i915: Enhanced disable access to stolen memory as a guest
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4358/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-03-30 12:53 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 7:23 [PATCH] drm/i915: Enhanced disable access to stolen memory as a guest Xiong Zhang
2017-03-24 7:43 ` Zhenyu Wang
2017-03-24 10:23 ` [PATCHi v2] " Xiong Zhang
2017-03-27 2:21 ` Zhenyu Wang
2017-03-27 11:55 ` Daniel Vetter
2017-03-28 1:28 ` Zhang, Xiong Y
2017-03-29 11:58 ` Daniel Vetter
2017-03-24 11:50 ` ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev2) Patchwork
2017-03-30 10:04 ` [PATCH V3] drm/i915: Enhanced disable access to stolen memory as a guest Xiong Zhang
2017-03-30 10:04 ` Xiong Zhang
2017-03-30 12:53 ` ✓ Fi.CI.BAT: success for drm/i915: Enhanced disable access to stolen memory as a guest (rev3) 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.