[kvm-unit-test,nVMX,1/2] : vmlaunch_succeeds() needs to check failure of VM-entry MSR-load
diff mbox series

Message ID 20190115180533.19397-2-krish.sadhukhan@oracle.com
State New
Headers show
Series
  • [kvm-unit-test,nVMX,1/2] : vmlaunch_succeeds() needs to check failure of VM-entry MSR-load
Related show

Commit Message

Krish Sadhukhan Jan. 15, 2019, 6:05 p.m. UTC
.. as that is one of the valid reasons for vmentry failure.

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
---
 x86/vmx_tests.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Jim Mattson Jan. 15, 2019, 6:44 p.m. UTC | #1
On Tue, Jan 15, 2019 at 10:30 AM Krish Sadhukhan
<krish.sadhukhan@oracle.com> wrote:
>
>  .. as that is one of the valid reasons for vmentry failure.
>
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Jim Mattson <jmattson@google.com>

Patch
diff mbox series

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index ee0c9ff..02cd868 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3262,6 +3262,8 @@  static void invvpid_test_v2(void)
  */
 static bool vmlaunch_succeeds(void)
 {
+	u32 exit_reason;
+
 	/*
 	 * Indirectly set VMX_INST_ERR to 12 ("VMREAD/VMWRITE from/to
 	 * unsupported VMCS component"). The caller can then check
@@ -3277,8 +3279,9 @@  static bool vmlaunch_succeeds(void)
 				   : success);
 	return false;
 success:
-	TEST_ASSERT(vmcs_read(EXI_REASON) ==
-		    (VMX_FAIL_STATE | VMX_ENTRY_FAILURE));
+	exit_reason = vmcs_read(EXI_REASON);
+	TEST_ASSERT(exit_reason == (VMX_FAIL_STATE | VMX_ENTRY_FAILURE) ||
+		    exit_reason == (VMX_FAIL_MSR | VMX_ENTRY_FAILURE));
 	return true;
 }