[kvm-unit-tests PATCH 31/32] x86: force ept 2m test

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

 



From: Peter Feiner <pfeiner@xxxxxxxxxx>

EPT tests don't exercise 2m support unless it's advertised properly.
This test asserts that we actually advertise it and that some basic 2m
stuff works.

Signed-off-by: Peter Feiner <pfeiner@xxxxxxxxxx>
Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
---
 x86/unittests.cfg |  6 ++++++
 x86/vmx_tests.c   | 13 +++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index bc245651ce80..09b2252ac2af 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -482,6 +482,12 @@ extra_params = -cpu host,+vmx -m 2048 -append ept_access_test_paddr_not_present_
 arch = x86_64
 groups = vmx
 
+[vmx_ept_access_test_force_2m_page]
+file = vmx.flat
+extra_params = -cpu host,+vmx -m 2048 -append ept_access_test_force_2m_page
+arch = x86_64
+groups = vmx
+
 [debug]
 file = debug.flat
 arch = x86_64
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index c4cd3f96001d..d59ca0baf48a 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -2807,6 +2807,18 @@ static void ept_access_test_paddr_not_present_page_fault(void)
 	 */
 }
 
+static void ept_access_test_force_2m_page(void)
+{
+	ept_access_test_setup();
+
+	TEST_ASSERT_EQ(ept_2m_supported(), true);
+	ept_allowed_at_level_mkhuge(true, 2, 0, 0, OP_READ);
+	ept_violation_at_level_mkhuge(true, 2, EPT_PRESENT, EPT_RA, OP_WRITE,
+				      EPT_VLT_WR | EPT_VLT_PERM_RD |
+				      EPT_VLT_LADDR_VLD | EPT_VLT_PADDR);
+	ept_misconfig_at_level_mkhuge(true, 2, EPT_PRESENT, EPT_WA);
+}
+
 #define TEST(name) { #name, .v2 = name }
 
 /* name/init/guest_main/exit_handler/syscall_handler/guest_regs */
@@ -2866,5 +2878,6 @@ struct vmx_test vmx_tests[] = {
 	TEST(ept_access_test_paddr_read_execute_ad_disabled),
 	TEST(ept_access_test_paddr_read_execute_ad_enabled),
 	TEST(ept_access_test_paddr_not_present_page_fault),
+	TEST(ept_access_test_force_2m_page),
 	{ NULL, NULL, NULL, NULL, NULL, {0} },
 };
-- 
2.12.2.816.g2cccc81164-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