Commit 28a65567 authored by Sean Christopherson's avatar Sean Christopherson

KVM: selftests: Drop now-unnecessary ucall_uninit()

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: default avatarAndrew Jones <andrew.jones@linux.dev>
Tested-by: default avatarPeter Gonda <pgonda@google.com>
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221006003409.649993-7-seanjc@google.com
parent 03b47505
...@@ -162,6 +162,5 @@ int main(void) ...@@ -162,6 +162,5 @@ int main(void)
test_user_raz_invariant(vcpu); test_user_raz_invariant(vcpu);
test_guest_raz(vcpu); test_guest_raz(vcpu);
ucall_uninit(vm);
kvm_vm_free(vm); kvm_vm_free(vm);
} }
...@@ -811,7 +811,6 @@ static void run_test(enum vm_guest_mode mode, void *arg) ...@@ -811,7 +811,6 @@ static void run_test(enum vm_guest_mode mode, void *arg)
free(bmap); free(bmap);
free(host_bmap_track); free(host_bmap_track);
ucall_uninit(vm);
kvm_vm_free(vm); kvm_vm_free(vm);
} }
......
...@@ -25,7 +25,6 @@ struct ucall { ...@@ -25,7 +25,6 @@ struct ucall {
}; };
void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa); 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_do_ucall(vm_vaddr_t uc);
void *ucall_arch_get_ucall(struct kvm_vcpu *vcpu); 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) ...@@ -37,11 +36,6 @@ static inline void ucall_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
ucall_arch_init(vm, 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) \ #define GUEST_SYNC_ARGS(stage, arg1, arg2, arg3, arg4) \
ucall(UCALL_SYNC, 6, "hello", 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) #define GUEST_SYNC(stage) ucall(UCALL_SYNC, 2, "hello", stage)
......
...@@ -416,7 +416,6 @@ static void run_test(enum vm_guest_mode mode, void *arg) ...@@ -416,7 +416,6 @@ static void run_test(enum vm_guest_mode mode, void *arg)
TEST_ASSERT(ret == 0, "Error in sem_destroy"); TEST_ASSERT(ret == 0, "Error in sem_destroy");
free(vcpu_threads); free(vcpu_threads);
ucall_uninit(vm);
kvm_vm_free(vm); kvm_vm_free(vm);
} }
......
...@@ -12,23 +12,13 @@ ...@@ -12,23 +12,13 @@
*/ */
static vm_vaddr_t *ucall_exit_mmio_addr; 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) void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
{ {
virt_pg_map(vm, mmio_gpa, 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) write_guest_global(vm, ucall_exit_mmio_addr, (vm_vaddr_t *)mmio_gpa);
{
ucall_set_mmio_addr(vm, (vm_paddr_t)NULL);
} }
void ucall_arch_do_ucall(vm_vaddr_t uc) void ucall_arch_do_ucall(vm_vaddr_t uc)
......
...@@ -229,7 +229,6 @@ struct kvm_vm *memstress_create_vm(enum vm_guest_mode mode, int nr_vcpus, ...@@ -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) void memstress_destroy_vm(struct kvm_vm *vm)
{ {
ucall_uninit(vm);
kvm_vm_free(vm); kvm_vm_free(vm);
} }
......
...@@ -14,10 +14,6 @@ void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa) ...@@ -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, struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
unsigned long arg1, unsigned long arg2, unsigned long arg1, unsigned long arg2,
unsigned long arg3, unsigned long arg4, unsigned long arg3, unsigned long arg4,
......
...@@ -10,10 +10,6 @@ void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa) ...@@ -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) void ucall_arch_do_ucall(vm_vaddr_t uc)
{ {
/* Exit via DIAGNOSE 0x501 (normally used for breakpoints) */ /* Exit via DIAGNOSE 0x501 (normally used for breakpoints) */
......
...@@ -12,10 +12,6 @@ void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa) ...@@ -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) void ucall_arch_do_ucall(vm_vaddr_t uc)
{ {
asm volatile("in %[port], %%al" asm volatile("in %[port], %%al"
......
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