[kvm-unit-tests PATCH 08/12] nSVM: Clear guest's EFER.NX in NPT NX test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clear the guest's EFER.NX when testing that KVM supports the NX bit in
nested NPT.  The guest's EFER (and CR0 and CR4) should not affect NPT
behavior in any way.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
 x86/svm_tests.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index b1783f8..fdef620 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -705,6 +705,9 @@ static void npt_nx_prepare(struct svm_test *test)
     test->scratch = rdmsr(MSR_EFER);
     wrmsr(MSR_EFER, test->scratch | EFER_NX);
 
+    /* Clear the guest's EFER.NX, it should not affect NPT behavior. */
+    vmcb->save.efer &= ~EFER_NX;
+
     pte = npt_get_pte((u64)null_test);
 
     *pte |= PT64_NX_MASK;
-- 
2.32.0.288.g62a8d224e6-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux