I've been experimenting with the kvm selftests to see if I can enable them for powerpc and get some useful coverage going. This series is just the initial boilerplate to get the simplest of the tests to run. The test is arch agnostic and is already in the tree. It just tries to start a vm with the maximum number of vcpus. It fails on a P9: $ cd tools/selftests/kvm $ make ARCH=powerpc $ ulimit -n 4096 $ ./kvm_create_max_vcpus KVM_CAP_MAX_VCPU_ID: 16384 KVM_CAP_MAX_VCPUS: 2048 Testing creating 2048 vCPUs, with IDs 0...2047. Testing creating 2048 vCPUs, with IDs 14336...16383. ==== Test Assertion Failure ==== lib/kvm_util.c:983: vcpu->fd >= 0 pid=74066 tid=74066 - Invalid argument 1 0x0000000010002813: vm_vcpu_add at kvm_util.c:982 2 0x000000001000176f: test_vcpu_creation at kvm_create_max_vcpus.c:34 (discriminator 3) 3 0x00000000100014e7: main at kvm_create_max_vcpus.c:62 4 0x00007fff89454077: ?? ??:0 5 0x00007fff89454263: ?? ??:0 KVM_CREATE_VCPU failed, rc: -1 errno: 22 The second patch is my attempt at improving the situation which, admittedly, is mostly harmless, caused by the fact that KVM_MAX_VCPU_IDS is set to a large value that is not always supported by P9 so KVM HV aborts with -EINVAL. I intended to get this first patch/test to work before implementing the rest of the selftest infrastructure and adding more tests so I thought it would be best to get some feedback before I delve in too deep. Fabiano Rosas (2): KVM: selftests: Add max vcpus test for ppc64le KVM: PPC: Book3S HV: Provide a more accurate MAX_VCPU_ID in P9 arch/powerpc/kvm/powerpc.c | 5 ++- tools/testing/selftests/kvm/Makefile | 7 +++ .../testing/selftests/kvm/include/kvm_util.h | 7 +++ .../selftests/kvm/include/powerpc/processor.h | 7 +++ tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++ .../selftests/kvm/lib/powerpc/processor.c | 44 +++++++++++++++++++ 6 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/kvm/include/powerpc/processor.h create mode 100644 tools/testing/selftests/kvm/lib/powerpc/processor.c -- 2.29.2