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