[PATCH v7 6/8] KVM: selftests: Skip kvm_create_max_vcpus on powerpc pseries LPAR

From: Ritesh Harjani (IBM)

Date: Tue Oct 06 2026 - 06:32:22 EST


On a PAPR LPAR, KVM_CREATE_VCPU is H_GUEST_CREATE_VCPU and
KVM_CAP_MAX_VCPUS is only the vcpuId range but is not a guarantee from
L0 i.e. because L0 Guest Management Space can be exhausted before that
many vCPUs exist, so creating MAX_VCPUS is not a valid assert.

So, skip the test when powerpc is pseries LPAR (running nested i.e.
ibm,hypertas-functions is present).

Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx>
---
tools/testing/selftests/kvm/kvm_create_max_vcpus.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c
index 1b95027d41ba..22279c638d06 100644
--- a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c
+++ b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c
@@ -39,6 +39,12 @@ 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);

+ /*
+ * PowerPC's PAPR L0 does not guarantee KVM_CAP_MAX_VCPUS when running
+ * on pseries LPAR (nested kvm-on-powervm).
+ */
+ TEST_REQUIRE(!kvm_is_ppc_pseries_lpar());
+
pr_info("KVM_CAP_MAX_VCPU_ID: %d\n", kvm_max_vcpu_id);
pr_info("KVM_CAP_MAX_VCPUS: %d\n", kvm_max_vcpus);

--
2.39.5