[PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement

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

 



The EPT access tests require at least 41 bits of guest physical address
space.  This is because the test data needs a separate PML4 entry in the
EPT table.  However, many consumer-grade processors have only 36 or
39-bit MAXPHYADDR, and the tests fail there with a page fault due to
reserved bits set in the guest (GVA->GPA) page tables.

Add a test on MAXPHYADDR and skip the tests if they cannot run on the
system under test, and only require 40 bits to lower the requirements.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 x86/vmx_tests.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index e8c97f2..0c3b5a7 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -2609,6 +2609,10 @@ static void ept_access_test_setup(void)
 	if (setup_ept(false))
 		test_skip("EPT not supported");
 
+	/* We use data->gpa = 1 << 39 so that test data has a separate pml4 entry */
+	if (cpuid_maxphyaddr() < 40)
+		test_skip("Test needs MAXPHYADDR >= 40");
+
 	test_set_guest(ept_access_test_guest);
 	test_add_teardown(ept_access_test_teardown, NULL);
 
@@ -2616,7 +2620,7 @@ static void ept_access_test_setup(void)
 	TEST_ASSERT(data->hva);
 	data->hpa = virt_to_phys(data->hva);
 
-	data->gpa = 1ul << 40;
+	data->gpa = 1ul << 39;
 	data->gva = (void *) ALIGN((unsigned long) alloc_vpages(npages * 2),
 				   size);
 	TEST_ASSERT(!any_present_pages(page_table, data->gva, size));
-- 
1.8.3.1




[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