aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/lib
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-04-18 12:58:44 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-11 11:46:30 -0400
commit0c276ff22c7eb1a6ebf889b25d631f4cd358a482 (patch)
tree60b06c954cabba3b06d4616e9820468f4856916c /tools/testing/selftests/kvm/lib
parentKVM: selftests: Add vm_create_*() variants to expose/return 'struct vcpu' (diff)
downloadlinux-dev-0c276ff22c7eb1a6ebf889b25d631f4cd358a482.tar.xz
linux-dev-0c276ff22c7eb1a6ebf889b25d631f4cd358a482.zip
KVM: selftests: Push vm_adjust_num_guest_pages() into "w/o vCPUs" helper
Move the call to vm_adjust_num_guest_pages() from vm_create_with_vcpus() down into vm_create_without_vcpus(). This will allow a future patch to make the "w/o vCPUs" variant the common inner helper, e.g. so that the "with_vcpus" helper calls the "without_vcpus" helper, instead of having them be separate paths. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib')
-rw-r--r--tools/testing/selftests/kvm/lib/kvm_util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 1c5caf2ddca4..8c0310094d73 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -282,6 +282,8 @@ struct kvm_vm *vm_create_without_vcpus(enum vm_guest_mode mode, uint64_t pages)
{
struct kvm_vm *vm;
+ pages = vm_adjust_num_guest_pages(mode, pages);
+
vm = __vm_create(mode, pages);
kvm_vm_elf_load(vm, program_invocation_name);
@@ -341,8 +343,6 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus,
"nr_vcpus = %d too large for host, max-vcpus = %d",
nr_vcpus, kvm_check_cap(KVM_CAP_MAX_VCPUS));
- pages = vm_adjust_num_guest_pages(mode, pages);
-
vm = vm_create_without_vcpus(mode, pages);
for (i = 0; i < nr_vcpus; ++i) {