]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: selftests: Drop vm_create_default* helpers
authorSean Christopherson <seanjc@google.com>
Wed, 16 Feb 2022 20:45:22 +0000 (12:45 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 11 Jun 2022 15:47:15 +0000 (11:47 -0400)
Drop all vm_create_default*() helpers, the "default" naming turned out to
terrible as wasn't extensible (hard to have multiple defaults), was a lie
(half the settings were default, half weren't), and failed to capture
relationships between helpers, e.g. compared with the kernel's standard
underscores pattern.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/kvm_util_base.h
tools/testing/selftests/kvm/lib/kvm_util.c

index 9c29b6797ce89f3c748bce546e58937947e1da38..90521c5716b1b8cfeaa2152d2650a70786200bc7 100644 (file)
@@ -559,29 +559,6 @@ static inline struct kvm_vm *vm_create(uint64_t nr_pages)
        return __vm_create(VM_MODE_DEFAULT, nr_pages);
 }
 
-/*
- * Create a VM with reasonable defaults
- *
- * Input Args:
- *   vcpuid - The id of the single VCPU to add to the VM.
- *   extra_mem_pages - The number of extra pages to add (this will
- *                     decide how much extra space we will need to
- *                     setup the page tables using memslot 0)
- *   guest_code - The vCPU's entry point
- *
- * Output Args: None
- *
- * Return:
- *   Pointer to opaque structure that describes the created VM.
- */
-struct kvm_vm *vm_create_default(uint32_t vcpuid, uint64_t extra_mem_pages,
-                                void *guest_code);
-
-/* Same as vm_create_default, but can be used for more than one vcpu */
-struct kvm_vm *vm_create_default_with_vcpus(uint32_t nr_vcpus, uint64_t extra_mem_pages,
-                                           uint32_t num_percpu_pages, void *guest_code,
-                                           uint32_t vcpuids[]);
-
 /* Like vm_create_default_with_vcpus, but accepts mode and slot0 memory as a parameter */
 struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus,
                                      uint64_t slot0_mem_pages, uint64_t extra_mem_pages,
index 3015d490a8f6229733ed222cfd52479c715c9294..137ffa1bc1f285faaf8b66407ca819a4c1cac5a4 100644 (file)
@@ -337,28 +337,17 @@ struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus
        return vm;
 }
 
-struct kvm_vm *vm_create_default_with_vcpus(uint32_t nr_vcpus, uint64_t extra_mem_pages,
-                                           uint32_t num_percpu_pages, void *guest_code,
-                                           uint32_t vcpuids[])
-{
-       return __vm_create_with_vcpus(VM_MODE_DEFAULT, nr_vcpus, DEFAULT_GUEST_PHY_PAGES,
-                                     extra_mem_pages, num_percpu_pages, guest_code, vcpuids, NULL);
-}
-
-struct kvm_vm *vm_create_default(uint32_t vcpuid, uint64_t extra_mem_pages,
-                                void *guest_code)
-{
-       return vm_create_default_with_vcpus(1, extra_mem_pages, 0, guest_code,
-                                           (uint32_t []){ vcpuid });
-}
-
 struct kvm_vm *__vm_create_with_one_vcpu(struct kvm_vcpu **vcpu,
                                         uint64_t extra_mem_pages,
                                         void *guest_code)
 {
-       struct kvm_vm *vm = vm_create_default(0, extra_mem_pages, guest_code);
+       struct kvm_vcpu *vcpus[1];
+       struct kvm_vm *vm;
+
+       vm = __vm_create_with_vcpus(VM_MODE_DEFAULT, 1, DEFAULT_GUEST_PHY_PAGES,
+                                   extra_mem_pages, 0, guest_code, NULL, vcpus);
 
-       *vcpu = vcpu_get(vm, 0);
+       *vcpu = vcpus[0];
        return vm;
 }