KVM: PPC: Handle CPU compatibility mode for nested guests
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest6 patches 12 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | KVM: PPC: Book3S HV: Validate arch_compat against host compatibility modearch/ | +6 | 2 replies | |
| 2/6 | KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and KVM_PPC_GET_COMPAT_CAPSarch/ include/ | +10 | 2 replies | |
| 3/6 | KVM: PPC: Wire up KVM_PPC_GET_COMPAT_CAPS ioctlarch/ arch/ | +20 | 2 replies | |
| 4/6 | KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVMarch/ | +17 | 2 replies | |
| 5/6 | KVM: PPC: Book3S HV: Add support for compat CPU capabilities for KVM on PowerNVarch/ | +36 | 2 replies | |
| 6/6 | KVM: PPC: Document KVM_PPC_GET_COMPAT_CAPS ioctlDocumentation/ | +35 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/6] KVM: PPC: Handle CPU compatibility mode for nested guests
On POWER systems, newer processor generations can operate in compatibility modes corresponding to earlier generations (e.g., a Power11 system running in Power10 compatibility mode). In such cases, the effective CPU level exposed to guests differs from the physical processor generation.
This creates a problem for nested virtualization. When booting a nested KVM guest (L2) inside a host KVM guest (L1) running in a compatibility mode, userspace (e.g., QEMU) may derive the CPU model from the raw hardware PVR and attempt to configure the nested guest accordingly. However, the L1 partition is constrained by the compatibility level negotiated with the hypervisor (L0), and requests exceeding that level are rejected, leading to guest boot failures such as:
KVM-NESTEDv2: couldn't set guest wide elements
This series addresses the issue in two steps:
1. Detect and reject invalid compatibility requests early in KVM to avoid late failures.
2. Provide a mechanism for userspace to query the effective CPU compatibility modes supported by the host, so it can select an appropriate CPU model for nested guests.
To achieve this, the series introduces a new KVM capability and ioctl (KVM_CAP_PPC_COMPAT_CAPS / KVM_PPC_GET_COMPAT_CAPS) that expose the compatibility modes supported by the host.
The implementation supports both:
- PowerVM (nested API v2), where compatibility information is obtained via the H_GUEST_GET_CAPABILITIES hypercall.
- PowerNV (nested API v1), where compatibility is derived from the device tree ("cpu-version") representing the effective processor compatibility level.
This allows userspace (e.g., QEMU) to select a CPU model consistent with the host compatibility mode, avoiding mismatches and enabling successful nested guest boot.
Patch summary:
[1/6] Validate arch_compat against host compatibility mode [2/6] Introduce KVM_CAP_PPC_COMPAT_CAPS and ioctl [3/6] Wire up ioctl handling
[4/6] Implement capability retrieval for PowerVM (API v2) [5/6] Add PowerNV support (API v1)
[6/6] Document the new ioctl
Tested on:
- Power11 pSeries LPAR in Power10 compatibility mode (nested API v2)
- Power10 PowerNV system (and QEMU TCG PowerNV 11) with nested virtualization (API v1) with various combinations of KVM L1/L2 guests in various supported compatibility modes.
With this series, nested guests boot successfully in configurations where they previously failed due to compatibility mismatches.
Amit Machhiwal (6):
KVM: PPC: Book3S HV: Validate arch_compat against host compatibility
mode
KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and
KVM_PPC_GET_COMPAT_CAPS
KVM: PPC: Wire up KVM_PPC_GET_COMPAT_CAPS ioctl
KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM
on PowerVM
KVM: PPC: Book3S HV: Add support for compat CPU capabilities for KVM
on PowerNV
KVM: PPC: Document KVM_PPC_GET_COMPAT_CAPS ioctl
Documentation/virt/kvm/api.rst | 35 +++++++++++++++++ arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/include/uapi/asm/kvm.h | 6 +++ arch/powerpc/kvm/book3s_hv.c | 58 +++++++++++++++++++++++++++++ arch/powerpc/kvm/powerpc.c | 19 ++++++++++ include/uapi/linux/kvm.h | 4 ++ 6 files changed, 123 insertions(+)
base-commit: dca922e019dd758b4c1b4bec8f1d509efddeaab4 --
2.50.1