On Fri, Nov 21, 2025 at 08:34:49AM +0000, Shivansh Dhiman wrote: > Date: Fri, 21 Nov 2025 08:34:49 +0000 > From: Shivansh Dhiman <[email protected]> > Subject: [PATCH 2/5] i386: Add CPU property x-force-cpuid-0x80000026 > X-Mailer: git-send-email 2.43.0 > > Introduce new CPU property x-force-cpuid-0x80000026 using which the CPUID > 0x80000026 is enabled. It defaults to false. > > If a vCPU's model is host, then CPUID is enabled based on CPU family/model. > Implement x86_is_amd_zen4_or_above() helper to detect Zen4+ CPUs using > family/model. > > Signed-off-by: Shivansh Dhiman <[email protected]> > --- > target/i386/cpu.c | 8 ++++++++ > target/i386/cpu.h | 18 ++++++++++++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/target/i386/cpu.c b/target/i386/cpu.c > index b7827e448aa5..01c4da7cf134 100644 > --- a/target/i386/cpu.c > +++ b/target/i386/cpu.c > @@ -9158,6 +9158,12 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp) > if (env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_SGX) { > x86_cpu_adjust_level(cpu, &env->cpuid_min_level, 0x12); > } > + > + /* Enable CPUID[0x80000026] for AMD Genoa models and above */ > + if (cpu->force_cpuid_0x80000026 || > + (!xcc->model && x86_is_amd_zen4_or_above(cpu))) {
I understand you want to address max/host CPU case here, but it's still may not guarentee the compatibility with old QEMU PC mahinces, e.g., boot a old PC machine on v11.0 QEMU, it can still have this leaf. So it would be better to add a compat option to disable 0x80000026 for old PC machines by default. If needed, to avoid unnecessarily enabling extended CPU topology, I think it's possible to implement a check similar to x86_has_cpuid_0x1f(). > + x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x80000026); > + } > } Thanks, Zhao
