KVM: selftests: Skip kvm_create_max_vcpus on powerpc pseries LPAR

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@gmail.com>
Reviewed-by: Gautam Menghani <gautam@linux.ibm.com>
Tested-by: Gautam Menghani <gautam@linux.ibm.com>
Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/c8856b73b06bd4b44ff31e7454c8fc56dd402428.1791280439.git.ritesh.list@gmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
Ritesh Harjani (IBM) 2026-10-06 15:58:40 +05:30 committed by Sean Christopherson
parent 5527310b4d
commit 9de211597e

View File

@ -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);