From: Xiaoyao Li <xiaoyao...@intel.com> There is one entry relates to CPUID_EXT_PDCM in feature_dependencies[]. So it needs to get correct value of CPUID_EXT_PDCM before using feature_dependencies[] to apply dependencies.
Besides, it also ensures CPUID_EXT_PDCM value is tracked in env->features[FEAT_1_ECX]. Signed-off-by: Xiaoyao Li <xiaoyao...@intel.com> Reviewed-by: Zhao Liu <zhao1....@intel.com> Link: https://lore.kernel.org/r/20250304052450.465445-2-xiaoyao...@intel.com Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> (cherry picked from commit e68ec2980901c8e7f948f3305770962806c53f0b) (Mjt: this simple cleanup is not strictly necessary for 10.0, but pick it up so subsequent changes in this area applies cleanly) Signed-off-by: Michael Tokarev <m...@tls.msk.ru> diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 46619288ed..d3e3ca13ca 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6837,9 +6837,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, if (threads_per_pkg > 1) { *ebx |= threads_per_pkg << 16; } - if (!cpu->enable_pmu) { - *ecx &= ~CPUID_EXT_PDCM; - } break; case 2: /* cache info: needed for Pentium Pro compatibility */ @@ -7829,6 +7826,10 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp) } } + if (!cpu->enable_pmu) { + env->features[FEAT_1_ECX] &= ~CPUID_EXT_PDCM; + } + for (i = 0; i < ARRAY_SIZE(feature_dependencies); i++) { FeatureDep *d = &feature_dependencies[i]; if (!(env->features[d->from.index] & d->from.mask)) { -- 2.47.2