From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Zhao Liu <zhao1.liu@intel.com>,
qemu-devel@nongnu.org, Xiaoyao Li <xiaoyao.li@intel.com>,
Dongli Zhang <dongli.zhang@oracle.com>
Subject: [PATCH 1/2] i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check
Date: Tue, 4 Mar 2025 00:24:49 -0500 [thread overview]
Message-ID: <20250304052450.465445-2-xiaoyao.li@intel.com> (raw)
In-Reply-To: <20250304052450.465445-1-xiaoyao.li@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.li@intel.com>
---
target/i386/cpu.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 72ab147e851a..2bf6495140a0 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6693,9 +6693,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 */
@@ -7684,6 +7681,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.34.1
next prev parent reply other threads:[~2025-03-04 6:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 5:24 [PATCH 0/2] i386: Adjust CPUID_EXT_PDCM based on enable_pmu at realization Xiaoyao Li
2025-03-04 5:24 ` Xiaoyao Li [this message]
2025-03-06 15:52 ` [PATCH 1/2] i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check Zhao Liu
2025-03-04 5:24 ` [PATCH 2/2] i386/cpu: Warn about why CPUID_EXT_PDCM is not available Xiaoyao Li
2025-03-06 15:52 ` Zhao Liu
2025-03-06 16:22 ` [PATCH 0/2] i386: Adjust CPUID_EXT_PDCM based on enable_pmu at realization Zhao Liu
2025-03-06 16:51 ` Xiaoyao Li
2025-06-17 18:01 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250304052450.465445-2-xiaoyao.li@intel.com \
--to=xiaoyao.li@intel.com \
--cc=dongli.zhang@oracle.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).