diff mbox

[XTF,11/16] vvmx: test vmxon with bit 31 of VMCS revision ID set

Message ID 20161216134348.16236-12-haozhong.zhang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Haozhong Zhang Dec. 16, 2016, 1:43 p.m. UTC
VMfailInvalid is expected in this test.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
 tests/vvmx/vmxon.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff mbox

Patch

diff --git a/tests/vvmx/vmxon.c b/tests/vvmx/vmxon.c
index 75b6dcb..268baa8 100644
--- a/tests/vvmx/vmxon.c
+++ b/tests/vvmx/vmxon.c
@@ -118,6 +118,22 @@  static bool test_vmxon_mismatched_revid(void)
                               VMXERR_VMFAIL_INVALID, 0, 0);
 }
 
+/**
+ * vmxon with VMCS revision ID[31] set
+ *
+ * Expect: VMfailInvalid
+ */
+static bool test_vmxon_revid_bit31(void)
+{
+    clear_vmcs(vmxon_region, get_vmcs_revid() | (1UL << 31));
+
+    exinfo_t fault;
+    uint8_t ret = vmxon((uint64_t)vmxon_region, &fault);
+
+    return handle_vmxinsn_err(__func__, ret, fault,
+                              VMXERR_VMFAIL_INVALID, 0, 0);
+}
+
 bool test_vmxon(void)
 {
     if ( !test_vmxon_novmxe() )
@@ -138,6 +154,9 @@  bool test_vmxon(void)
     if ( !test_vmxon_mismatched_revid() )
         return false;
 
+    if ( !test_vmxon_revid_bit31() )
+        return false;
+
     return true;
 }