qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL for-2.0-rc0 19/58] target-i386: X86CPU model subc


From: Andreas Färber
Subject: Re: [Qemu-devel] [PULL for-2.0-rc0 19/58] target-i386: X86CPU model subclasses
Date: Thu, 13 Mar 2014 19:19:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Am 13.03.2014 15:54, schrieb Andreas Färber:
> From: Eduardo Habkost <address@hidden>
> 
> Register separate QOM types for each x86 CPU model.
> 
> This will allow management code to more easily probe what each CPU model
> provides, by simply creating objects using the appropriate class name,
> without having to restart QEMU.
> 
> This also allows us to eliminate the qdev_prop_set_globals_for_type()
> hack to set CPU-model-specific global properties.
> 
> Instead of creating separate class_init functions for each class, I just
> used class_data to store a pointer to the X86CPUDefinition struct for
> each CPU model. This should make the patch shorter and easier to review.
> Later we can gradually convert each X86CPUDefinition field to lists of
> per-class property defaults.
> 
> The "host" CPU model is special, as the feature flags depend on KVM
> being initialized. So it has its own class_init and instance_init
> function, and feature flags are set on instance_init instead of
> class_init.
> 
> Signed-off-by: Andreas Färber <address@hidden>
> Signed-off-by: Igor Mammedov <address@hidden>
> Signed-off-by: Eduardo Habkost <address@hidden>
> Reviewed-by: Eduardo Habkost <address@hidden>
> Tested-by: Eduardo Habkost <address@hidden>
> Signed-off-by: Andreas Färber <address@hidden>

Breaks mingw32 build with undefined kvm_arch_get_supported_cpuid()
references. Limiting the host CPU type to CONFIG_KVM, as inquired on my
v10, resolves this.

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 8070c97..0e69383 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1151,6 +1151,8 @@ void x86_cpu_compat_set_features(const char
*cpu_model, Fe
atureWord w,
     }
 }

+#ifdef CONFIG_KVM
+
 static int cpu_x86_fill_model_id(char *str)
 {
     uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
@@ -1226,6 +1228,8 @@ static const TypeInfo host_x86_cpu_type_info = {
     .class_init = host_x86_cpu_class_init,
 };

+#endif
+
 static int unavailable_host_feature(FeatureWordInfo *f, uint32_t mask)
 {
     int i;
@@ -2830,7 +2834,9 @@ static void x86_cpu_register_types(void)
     for (i = 0; i < ARRAY_SIZE(builtin_x86_defs); i++) {
         x86_register_cpudef_type(&builtin_x86_defs[i]);
     }
+#ifdef CONFIG_KVM
     type_register_static(&host_x86_cpu_type_info);
+#endif
 }

 type_init(x86_cpu_register_types)

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]