From: Zhao Liu <zhao1.liu@intel.com>
To: Ewan Hai <ewanhai-oc@zhaoxin.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: [PATCH] i386/cpu: Add an option in X86CPUDefinition to control CPUID 0x1f
Date: Fri, 24 Oct 2025 15:18:07 +0800 [thread overview]
Message-ID: <aPsoLx2+2bpW6mWf@intel.com> (raw)
In-Reply-To: <20250923021133.190725-4-ewanhai-oc@zhaoxin.com>
Many Intel and Zhaoxin CPUs enable CPUID 0x1f by default to encode CPU
topology information.
Add the "cpuid_0x1f" option to X86CPUDefinition to allow named CPU
models to configure CPUID 0x1f from the start, thereby forcing 0x1f
to be present for guest.
With this option, there's no need to explicitly add v1 model to an
unversioned CPU model for explicitly enabling the x-force-cpuid-0x1f
property.
Tested-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
target/i386/cpu.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 175054fdb322..56c1030a8627 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2307,6 +2307,12 @@ typedef struct X86CPUDefinition {
int model;
int stepping;
uint8_t avx10_version;
+ /*
+ * Whether to present CPUID 0x1f by default.
+ * If true, encode CPU topology in 0x1f leaf even if there's no
+ * extended topology levels.
+ */
+ bool cpuid_0x1f;
FeatureWordArray features;
const char *model_id;
const CPUCaches *const cache_info;
@@ -8092,6 +8098,10 @@ static void x86_cpu_load_model(X86CPU *cpu, const X86CPUModel *model)
&error_abort);
}
+ if (def->cpuid_0x1f) {
+ object_property_set_bool(OBJECT(cpu), "x-force-cpuid-0x1f", def->cpuid_0x1f,
+ &error_abort);
+ }
x86_cpu_apply_version_props(cpu, model);
/*
--
2.34.1
prev parent reply other threads:[~2025-10-24 6:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-23 2:11 [PATCH 0/3] target/i386: Add support for Zhaoxin Shijidadao vCPU models Ewan Hai
2025-09-23 2:11 ` [PATCH 1/3] target/i386: Add cache model for Zhaoxin Shijidadao vCPUs Ewan Hai
2025-09-23 2:11 ` [PATCH 2/3] target/i386: Introduce Zhaoxin Shijidadao-Client CPU model Ewan Hai
2025-09-23 2:11 ` [PATCH 3/3] target/i386: Introduce Zhaoxin Shijidadao-Server " Ewan Hai
2025-10-24 7:15 ` Zhao Liu
2025-10-27 3:42 ` Ewan Hai
2025-10-27 6:14 ` Zhao Liu
2025-10-24 7:18 ` Zhao Liu [this message]
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=aPsoLx2+2bpW6mWf@intel.com \
--to=zhao1.liu@intel.com \
--cc=ewanhai-oc@zhaoxin.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.