aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadav Amit <namit@vmware.com>2020-06-30 02:45:15 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2020-07-01 08:10:30 -0400
commitc6405e37295930dbb545be178d18a46adcae629f (patch)
tree68fb052550c7e462b8a4349ed66c6d62bda10ab8
parentc803b19b843ff13d052fca76cb8685e8d5d564d9 (diff)
downloadkvm-unit-tests-c6405e37295930dbb545be178d18a46adcae629f.tar.gz
x86: svm: use PML4E in npt_rsvd_pfwalk_prepare
According to AMD manual bit 8 of the PDPE is not reserved, but it is in PML4E. Reported-by: Nadav Amit <namit@vmware.com> Message-Id: <20200630094516.22983-5-namit@vmware.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--x86/svm.c5
-rw-r--r--x86/svm.h1
-rw-r--r--x86/svm_tests.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/x86/svm.c b/x86/svm.c
index 0fcad8d..62907fd 100644
--- a/x86/svm.c
+++ b/x86/svm.c
@@ -49,6 +49,11 @@ u64 *npt_get_pdpe(void)
return pdpe;
}
+u64 *npt_get_pml4e(void)
+{
+ return pml4e;
+}
+
bool smp_supported(void)
{
return cpu_count() > 1;
diff --git a/x86/svm.h b/x86/svm.h
index 645deb7..8d688b6 100644
--- a/x86/svm.h
+++ b/x86/svm.h
@@ -365,6 +365,7 @@ typedef void (*test_guest_func)(struct svm_test *);
u64 *npt_get_pte(u64 address);
u64 *npt_get_pde(u64 address);
u64 *npt_get_pdpe(void);
+u64 *npt_get_pml4e(void);
bool smp_supported(void);
bool default_supported(void);
void default_prepare(struct svm_test *test);
diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 92cefaf..b540527 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -824,13 +824,13 @@ static void npt_rsvd_pfwalk_prepare(struct svm_test *test)
u64 *pdpe;
vmcb_ident(vmcb);
- pdpe = npt_get_pdpe();
+ pdpe = npt_get_pml4e();
pdpe[0] |= (1ULL << 8);
}
static bool npt_rsvd_pfwalk_check(struct svm_test *test)
{
- u64 *pdpe = npt_get_pdpe();
+ u64 *pdpe = npt_get_pml4e();
pdpe[0] &= ~(1ULL << 8);
return (vmcb->control.exit_code == SVM_EXIT_NPF)