[RFC PATCH 104/105] KVM: selftests: Remove vcpu_state() helper

Sean Christopherson
2022-03-11T06:01:06Z

.../selftests/kvm/include/kvm_util_base.h | 1 -
tools/testing/selftests/kvm/lib/kvm_util.c | 21 ++-----------------
2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h
index 6d46261432cb..f6926ab277d3 100644
--- a/tools/testing/selftests/kvm/include/kvm_util_base.h
+++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
@@ -286,7 +286,6 @@ void *addr_gva2hva(struct kvm_vm *vm, vm_vaddr_t gva);
vm_paddr_t addr_hva2gpa(struct kvm_vm *vm, void *hva);
void *addr_gpa2alias(struct kvm_vm *vm, vm_paddr_t gpa);

-struct kvm_run *vcpu_state(struct kvm_vcpu *vcpu);
void vcpu_run(struct kvm_vcpu *vcpu);
int _vcpu_run(struct kvm_vcpu *vcpu);

diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index b86c8b0883ad..7f82c6ba2a37 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -995,19 +995,7 @@ void vm_mem_region_delete(struct kvm_vm *vm, uint32_t slot)
__vm_mem_region_delete(vm, memslot2region(vm, slot), true);
}

-/*
- * VCPU mmap Size
- *
- * Input Args: None
- *
- * Output Args: None
- *
- * Return:
- * Size of VCPU state
- *
- * Returns the size of the structure pointed to by the return value
- * of vcpu_state().
- */
+/* Returns the size of a vCPU's kvm_run structure. */
static int vcpu_mmap_sz(void)
{
int dev_fd, ret;
@@ -1061,7 +1049,7 @@ struct kvm_vcpu *__vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id)
vcpu_mmap_sz(), sizeof(*vcpu->run));
vcpu->run = (struct kvm_run *) mmap(NULL, vcpu_mmap_sz(),
PROT_READ | PROT_WRITE, MAP_SHARED, vcpu->fd, 0);
- TEST_ASSERT(vcpu->run != MAP_FAILED, "mmap vcpu_state failed, "
+ TEST_ASSERT(vcpu->run != MAP_FAILED, "mmap kvm_run page failed, "
"vcpu id: %u errno: %i", vcpu_id, errno);

/* Add to linked-list of VCPUs. */
@@ -1390,11 +1378,6 @@ void vm_create_irqchip(struct kvm_vm *vm)

vm->has_irqchip = true;
}
-struct kvm_run *vcpu_state(struct kvm_vcpu *vcpu)
-{
- return vcpu->run;
-}
-

int _vcpu_run(struct kvm_vcpu *vcpu)
{
--
2.35.1.723.g4982287a31-goog