The kvm_vm struct has been changed to maintain vcpus via an array of
vcpu pointers, there is no need to require users to allocate and pass
in another vcpu array when create the vm.
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
tools/testing/selftests/kvm/lib/kvm_util.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
@@ -371,12 +371,10 @@ struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus
struct kvm_vm *vm;
int i;
- TEST_ASSERT(!nr_vcpus || vcpus, "Must provide vCPU array");
-
vm = __vm_create(mode, nr_vcpus, extra_mem_pages);
for (i = 0; i < nr_vcpus; ++i)
- vcpus[i] = vm_vcpu_add(vm, i, guest_code);
+ vm->vcpus[i] = vm_vcpu_add(vm, i, guest_code);
return vm;
}
@@ -385,13 +383,12 @@ struct kvm_vm *__vm_create_with_one_vcpu(struct kvm_vcpu **vcpu,
uint64_t extra_mem_pages,
void *guest_code)
{
- struct kvm_vcpu *vcpus[1];
struct kvm_vm *vm;
vm = __vm_create_with_vcpus(VM_MODE_DEFAULT, 1, extra_mem_pages,
- guest_code, vcpus);
+ guest_code, NULL);
- *vcpu = vcpus[0];
+ *vcpu = vm->vcpus[0];
return vm;
}