[kvm-unit-tests PATCH 13/32] x86: don't special case vmx null test

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

 



From: Peter Feiner <pfeiner@xxxxxxxxxx>

Signed-off-by: Peter Feiner <pfeiner@xxxxxxxxxx>
Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
---
 x86/unittests.cfg |  6 ++++++
 x86/vmx.c         | 25 ++++---------------------
 x86/vmx_tests.c   |  1 +
 3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 0f2c94fb548d..8a89eb0ef0ad 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -200,6 +200,12 @@ extra_params = -cpu host,+vmx -append -exit_monitor_from_l2_test
 arch = x86_64
 groups = vmx
 
+[vmx_null]
+file = vmx.flat
+extra_params = -cpu host,+vmx -append null
+arch = x86_64
+groups = vmx
+
 [vmx_test_vmx_feature_control]
 file = vmx.flat
 extra_params = -cpu host,+vmx -append test_vmx_feature_control
diff --git a/x86/vmx.c b/x86/vmx.c
index 9ca37f63b636..15ed94af56fd 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -563,14 +563,6 @@ static void test_vmclear(void)
 	test_vmclear_flushing();
 }
 
-static void test_vmxoff(void)
-{
-	int ret;
-
-	ret = vmx_off();
-	report("test vmxoff", !ret);
-}
-
 static void __attribute__((__used__)) guest_main(void)
 {
 	current->guest_main();
@@ -1550,9 +1542,6 @@ int main(int argc, const char *argv[])
 			wrmsr(MSR_IA32_FEATURE_CONTROL, 0x5);
 	}
 
-	/* Set basic test ctxt the same as "null" */
-	current = &vmx_tests[0];
-
 	if (test_wanted("test_vmxon", argv, argc)) {
 		/* Enables VMX */
 		if (test_vmxon() != 0)
@@ -1574,19 +1563,13 @@ int main(int argc, const char *argv[])
 		test_vmwrite_vmread();
 	if (test_wanted("test_vmcs_lifecycle", argv, argc))
 		test_vmcs_lifecycle();
-
-	init_vmcs(&vmcs_root);
-	if (vmx_run()) {
-		report("test vmlaunch", 0);
-		goto exit;
-	}
-
-	test_vmxoff();
-
 	if (test_wanted("test_vmx_caps", argv, argc))
 		test_vmx_caps();
 
-	while (vmx_tests[++i].name != NULL) {
+	/* Balance vmxon from test_vmxon. */
+	vmx_off();
+
+	for (; vmx_tests[i].name != NULL; i++) {
 		if (!test_wanted(vmx_tests[i].name, argv, argc))
 			continue;
 		if (test_run(&vmx_tests[i]))
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 35af67744971..918cade2a3e8 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -29,6 +29,7 @@ static inline void vmcall()
 
 void basic_guest_main()
 {
+	report("Basic VMX test", 1);
 }
 
 int basic_exit_handler()
-- 
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