Hi Amit, Thanks for the patch. My review comments inline below:
Amit Machhiwal <[email protected]> writes: > On POWER systems, the host CPU may run in a compatibility mode (e.g., > a Power11 processor operating in Power10 compatibility mode). When > running nested KVM guests, QEMU currently derives the host CPU type > using mfpvr(), which reflects the physical processor version. This can > result in a mismatch between the CPU model used by QEMU and the > compatibility mode enforced by the host, leading to guest boot failures > such as "KVM-NESTEDv2: couldn't set guest wide elements". > > Update kvm_ppc_get_host_cpu_class() to check if the host is running in > a compatibility mode using kvm_ppc_host_compat_pvr(). When available, > use the compatibility PVR instead of the raw hardware PVR when selecting > the CPU model. This ensures that QEMU selects a CPU model consistent > with the host compatibility mode, allowing nested guests to boot > correctly. > > Signed-off-by: Amit Machhiwal <[email protected]> > --- > target/ppc/kvm.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c > index 9e5006e0c2cd..a72f237f0c8a 100644 > --- a/target/ppc/kvm.c > +++ b/target/ppc/kvm.c > @@ -2672,6 +2672,15 @@ PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) > uint32_t host_pvr = mfpvr(); > PowerPCCPUClass *pvr_pcc; > > +#if defined(TARGET_PPC64) Use CONFIG_KVM > + uint32_t compat_host_pvr; > + > + compat_host_pvr = kvm_ppc_host_compat_pvr(); > + if (compat_host_pvr) { > + host_pvr = compat_host_pvr; > + } > +#endif /* TARGET_PPC64 */ > + > pvr_pcc = ppc_cpu_class_by_pvr(host_pvr); > if (pvr_pcc == NULL) { > pvr_pcc = ppc_cpu_class_by_pvr_mask(host_pvr); > -- > 2.50.1 (Apple Git-155) > > -- Cheers ~ Vaibhav
