diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-15 12:50:46 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-15 13:28:58 +0200 |
commit | fd4198bf17ca9321fb8043e846b780cfd2889dac (patch) | |
tree | 5be0be73151cd815d7dde9c82c4705d10cd1849a /tools/testing/selftests/kvm/x86_64 | |
parent | a6a6d3b1f867d34ba5bd61aa7bb056b48ca67cff (diff) | |
parent | 8343ba2d4820b1738bbb7cb40ec18ea0a3b0b331 (diff) |
Merge tag 'kvm-s390-next-5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD
KVM: s390: add kselftests
This is the initial implementation for KVM selftests on s390.
Diffstat (limited to 'tools/testing/selftests/kvm/x86_64')
-rw-r--r-- | tools/testing/selftests/kvm/x86_64/kvm_create_max_vcpus.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/kvm_create_max_vcpus.c b/tools/testing/selftests/kvm/x86_64/kvm_create_max_vcpus.c deleted file mode 100644 index 429226bc6a92..000000000000 --- a/tools/testing/selftests/kvm/x86_64/kvm_create_max_vcpus.c +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * kvm_create_max_vcpus - * - * Copyright (C) 2019, Google LLC. - * - * Test for KVM_CAP_MAX_VCPUS and KVM_CAP_MAX_VCPU_ID. - */ - -#define _GNU_SOURCE /* for program_invocation_short_name */ -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "test_util.h" - -#include "kvm_util.h" -#include "asm/kvm.h" -#include "linux/kvm.h" - -void test_vcpu_creation(int first_vcpu_id, int num_vcpus) -{ - struct kvm_vm *vm; - int i; - - printf("Testing creating %d vCPUs, with IDs %d...%d.\n", - num_vcpus, first_vcpu_id, first_vcpu_id + num_vcpus - 1); - - vm = vm_create(VM_MODE_P52V48_4K, DEFAULT_GUEST_PHY_PAGES, O_RDWR); - - for (i = 0; i < num_vcpus; i++) { - int vcpu_id = first_vcpu_id + i; - - /* This asserts that the vCPU was created. */ - vm_vcpu_add(vm, vcpu_id); - } - - kvm_vm_free(vm); -} - -int main(int argc, char *argv[]) -{ - int kvm_max_vcpu_id = kvm_check_cap(KVM_CAP_MAX_VCPU_ID); - int kvm_max_vcpus = kvm_check_cap(KVM_CAP_MAX_VCPUS); - - printf("KVM_CAP_MAX_VCPU_ID: %d\n", kvm_max_vcpu_id); - printf("KVM_CAP_MAX_VCPUS: %d\n", kvm_max_vcpus); - - /* - * Upstream KVM prior to 4.8 does not support KVM_CAP_MAX_VCPU_ID. - * Userspace is supposed to use KVM_CAP_MAX_VCPUS as the maximum ID - * in this case. - */ - if (!kvm_max_vcpu_id) - kvm_max_vcpu_id = kvm_max_vcpus; - - TEST_ASSERT(kvm_max_vcpu_id >= kvm_max_vcpus, - "KVM_MAX_VCPU_ID (%d) must be at least as large as KVM_MAX_VCPUS (%d).", - kvm_max_vcpu_id, kvm_max_vcpus); - - test_vcpu_creation(0, kvm_max_vcpus); - - if (kvm_max_vcpu_id > kvm_max_vcpus) - test_vcpu_creation( - kvm_max_vcpu_id - kvm_max_vcpus, kvm_max_vcpus); - - return 0; -} |