[3/4] kvm-unit-test: nVMX: Remove test_sysenter_field() and use test_canonical() instead
diff mbox series

Message ID 20191206231302.3466-4-krish.sadhukhan@oracle.com
State New
Headers show
Series
  • KVM: nVMX: Check GUEST_SYSENTER_ESP and GUEST_SYSENTER_EIP on vmentry of nested guests
Related show

Commit Message

Krish Sadhukhan Dec. 6, 2019, 11:13 p.m. UTC
..as the latter already does what the former does.

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
---
 x86/vmx_tests.c | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

Patch
diff mbox series

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 7905861..5f836d4 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -6620,30 +6620,6 @@  static void virt_x2apic_mode_test(void)
 	assert_exit_reason(VMX_VMCALL);
 }
 
-/*
- * On processors that support Intel 64 architecture, the IA32_SYSENTER_ESP
- * field and the IA32_SYSENTER_EIP field must each contain a canonical
- * address.
- *
- *  [Intel SDM]
- */
-static void test_sysenter_field(u32 field, const char *name)
-{
-	u64 addr_saved = vmcs_read(field);
-
-	vmcs_write(field, NONCANONICAL);
-	report_prefix_pushf("%s non-canonical", name);
-	test_vmx_vmlaunch(VMXERR_ENTRY_INVALID_HOST_STATE_FIELD);
-	report_prefix_pop();
-
-	vmcs_write(field, 0xffffffff);
-	report_prefix_pushf("%s canonical", name);
-	test_vmx_vmlaunch(0);
-	report_prefix_pop();
-
-	vmcs_write(field, addr_saved);
-}
-
 static void test_ctl_reg(const char *cr_name, u64 cr, u64 fixed0, u64 fixed1)
 {
 	u64 val;
@@ -7432,8 +7408,8 @@  static void vmx_host_state_area_test(void)
 
 	test_host_ctl_regs();
 
-	test_sysenter_field(HOST_SYSENTER_ESP, "HOST_SYSENTER_ESP");
-	test_sysenter_field(HOST_SYSENTER_EIP, "HOST_SYSENTER_EIP");
+	test_canonical(HOST_SYSENTER_ESP, "HOST_SYSENTER_ESP", true);
+	test_canonical(HOST_SYSENTER_EIP, "HOST_SYSENTER_EIP", true);
 
 	test_host_efer();
 	test_load_host_pat();