Re: [PATCH v2] KVM: PPC: Book3S HV: Validate arch_compat against host compatibility mode
From: Vaibhav Jain <hidden>
Date: 2026-06-09 03:50:07
Also in:
kvm, lkml, stable
From: Vaibhav Jain <hidden>
Date: 2026-06-09 03:50:07
Also in:
kvm, lkml, stable
Amit Machhiwal [off-list ref] writes: <snip>
Introduce a validation mechanism that detects unsupported arch_compat values early in the guest initialization path. When an unsupported arch_compat is requested (e.g., Power11 on a Power10 compatibility mode host), kvmppc_set_arch_compat() uses cpu_has_feature(CPU_FTR_P11_PVR) to detect the mismatch and sets arch_compat to PVR_ARCH_INVALID. This triggers kvmppc_sanity_check() to mark the vCPU as invalid by setting vcpu->arch.sane to false. On the next vCPU run, kvmppc_vcpu_run_hv() checks this flag and returns -EINVAL, preventing the guest from running with an invalid processor compatibility configuration. With this, when a Power11 arch_compat is requested on a Power10 compatibility mode host, the guest fails early during boot with: error: kvm run failed Invalid argument
<snip>
Suggested-by: Vaibhav Jain <redacted> Cc: stable@vger.kernel.org # v6.13+ Signed-off-by: Amit Machhiwal <redacted>
Thanks Amit for addressing the issue reported on v1. The v2 patch changes look aligned to what we discussed offline. Hence, Reviewed-by: Vaibhav Jain <redacted> -- Cheers ~ Vaibhav