mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-25 00:52:45 -04:00
KVM: selftests: Make vCPU exit reason test assertion common
Make TEST_ASSERT_KVM_EXIT_REASON() macro and replace all exit reason test assert statements with it. No functional changes intended. Signed-off-by: Vipin Sharma <vipinsh@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Message-Id: <20230204014547.583711-2-vipinsh@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
e6239a4ec5
commit
c96f57b080
@@ -158,14 +158,12 @@ int main(int argc, char *argv[])
|
||||
struct kvm_regs regs1, regs2;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
struct kvm_run *run;
|
||||
struct kvm_x86_state *state;
|
||||
struct ucall uc;
|
||||
int stage;
|
||||
|
||||
/* Create VM */
|
||||
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
|
||||
run = vcpu->run;
|
||||
|
||||
vcpu_regs_get(vcpu, ®s1);
|
||||
|
||||
@@ -183,10 +181,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (stage = 1;; stage++) {
|
||||
vcpu_run(vcpu);
|
||||
TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
|
||||
"Stage %d: unexpected exit reason: %u (%s),\n",
|
||||
stage, run->exit_reason,
|
||||
exit_reason_str(run->exit_reason));
|
||||
TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO);
|
||||
|
||||
switch (get_ucall(vcpu, &uc)) {
|
||||
case UCALL_ABORT:
|
||||
@@ -214,7 +209,6 @@ int main(int argc, char *argv[])
|
||||
/* Restore state in a new VM. */
|
||||
vcpu = vm_recreate_with_one_vcpu(vm);
|
||||
vcpu_load_state(vcpu, state);
|
||||
run = vcpu->run;
|
||||
kvm_x86_state_cleanup(state);
|
||||
|
||||
memset(®s2, 0, sizeof(regs2));
|
||||
|
||||
Reference in New Issue
Block a user