diff mbox series

[kvm-unit-tests,2/3] x86/access: Skip running guest physical bits tests on AMD with NPT enabled

Message ID 20200806124358.4928-3-mgamal@redhat.com (mailing list archive)
State New, archived
Headers show
Series x86: Add guest physical bits tests | expand

Commit Message

Mohammed Gamal Aug. 6, 2020, 12:43 p.m. UTC
Since we can't handle NPT VM exits properly. We won't run
guest physical bits tests if NPT is enabled.

Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
---
 x86/access.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/x86/access.c b/x86/access.c
index 7dc9eb6..90c5fe4 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -973,6 +973,14 @@  static int ac_test_run(void)
         invalid_mask |= AC_PTE_BIT36_MASK;
     }
 
+    if (this_cpu_has(X86_FEATURE_NPT)) {
+        printf("NPT enabled. Skipping physical bits tests\n");
+        invalid_mask |= AC_PDE_BIT51_MASK;
+        invalid_mask |= AC_PTE_BIT51_MASK;
+        invalid_mask |= AC_PDE_BIT36_MASK;
+        invalid_mask |= AC_PTE_BIT36_MASK;
+    }
+
     if (this_cpu_has(X86_FEATURE_PKU)) {
         set_cr4_pke(1);
         set_cr4_pke(0);