summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/aarch64
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-05-03 09:52:48 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-11 11:47:26 -0400
commit6e1d13bf3815d6058620dd72135be292d9f44bc9 (patch)
treeaaf37b045a398cb40af79098d94862a983516d36 /tools/testing/selftests/kvm/aarch64
parentacaf50ad6dcb69a9857ef6c9a42100f6270f5f03 (diff)
downloadlinux-6e1d13bf3815d6058620dd72135be292d9f44bc9.tar.bz2
KVM: selftests: Move per-VM/per-vCPU nr pages calculation to __vm_create()
Handle all memslot0 size adjustments in __vm_create(). Currently, the adjustments reside in __vm_create_with_vcpus(), which means tests that call vm_create() or __vm_create() directly are left to their own devices. Some tests just pass DEFAULT_GUEST_PHY_PAGES and don't bother with any adjustments, while others mimic the per-vCPU calculations. For vm_create(), and thus __vm_create(), take the number of vCPUs that will be runnable to calculate that number of per-vCPU pages needed for memslot0. To give readers a hint that neither vm_create() nor __vm_create() create vCPUs, name the parameter @nr_runnable_vcpus instead of @nr_vcpus. That also gives readers a hint as to why tests that create larger numbers of vCPUs but never actually run those vCPUs can skip straight to the vm_create_barebones() variant. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/aarch64')
-rw-r--r--tools/testing/selftests/kvm/aarch64/psci_test.c2
-rw-r--r--tools/testing/selftests/kvm/aarch64/vgic_init.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/testing/selftests/kvm/aarch64/psci_test.c b/tools/testing/selftests/kvm/aarch64/psci_test.c
index 3e1bebe63adf..7928c62635fd 100644
--- a/tools/testing/selftests/kvm/aarch64/psci_test.c
+++ b/tools/testing/selftests/kvm/aarch64/psci_test.c
@@ -76,7 +76,7 @@ static struct kvm_vm *setup_vm(void *guest_code, struct kvm_vcpu **source,
struct kvm_vcpu_init init;
struct kvm_vm *vm;
- vm = vm_create(DEFAULT_GUEST_PHY_PAGES);
+ vm = vm_create(2);
ucall_init(vm, NULL);
vm_ioctl(vm, KVM_ARM_PREFERRED_TARGET, &init);
diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testing/selftests/kvm/aarch64/vgic_init.c
index 6b9c9a391a01..02402802b163 100644
--- a/tools/testing/selftests/kvm/aarch64/vgic_init.c
+++ b/tools/testing/selftests/kvm/aarch64/vgic_init.c
@@ -419,7 +419,7 @@ static void test_v3_typer_accesses(void)
uint64_t addr;
int ret, i;
- v.vm = vm_create(DEFAULT_GUEST_PHY_PAGES);
+ v.vm = vm_create(NR_VCPUS);
(void)vm_vcpu_add(v.vm, 0, guest_code);
v.gic_fd = kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3);
@@ -479,7 +479,7 @@ static struct vm_gic vm_gic_v3_create_with_vcpuids(int nr_vcpus,
struct vm_gic v;
int i;
- v.vm = vm_create(DEFAULT_GUEST_PHY_PAGES);
+ v.vm = vm_create(nr_vcpus);
for (i = 0; i < nr_vcpus; i++)
vm_vcpu_add(v.vm, vcpuids[i], guest_code);