Re: [PATCH v2] KVM: PPC: Book3S HV: Validate arch_compat against host compatibility mode
From: Vaibhav Jain
Date: Mon Jun 08 2026 - 23:50:26 EST
Amit Machhiwal <amachhiw@xxxxxxxxxxxxx> 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 <vaibhav@xxxxxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx # v6.13+
> Signed-off-by: Amit Machhiwal <amachhiw@xxxxxxxxxxxxx>
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 <vaibhav@xxxxxxxxxxxxx>
--
Cheers
~ Vaibhav