Skip to contentSkip to conversation

drm/i915: Do not enable movntdqa optimization in hypervisor guest

PATCH New [email protected] 2 participants 2 messages Dec 25, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915: Do not enable movntdqa optimization in hypervisor guest

From: Changbin Du <[email protected]>

Our QA reported a problem caused by movntdqa instructions. Currently, the KVM hypervisor doesn't support VEX-prefix instructions emulation. If users passthrough a GPU to guest with vfio option 'x-no-mmap=on', then all access to the BARs will be trapped and emulated. The KVM hypervisor would raise an inertal error to qemu which cause the guest killed. (Since 'movntdqa' ins is not supported.)

This patch try not to enable movntdqa optimization if the driver is running in hypervisor guest.

v2: update comment.

---
 drivers/gpu/drm/i915/i915_memcpy.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_memcpy.c +6 -1
index 49a0794..79f8ec7 100644
@@ -96,6 +96,11 @@ bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len)
 
 void i915_memcpy_init_early(struct drm_i915_private *dev_priv)
 {
-	if (static_cpu_has(X86_FEATURE_XMM4_1))
+	/*
+	 * Some hypervisors (e.g. KVM) don't support VEX-prefix instructions
+	 * emulation. So don't enable movntdqa in hypervisor guest.
+	 */
+	if (static_cpu_has(X86_FEATURE_XMM4_1) &&
+	    !boot_cpu_has(X86_FEATURE_HYPERVISOR))
 		static_branch_enable(&has_movntdqa);
 }
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Do not enable movntdqa optimization in hypervisor guest (rev2)

== Series Details ==

== Series Details ==

Series: drm/i915: Do not enable movntdqa optimization in hypervisor guest (rev2)
URL : https://patchwork.freedesktop.org/series/35711/
State : failure

== Summary ==

Applying: drm/i915: Do not enable movntdqa optimization in hypervisor guest Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_memcpy.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx