Commit 41b0552a authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Paolo Bonzini

KVM: selftests: test enlightened vmenter with wrong eVMCS version

Check that VMfailInvalid happens when eVMCS revision is is invalid.
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 7bcf732e
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
void l2_guest_code(void) void l2_guest_code(void)
{ {
GUEST_SYNC(6);
GUEST_SYNC(7); GUEST_SYNC(7);
GUEST_SYNC(8);
/* Done, exit to L1 and never come back. */ /* Done, exit to L1 and never come back. */
vmcall(); vmcall();
} }
...@@ -50,12 +50,17 @@ void l1_guest_code(struct vmx_pages *vmx_pages) ...@@ -50,12 +50,17 @@ void l1_guest_code(struct vmx_pages *vmx_pages)
GUEST_SYNC(5); GUEST_SYNC(5);
GUEST_ASSERT(vmptrstz() == vmx_pages->enlightened_vmcs_gpa); GUEST_ASSERT(vmptrstz() == vmx_pages->enlightened_vmcs_gpa);
current_evmcs->revision_id = -1u;
GUEST_ASSERT(vmlaunch());
current_evmcs->revision_id = EVMCS_VERSION;
GUEST_SYNC(6);
GUEST_ASSERT(!vmlaunch()); GUEST_ASSERT(!vmlaunch());
GUEST_ASSERT(vmptrstz() == vmx_pages->enlightened_vmcs_gpa); GUEST_ASSERT(vmptrstz() == vmx_pages->enlightened_vmcs_gpa);
GUEST_SYNC(8); GUEST_SYNC(9);
GUEST_ASSERT(!vmresume()); GUEST_ASSERT(!vmresume());
GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_VMCALL); GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_VMCALL);
GUEST_SYNC(9); GUEST_SYNC(10);
} }
void guest_code(struct vmx_pages *vmx_pages) void guest_code(struct vmx_pages *vmx_pages)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment