diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-07-10 18:49:17 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-07-12 15:28:20 +0200 |
| commit | 810fcc41fc572d90b3c05af3f06f451626ee6b10 (patch) | |
| tree | 5894e48774de2d5aeb6c696320e4d95bd78a7260 /target/i386/cpu.c | |
| parent | d93972d88b0984ed0a2090493f8d62cc188976d2 (diff) | |
| download | focaccia-qemu-810fcc41fc572d90b3c05af3f06f451626ee6b10.tar.gz focaccia-qemu-810fcc41fc572d90b3c05af3f06f451626ee6b10.zip | |
target/i386: allow reordering max_x86_cpu_initfn vs accel CPU init
The PMU feature is only supported by KVM, so move it there. And since all accelerators other than TCG overwrite the vendor, set it in max_x86_cpu_initfn only if it has not been initialized by the superclass. This makes it possible to run max_x86_cpu_initfn after accelerator init. Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/cpu.c')
| -rw-r--r-- | target/i386/cpu.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 8fb74b56dd..9c5cef2c7c 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6199,21 +6199,21 @@ static void max_x86_cpu_class_init(ObjectClass *oc, const void *data) static void max_x86_cpu_initfn(Object *obj) { X86CPU *cpu = X86_CPU(obj); - - /* We can't fill the features array here because we don't know yet if - * "migratable" is true or false. - */ - object_property_set_bool(OBJECT(cpu), "pmu", true, &error_abort); + CPUX86State *env = &cpu->env; /* - * these defaults are used for TCG and all other accelerators - * besides KVM and HVF, which overwrite these values + * these defaults are used for TCG, other accelerators overwrite these + * values */ - object_property_set_str(OBJECT(cpu), "vendor", CPUID_VENDOR_AMD, - &error_abort); - object_property_set_str(OBJECT(cpu), "model-id", - "QEMU TCG CPU version " QEMU_HW_VERSION, - &error_abort); + if (!env->cpuid_vendor1) { + object_property_set_str(OBJECT(cpu), "vendor", CPUID_VENDOR_AMD, + &error_abort); + } + if (!env->cpuid_model[0]) { + object_property_set_str(OBJECT(cpu), "model-id", + "QEMU TCG CPU version " QEMU_HW_VERSION, + &error_abort); + } } static const TypeInfo max_x86_cpu_type_info = { |