Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1dff15c authored by Chris Wilson's avatar Chris Wilson Committed by Greg Kroah-Hartman
Browse files

drm/i915: Force VT'd workarounds when running as a guest OS



commit 8195400f7ea95399f721ad21f4d663a62c65036f upstream.

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: default avatarStefan Fritsch <sf@sfritsch.de>
Suggested-by: default avatarStefan Fritsch <sf@sfritsch.de>
Signed-off-by: default avatarChris 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: default avatarStefan Fritsch <sf@sfritsch.de>
Reviewed-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201019101523.4145-1-chris@chris-wilson.co.uk


(cherry picked from commit f566fdcd6cc49a9d5b5d782f56e3e7cb243f01b8)
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 51f6f0e8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@
#include <uapi/drm/i915_drm.h>
#include <uapi/drm/drm_fourcc.h>

#include <asm/hypervisor.h>

#include <linux/io-mapping.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
@@ -2683,7 +2685,9 @@ static inline bool intel_vtd_active(void)
	if (intel_iommu_gfx_mapped)
		return true;
#endif
	return false;

	/* Running as a guest, we assume the host is enforcing VT'd */
	return !hypervisor_is_type(X86_HYPER_NATIVE);
}

static inline bool intel_scanout_needs_vtd_wa(struct drm_i915_private *dev_priv)