Commit 1d2c6c9b authored by Paolo Bonzini's avatar Paolo Bonzini

selftests: kvm/set_memory_region_test: do not check RIP if the guest shuts down

On AMD, the state of the VMCB is undefined after a shutdown VMEXIT.  KVM
takes a very conservative approach to that and resets the guest altogether
when that happens.  This causes the set_memory_region_test to fail
because the RIP is 0xfff0 (the reset vector).  Restrict the RIP test
to KVM_EXIT_INTERNAL_ERROR in order to fix this.
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent e72436bc
...@@ -287,10 +287,15 @@ static void test_delete_memory_region(void) ...@@ -287,10 +287,15 @@ static void test_delete_memory_region(void)
vcpu_regs_get(vm, VCPU_ID, &regs); vcpu_regs_get(vm, VCPU_ID, &regs);
TEST_ASSERT(regs.rip >= final_rip_start && /*
regs.rip < final_rip_end, * On AMD, after KVM_EXIT_SHUTDOWN the VMCB has been reinitialized already,
"Bad rip, expected 0x%lx - 0x%lx, got 0x%llx\n", * so the instruction pointer would point to the reset vector.
final_rip_start, final_rip_end, regs.rip); */
if (run->exit_reason == KVM_EXIT_INTERNAL_ERROR)
TEST_ASSERT(regs.rip >= final_rip_start &&
regs.rip < final_rip_end,
"Bad rip, expected 0x%lx - 0x%lx, got 0x%llx\n",
final_rip_start, final_rip_end, regs.rip);
kvm_vm_free(vm); kvm_vm_free(vm);
} }
......
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