[PATCHv3 0/7] KVM: PPC: Misc fixes and nestedv2 vCPU limit fixes

From: Ritesh Harjani (IBM)

Date: Sun Nov 01 2026 - 10:28:36 EST


v2 -> v3:
=========
- Fixed logic bug in patch-2 & patch-6.
(realized after sending + sashiko caught this as well).

RFC -> v2:
=========
- Addressed sashiko review comments
- added patch-3 to address similar __ffs(0) problem on booke
- fixed build issues in patch-4
- added patch-5 to reject vcpu ids beyond the PAPR limit
- Few more patches were added. Few of them were reported by Sashiko and few
others were caught while doing vcpu create path code walkthrough

Most of these issues were identified while adding kvm powerpc selftests
infrastructure support [1] (which is now merged upstream). Patch-1 and Patch-2
were identified while running the selftests on Qemu+TCG+powernv+BE, while
Patch-4 can also be reproduced on a real pseries LPAR with nestedv2
capabilities.

[1]: https://lore.kernel.org/linuxppc-dev/179211526968.809012.4905747914183363587.b4-ty@b4/
[RFC]: https://lore.kernel.org/linuxppc-dev/cover.1789099725.git.ritesh.list@xxxxxxxxx/


Ritesh Harjani (IBM) (7):
KVM: PPC: Book3S HV: Read EX_DSISR as a 32-bit field on guest exit
KVM: PPC: Book3S: Don't call __ffs() on an empty pending_exceptions bitmap
KVM: PPC: BookE: Don't call __ffs() on an empty pending_exceptions bitmap
KVM: PPC: Book3S HV nestedv2: cap max vcpus to PAPR limit
KVM: PPC: Book3S HV nestedv2: reject vCPU ids beyond the PAPR limit
KVM: PPC: Book3S HV: Fix error handling during vcore create
KVM: PPC: Book3s: nestedv2: Free the guest state buffers if vcpu create fails

arch/powerpc/include/asm/kvm_host.h | 1 +
arch/powerpc/kvm/book3s.c | 2 +-
arch/powerpc/kvm/book3s_hv.c | 15 ++++++++++-----
arch/powerpc/kvm/book3s_hv_p9_entry.c | 13 +++++++++++--
arch/powerpc/kvm/booke.c | 2 +-
arch/powerpc/kvm/powerpc.c | 9 +++++++++
6 files changed, 33 insertions(+), 9 deletions(-)

--
2.39.5