Skip to content

Commit 8195400

Browse files
icklerodrigovivi
authored andcommitted
drm/i915: Force VT'd workarounds when running as a guest OS
If i915.ko is being used as a passthrough device, it does not know if the host is using intel_iommu. Mixing the iommu and gfx causes a few issues (such as scanout overfetch) which we need to workaround inside the driver, so if we detect we are running under a hypervisor, also assume the device access is being virtualised. Reported-by: Stefan Fritsch <sf@sfritsch.de> Suggested-by: Stefan Fritsch <sf@sfritsch.de> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Zhenyu Wang <zhenyuw@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Stefan Fritsch <sf@sfritsch.de> Cc: stable@vger.kernel.org Tested-by: Stefan Fritsch <sf@sfritsch.de> Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201019101523.4145-1-chris@chris-wilson.co.uk (cherry picked from commit f566fdc) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 3da3c5c commit 8195400

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <uapi/drm/i915_drm.h>
3434
#include <uapi/drm/drm_fourcc.h>
3535

36+
#include <asm/hypervisor.h>
37+
3638
#include <linux/io-mapping.h>
3739
#include <linux/i2c.h>
3840
#include <linux/i2c-algo-bit.h>
@@ -1760,7 +1762,9 @@ static inline bool intel_vtd_active(void)
17601762
if (intel_iommu_gfx_mapped)
17611763
return true;
17621764
#endif
1763-
return false;
1765+
1766+
/* Running as a guest, we assume the host is enforcing VT'd */
1767+
return !hypervisor_is_type(X86_HYPER_NATIVE);
17641768
}
17651769

17661770
static inline bool intel_scanout_needs_vtd_wa(struct drm_i915_private *dev_priv)

0 commit comments

Comments
 (0)