KVM: selftests: Drop now-unnecessary ucall_uninit()
authorSean Christopherson <seanjc@google.com>
Thu, 6 Oct 2022 00:34:08 +0000 (00:34 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 17 Nov 2022 00:58:53 +0000 (16:58 -0800)
Drop ucall_uninit() and ucall_arch_uninit() now that ARM doesn't modify
the host's copy of ucall_exit_mmio_addr, i.e. now that there's no need to
reset the pointer before potentially creating a new VM.  The few calls to
ucall_uninit() are all immediately followed by kvm_vm_free(), and that is
likely always going to hold true, i.e. it's extremely unlikely a test
will want to effectively disable ucall in the middle of a test.

Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Tested-by: Peter Gonda <pgonda@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221006003409.649993-7-seanjc@google.com
tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c
tools/testing/selftests/kvm/dirty_log_test.c
tools/testing/selftests/kvm/include/ucall_common.h
tools/testing/selftests/kvm/kvm_page_table_test.c
tools/testing/selftests/kvm/lib/aarch64/ucall.c
tools/testing/selftests/kvm/lib/memstress.c
tools/testing/selftests/kvm/lib/riscv/ucall.c
tools/testing/selftests/kvm/lib/s390x/ucall.c
tools/testing/selftests/kvm/lib/x86_64/ucall.c

index 03f6b3af6b4d7ac0b985c0a9dccda4ad37c57cab..b1d2158c0b6de625095fadf2167e5ca4efc74f64 100644 (file)
@@ -162,6 +162,5 @@ int main(void)
        test_user_raz_invariant(vcpu);
        test_guest_raz(vcpu);
 
-       ucall_uninit(vm);
        kvm_vm_free(vm);
 }
index b458a2701634bac4ade217f7d53e0ff1b546e797..a38c4369fb8ed29d2a785fcd37496860e8e47163 100644 (file)
@@ -811,7 +811,6 @@ static void run_test(enum vm_guest_mode mode, void *arg)
 
        free(bmap);
        free(host_bmap_track);
-       ucall_uninit(vm);
        kvm_vm_free(vm);
 }
 
index 8077a6d8b1ba58aae7370caf37dc8e2ed67b64e5..2662a4352a8c0a118821d34d8aad2c08b94ccb2d 100644 (file)
@@ -25,7 +25,6 @@ struct ucall {
 };
 
 void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa);
-void ucall_arch_uninit(struct kvm_vm *vm);
 void ucall_arch_do_ucall(vm_vaddr_t uc);
 void *ucall_arch_get_ucall(struct kvm_vcpu *vcpu);
 
@@ -37,11 +36,6 @@ static inline void ucall_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
        ucall_arch_init(vm, mmio_gpa);
 }
 
-static inline void ucall_uninit(struct kvm_vm *vm)
-{
-       ucall_arch_uninit(vm);
-}
-
 #define GUEST_SYNC_ARGS(stage, arg1, arg2, arg3, arg4) \
                                ucall(UCALL_SYNC, 6, "hello", stage, arg1, arg2, arg3, arg4)
 #define GUEST_SYNC(stage)      ucall(UCALL_SYNC, 2, "hello", stage)
index 3db32d56787e8e482566f7776e7ebd1f10f812c4..b3b00be1ef82494c89caa02ad8ca39fa21c6c28a 100644 (file)
@@ -416,7 +416,6 @@ static void run_test(enum vm_guest_mode mode, void *arg)
        TEST_ASSERT(ret == 0, "Error in sem_destroy");
 
        free(vcpu_threads);
-       ucall_uninit(vm);
        kvm_vm_free(vm);
 }
 
index 1c38bd260f90b707dce0d765852d30c09f4d206d..21d73afcb14fb1c8055e1e0d4769696c7694e132 100644 (file)
  */
 static vm_vaddr_t *ucall_exit_mmio_addr;
 
-static void ucall_set_mmio_addr(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
-{
-       vm->ucall_mmio_addr = mmio_gpa;
-
-       write_guest_global(vm, ucall_exit_mmio_addr, (vm_vaddr_t *)mmio_gpa);
-}
-
 void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
 {
        virt_pg_map(vm, mmio_gpa, mmio_gpa);
 
-       ucall_set_mmio_addr(vm, mmio_gpa);
-}
+       vm->ucall_mmio_addr = mmio_gpa;
 
-void ucall_arch_uninit(struct kvm_vm *vm)
-{
-       ucall_set_mmio_addr(vm, (vm_paddr_t)NULL);
+       write_guest_global(vm, ucall_exit_mmio_addr, (vm_vaddr_t *)mmio_gpa);
 }
 
 void ucall_arch_do_ucall(vm_vaddr_t uc)
index b66404e56a3f878eff5047b815283f9af585c223..2de8a5d527b3a7af886960b748ca5640b8cf85bb 100644 (file)
@@ -229,7 +229,6 @@ struct kvm_vm *memstress_create_vm(enum vm_guest_mode mode, int nr_vcpus,
 
 void memstress_destroy_vm(struct kvm_vm *vm)
 {
-       ucall_uninit(vm);
        kvm_vm_free(vm);
 }
 
index c58ecb8a0981bd909fd689d2b8dce38dd8ef8681..78acdb084ab0fbb9310e7de0052d9338cc6b3002 100644 (file)
@@ -14,10 +14,6 @@ void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
 {
 }
 
-void ucall_arch_uninit(struct kvm_vm *vm)
-{
-}
-
 struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
                        unsigned long arg1, unsigned long arg2,
                        unsigned long arg3, unsigned long arg4,
index 208f0f04299bb073457e039a7b87d57c118f2606..cbee520a26f2adff08e3a7dccb3756e48771e492 100644 (file)
@@ -10,10 +10,6 @@ void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
 {
 }
 
-void ucall_arch_uninit(struct kvm_vm *vm)
-{
-}
-
 void ucall_arch_do_ucall(vm_vaddr_t uc)
 {
        /* Exit via DIAGNOSE 0x501 (normally used for breakpoints) */
index 016a0487cf7235c2f63e8c5996cb65dd3caa0d85..eb8bf55b359a526c5e43b319fa244722849ee96c 100644 (file)
@@ -12,10 +12,6 @@ void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
 {
 }
 
-void ucall_arch_uninit(struct kvm_vm *vm)
-{
-}
-
 void ucall_arch_do_ucall(vm_vaddr_t uc)
 {
        asm volatile("in %[port], %%al"