From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
To: kvm@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Harsh Prateek Bora <harshpb@linux.ibm.com>,
Christophe Leroy <chleroy@kernel.org>,
Venkat Rao Bagalkote <venkat88@linux.ibm.com>,
Nicholas Piggin <npiggin@gmail.com>,
Misbah Anjum N <misanjum@linux.ibm.com>,
Anushree Mathur <anushree.mathur@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
linux-kernel@vger.kernel.org,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Subject: [RFC v2 4/5] KVM: PPC: selftests: powerpc enable kvm_create_max_vcpus test
Date: Sat, 23 May 2026 16:44:23 +0530 [thread overview]
Message-ID: <cb27fdc2348a933351619bbf1beff53a242b045e.1779524962.git.ritesh.list@gmail.com> (raw)
In-Reply-To: <cover.1779524962.git.ritesh.list@gmail.com>
From: Nicholas Piggin <npiggin@gmail.com>
powerpc's maximum permitted vCPU ID depends on the VM's SMT mode, and
the maximum reported by KVM_CAP_MAX_VCPU_ID exceeds a simple non-SMT
VM's limit.
The powerpc KVM selftest port uses non-SMT VMs, so add a workaround
to the kvm_create_max_vcpus test case to limit vCPU IDs to
KVM_CAP_MAX_VCPUS on powerpc.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[Rebased to latest mainline tree]
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
tools/testing/selftests/kvm/kvm_create_max_vcpus.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c
index c5310736ed06..a82c13d6cdf5 100644
--- a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c
+++ b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c
@@ -56,6 +56,15 @@ int main(int argc, char *argv[])
"KVM_MAX_VCPU_IDS (%d) must be at least as large as KVM_MAX_VCPUS (%d).",
kvm_max_vcpu_id, kvm_max_vcpus);
+#ifdef __powerpc64__
+ /*
+ * powerpc has a particular format for the vcpu ID that depends on
+ * the guest SMT mode, and the max ID cap is too large for non-SMT
+ * modes, where the maximum ID is the same as the maximum vCPUs.
+ */
+ kvm_max_vcpu_id = kvm_max_vcpus;
+#endif
+
test_vcpu_creation(0, kvm_max_vcpus);
if (kvm_max_vcpu_id > kvm_max_vcpus)
--
2.39.5
next prev parent reply other threads:[~2026-05-23 11:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 11:14 [RFC v2 0/5] KVM: selftests: add powerpc support Ritesh Harjani (IBM)
2026-05-23 11:14 ` [RFC v2 1/5] KVM: selftests: Move pgd_created check into virt_pgd_alloc Ritesh Harjani (IBM)
2026-05-23 11:14 ` [RFC v2 2/5] KVM: selftests: Add aligned guest physical page allocator Ritesh Harjani (IBM)
2026-05-23 11:14 ` [RFC v2 3/5] KVM: PPC: selftests: add support for powerpc Ritesh Harjani (IBM)
2026-05-23 11:14 ` Ritesh Harjani (IBM) [this message]
2026-05-23 11:14 ` [RFC v2 5/5] KVM: selftests: Print the vcpu_id when KVM_CREATE_VCPU ioctl fails Ritesh Harjani (IBM)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb27fdc2348a933351619bbf1beff53a242b045e.1779524962.git.ritesh.list@gmail.com \
--to=ritesh.list@gmail.com \
--cc=anushree.mathur@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=harshpb@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=misanjum@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=venkat88@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®