Am 13.03.2014 15:54, schrieb Andreas Färber: > From: Eduardo Habkost <ehabk...@redhat.com> > > 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 <afaer...@suse.de> > Signed-off-by: Igor Mammedov <imamm...@redhat.com> > Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> > Reviewed-by: Eduardo Habkost <ehabk...@redhat.com> > Tested-by: Eduardo Habkost <ehabk...@redhat.com> > Signed-off-by: Andreas Färber <afaer...@suse.de>
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