KVM: selftests: Delete dead ucall code
authorDavid Matlack <dmatlack@google.com>
Wed, 2 Nov 2022 18:46:47 +0000 (11:46 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 17 Nov 2022 00:58:59 +0000 (16:58 -0800)
Delete a bunch of code related to ucall handling from
smaller_maxphyaddr_emulation_test. The only thing
smaller_maxphyaddr_emulation_test needs to check is that the vCPU exits
with UCALL_DONE after the second vcpu_run().

Signed-off-by: David Matlack <dmatlack@google.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221102184654.282799-4-dmatlack@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c

index 6f7891b0e193b2476d7a4a2dab0f8c1546177e38..b72aeefda70c60b7a7a59f51e642fadb7291982b 100644 (file)
@@ -63,64 +63,6 @@ static void process_exit_on_emulation_error(struct kvm_vcpu *vcpu)
        vcpu_regs_set(vcpu, &regs);
 }
 
-static void do_guest_assert(struct ucall *uc)
-{
-       REPORT_GUEST_ASSERT(*uc);
-}
-
-static void check_for_guest_assert(struct kvm_vcpu *vcpu)
-{
-       struct ucall uc;
-
-       if (vcpu->run->exit_reason == KVM_EXIT_IO &&
-           get_ucall(vcpu, &uc) == UCALL_ABORT) {
-               do_guest_assert(&uc);
-       }
-}
-
-static void process_ucall_done(struct kvm_vcpu *vcpu)
-{
-       struct kvm_run *run = vcpu->run;
-       struct ucall uc;
-
-       check_for_guest_assert(vcpu);
-
-       TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
-                   "Unexpected exit reason: %u (%s)",
-                   run->exit_reason,
-                   exit_reason_str(run->exit_reason));
-
-       TEST_ASSERT(get_ucall(vcpu, &uc) == UCALL_DONE,
-                   "Unexpected ucall command: %lu, expected UCALL_DONE (%d)",
-                   uc.cmd, UCALL_DONE);
-}
-
-static uint64_t process_ucall(struct kvm_vcpu *vcpu)
-{
-       struct kvm_run *run = vcpu->run;
-       struct ucall uc;
-
-       TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
-                   "Unexpected exit reason: %u (%s)",
-                   run->exit_reason,
-                   exit_reason_str(run->exit_reason));
-
-       switch (get_ucall(vcpu, &uc)) {
-       case UCALL_SYNC:
-               break;
-       case UCALL_ABORT:
-               do_guest_assert(&uc);
-               break;
-       case UCALL_DONE:
-               process_ucall_done(vcpu);
-               break;
-       default:
-               TEST_ASSERT(false, "Unexpected ucall");
-       }
-
-       return uc.cmd;
-}
-
 int main(int argc, char *argv[])
 {
        struct kvm_vcpu *vcpu;
@@ -156,8 +98,7 @@ int main(int argc, char *argv[])
        vcpu_run(vcpu);
        process_exit_on_emulation_error(vcpu);
        vcpu_run(vcpu);
-
-       TEST_ASSERT(process_ucall(vcpu) == UCALL_DONE, "Expected UCALL_DONE");
+       ASSERT_EQ(get_ucall(vcpu, NULL), UCALL_DONE);
 
        kvm_vm_free(vm);