QOM CPUState patch queue 2013-05-06
Hello,
This is my current QOM CPU patch queue. Please pull.
It includes:
* x86 CPU feature-words and filtered-features properties for libvirt,
* x86 CPU fixes and backwards compatibility support.
Regards,
Andreas
The following changes since commit 8e515b125d5f7849167dbee6cbe6ef61636607d4:
configure: Check that "libtool" is not the MacOSX one (2013-05-06 06:52:03 -0500)
are available in the git repository at:
git://github.com/afaerber/qemu-cpu.git qom-cpu
for you to fetch changes up to 4458c23672904fa131e69897007eeb7c953be7e5:
target-i386: n270 can MOVBE (2013-05-06 22:27:49 +0200)
----------------------------------------------------------------
Andreas Färber (4):
qdev: Let qdev_prop_parse() pass through Error
qdev: Introduce qdev_prop_set_globals_for_type()
target-i386: Emulate X86CPU subclasses for global properties
target-i386: Change CPUID model of 486 to 8
Borislav Petkov (1):
target-i386: n270 can MOVBE
Eduardo Habkost (6):
target-i386: Add ECX information to FeatureWordInfo
target-i386: Use FeatureWord loop on filter_features_for_kvm()
target-i386: Add "feature-words" property to X86CPU
target-i386: Introduce X86CPU::filtered_features field
target-i386: Add "filtered-features" property to X86CPU
target-i386: Introduce generic CPUID feature compat function
Makefile.objs | 7 +- hw/core/qdev-properties.c | 51 +++++++++------ hw/core/qdev.c | 7 +- hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + include/hw/i386/pc.h | 4 ++ include/hw/qdev-properties.h | 7 +- qapi-schema.json | 32 +++++++++ qdev-monitor.c | 6 +- target-i386/cpu-qom.h | 3 + target-i386/cpu.c | 150 +++++++++++++++++++++++++++++++++---------- target-i386/cpu.h | 4 ++ 12 files changed, 214 insertions(+), 59 deletions(-)
[Qemu-devel] [PULL 01/11] target-i386: Add ECX information to FeatureWordInfo
From: Eduardo Habkost <[email protected]>
FEAT_7_0_EBX uses ECX as input, so we have to take that into account when reporting feature word values.
--- target-i386/cpu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
target-i386/cpu.c +7 -3
@@ -152,8 +152,10 @@ static const char *cpuid_7_0_ebx_feature_name[] = {typedef struct FeatureWordInfo {const char **feat_names; -uint32_t cpuid_eax;/* Input EAX for CPUID */ -int cpuid_reg;/* R_* register constant */ +uint32_t cpuid_eax;/* Input EAX for CPUID */ +bool cpuid_needs_ecx;/* CPUID instruction uses ECX as input */ +uint32_t cpuid_ecx;/* Input ECX value for CPUID */ +int cpuid_reg;/* output register (R_* constant) */ }FeatureWordInfo ;static FeatureWordInfo feature_word_info[FEATURE_WORDS ] = {
@@ -187,7 +189,9 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, [FEAT_7_0_EBX ] = { .feat_names = cpuid_7_0_ebx_feature_name, - .cpuid_eax =7 , .cpuid_reg =R_EBX , + .cpuid_eax =7 , + .cpuid_needs_ecx = true, .cpuid_ecx =0 , + .cpuid_reg =R_EBX , }, };
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 02/11] target-i386: Use FeatureWord loop on filter_features_for_kvm()
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Instead of open-coding the filtering code for each feature word, change the existing code to use the feature_word_info array, that has exactly the same CPUID eax/ecx/register values for each feature word.
--- target-i386/cpu.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-)
target-i386/cpu.c +7 -17
@@ -1651,24 +1651,14 @@ static void filter_features_for_kvm(X86CPU *cpu) {CPUX86State *env = &cpu->env;KVMState *s = kvm_state; +FeatureWord w; - env->features[FEAT_1_EDX ] &= -kvm_arch_get_supported_cpuid (s,1 ,0 ,R_EDX ); - env->features[FEAT_1_ECX ] &= -kvm_arch_get_supported_cpuid (s,1 ,0 ,R_ECX ); - env->features[FEAT_8000_0001_EDX ] &= -kvm_arch_get_supported_cpuid (s,0x80000001 ,0 ,R_EDX ); - env->features[FEAT_8000_0001_ECX ] &= -kvm_arch_get_supported_cpuid (s,0x80000001 ,0 ,R_ECX ); - env->features[FEAT_SVM ] &= -kvm_arch_get_supported_cpuid (s,0x8000000A ,0 ,R_EDX ); - env->features[FEAT_7_0_EBX ] &= -kvm_arch_get_supported_cpuid (s,7 ,0 ,R_EBX ); - env->features[FEAT_KVM ] &= -kvm_arch_get_supported_cpuid (s,KVM_CPUID_FEATURES ,0 ,R_EAX ); - env->features[FEAT_C000_0001_EDX ] &= -kvm_arch_get_supported_cpuid (s,0xC0000001 ,0 ,R_EDX ); - +for (w =0 ; w <FEATURE_WORDS ; w++) { +FeatureWordInfo *wi = &feature_word_info[w]; + env->features[w] &=kvm_arch_get_supported_cpuid (s, wi->cpuid_eax, + wi->cpuid_ecx, + wi->cpuid_reg); + } }#endif
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 04/11] target-i386: Introduce X86CPU::filtered_features field
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
This field will contain the feature bits that were filtered out because of missing host support.
--- target-i386/cpu-qom.h | 3 +++ target-i386/cpu.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-)
target-i386/cpu-qom.h +3 -0
@@ -65,6 +65,9 @@ typedef struct X86CPU {/*< public >*/ CPUX86State env; + +/* Features that were filtered out because of missing host capabilities */ +uint32_t filtered_features[FEATURE_WORDS ]; }X86CPU ;static inline X86CPU *x86_env_get_cpu (CPUX86State *env)
target-i386/cpu.c +6 -3
@@ -1698,9 +1698,12 @@ static void filter_features_for_kvm(X86CPU *cpu)for (w =0 ; w <FEATURE_WORDS ; w++) {FeatureWordInfo *wi = &feature_word_info[w]; - env->features[w] &=kvm_arch_get_supported_cpuid (s, wi->cpuid_eax, - wi->cpuid_ecx, - wi->cpuid_reg); +uint32_t host_feat =kvm_arch_get_supported_cpuid (s, wi->cpuid_eax, + wi->cpuid_ecx, + wi->cpuid_reg); +uint32_t requested_features = env->features[w]; + env->features[w] &= host_feat; + cpu->filtered_features[w] = requested_features & ~env->features[w]; } }#endif
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 03/11] target-i386: Add "feature-words" property to X86CPU
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
This property will be useful for libvirt, as libvirt already has logic based on low-level feature bits (not feature names), so it will be really easy to convert the current libvirt logic to something using the "feature-words" property.
The property will have two main use cases:
- Checking host capabilities, by checking the features of the "host" CPU model
- Checking which features are enabled on each CPU model
Example output:
$ ./QMP/qmp --path=/tmp/m \
qom-get --path=/machine/icc-bridge/icc/child[0] \
--property=feature-words
item[0].cpuid-register: EDX
item[0].cpuid-input-eax: 2147483658
item[0].features: 0
item[1].cpuid-register: EAX
item[1].cpuid-input-eax: 1073741825
item[1].features: 0
item[2].cpuid-register: EDX
item[2].cpuid-input-eax: 3221225473
item[2].features: 0
item[3].cpuid-register: ECX
item[3].cpuid-input-eax: 2147483649
item[3].features: 101
item[4].cpuid-register: EDX
item[4].cpuid-input-eax: 2147483649
item[4].features: 563346425
item[5].cpuid-register: EBX
item[5].cpuid-input-eax: 7
item[5].features: 0
item[5].cpuid-input-ecx: 0
item[6].cpuid-register: ECX
item[6].cpuid-input-eax: 1
item[6].features: 2155880449
item[7].cpuid-register: EDX
item[7].cpuid-input-eax: 1
item[7].features: 126614521--- Makefile.objs | 7 +++++- qapi-schema.json | 32 +++++++++++++++++++++++++ target-i386/cpu.c | 70 +++++++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 96 insertions(+), 13 deletions(-)
Makefile.objs +6 -1
@@ -79,10 +79,15 @@ common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y) ###################################################################### # qapi -common-obj-y += qmp-marshal.o qapi-visit.o qapi-types.o +common-obj-y += qmp-marshal.o common-obj-y += qmp.o hmp.o endif +###################################################################### +# some qapi visitors are used by both system and user emulation: + +common-obj-y += qapi-visit.o qapi-types.o + ####################################################################### # Target-independent parts used in system and user emulation common-obj-y += qemu-log.o
qapi-schema.json +32 -0
@@ -3587,3 +3587,35 @@ ## {'command': 'query-command-line-options', 'data': { '*option': 'str' }, 'returns': ['CommandLineOptionInfo'] } + +## +# @X86CPURegister32 +# +# A X86 32-bit register +# +# Since: 1.5 +## +{ 'enum': 'X86CPURegister32', + 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } + +## +# @X86CPUFeatureWordInfo +# +# Information about a X86 CPU feature word +# +# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word +# +# @cpuid-input-ecx: #optional Input ECX value for CPUID instruction for that +# feature word +# +# @cpuid-register: Output register containing the feature bits +# +# @features: value of output register, containing the feature bits +# +# Since: 1.5 +## +{ 'type': 'X86CPUFeatureWordInfo', + 'data': { 'cpuid-input-eax': 'int', + '*cpuid-input-ecx': 'int', + 'cpuid-register': 'X86CPURegister32', + 'features': 'int' } }
target-i386/cpu.c +58 -12
99 lines not on this page · raw message
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 05/11] target-i386: Add "filtered-features" property to X86CPU
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
This property will contain all the features that were removed from the CPU because they are not supported by the host.
This way, libvirt or other management tools can emulate the check/enforce behavior by checking if filtered-properties is all zeroes, before starting the guest.
Example output where some features were missing:
$ qemu-system-x86_64 -enable-kvm -cpu Haswell,check -S \
-qmp unix:/tmp/m,server,nowait
warning: host doesn't support requested feature: CPUID.01H:ECX.fma [bit 12]
warning: host doesn't support requested feature: CPUID.01H:ECX.movbe [bit 22]
warning: host doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
warning: host doesn't support requested feature: CPUID.01H:ECX.xsave [bit 26]
warning: host doesn't support requested feature: CPUID.01H:ECX.avx [bit 28]
warning: host doesn't support requested feature: CPUID.07H:EBX.fsgsbase [bit 0]
warning: host doesn't support requested feature: CPUID.07H:EBX.bmi1 [bit 3]
warning: host doesn't support requested feature: CPUID.07H:EBX.hle [bit 4]
warning: host doesn't support requested feature: CPUID.07H:EBX.avx2 [bit 5]
warning: host doesn't support requested feature: CPUID.07H:EBX.smep [bit 7]
warning: host doesn't support requested feature: CPUID.07H:EBX.bmi2 [bit 8]
warning: host doesn't support requested feature: CPUID.07H:EBX.erms [bit 9]
warning: host doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10]
warning: host doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11]
[...]
$ ./QMP/qmp --path=/tmp/m \
qom-get --path=/machine/icc-bridge/icc/child[0] \
--property=filtered-features
item[0].cpuid-register: EDX
item[0].cpuid-input-eax: 2147483658
item[0].features: 0
item[1].cpuid-register: EAX
item[1].cpuid-input-eax: 1073741825
item[1].features: 0
item[2].cpuid-register: EDX
item[2].cpuid-input-eax: 3221225473
item[2].features: 0
item[3].cpuid-register: ECX
item[3].cpuid-input-eax: 2147483649
item[3].features: 0
item[4].cpuid-register: EDX
item[4].cpuid-input-eax: 2147483649
item[4].features: 0
item[5].cpuid-register: EBX
item[5].cpuid-input-eax: 7
item[5].features: 4025
item[5].cpuid-input-ecx: 0
item[6].cpuid-register: ECX
item[6].cpuid-input-eax: 1
item[6].features: 356519936
item[7].cpuid-register: EDX
item[7].cpuid-input-eax: 1
item[7].features: 0Example output when no feature is missing:
$ qemu-system-x86_64 -enable-kvm -cpu Nehalem,enforce -S \
-qmp unix:/tmp/m,server,nowait
[...]
$ ./QMP/qmp --path=/tmp/m \
qom-get --path=/machine/icc-bridge/icc/child[0] \
--property=filtered-features
item[0].cpuid-register: EDX
item[0].cpuid-input-eax: 2147483658
item[0].features: 0
item[1].cpuid-register: EAX
item[1].cpuid-input-eax: 1073741825
item[1].features: 0
item[2].cpuid-register: EDX
item[2].cpuid-input-eax: 3221225473
item[2].features: 0
item[3].cpuid-register: ECX
item[3].cpuid-input-eax: 2147483649
item[3].features: 0
item[4].cpuid-register: EDX
item[4].cpuid-input-eax: 2147483649
item[4].features: 0
item[5].cpuid-register: EBX
item[5].cpuid-input-eax: 7
item[5].features: 0
item[5].cpuid-input-ecx: 0
item[6].cpuid-register: ECX
item[6].cpuid-input-eax: 1
item[6].features: 0
item[7].cpuid-register: EDX
item[7].cpuid-input-eax: 1
item[7].features: 0--- target-i386/cpu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
target-i386/cpu.c +7 -4
@@ -1418,11 +1418,11 @@ static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, void *opaque, cpu->env.cpuid_apic_id = value; } +/* Generic getter for "feature-words" and "filtered-features" properties */ static void x86_cpu_get_feature_words (Object *obj,Visitor *v,void *opaque,const char *name,Error **errp) { -X86CPU *cpu =X86_CPU (obj); -CPUX86State *env = &cpu->env; +uint32_t *array = (uint32_t *)opaque;FeatureWord w;Error *err =NULL ;X86CPUFeatureWordInfo word_infos[FEATURE_WORDS ] = { };
@@ -1436,7 +1436,7 @@ static void x86_cpu_get_feature_words(Object *obj, Visitor *v, void *opaque, qwi->has_cpuid_input_ecx = wi->cpuid_needs_ecx; qwi->cpuid_input_ecx = wi->cpuid_ecx; qwi->cpuid_register = x86_reg_info_32[wi->cpuid_reg].qapi_enum; - qwi->features = env->features[w]; + qwi->features = array[w];/* List will be in reverse order, but order shouldn't matter */ list_entries[w].next = list;
@@ -2444,7 +2444,10 @@ static void x86_cpu_initfn(Object *obj) x86_cpuid_set_apic_id, NULL, NULL, NULL);object_property_add (obj,"feature-words" ,"X86CPUFeatureWordInfo" , x86_cpu_get_feature_words, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL , (void *)env->features,NULL ); +object_property_add (obj,"filtered-features" ,"X86CPUFeatureWordInfo" , + x86_cpu_get_feature_words, +NULL ,NULL , (void *)cpu->filtered_features,NULL ); env->cpuid_apic_id =x86_cpu_apic_id_from_index (cs->cpu_index);
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 08/11] target-i386: Emulate X86CPU subclasses for global properties
In reply to Andreas FärberAfter initializing the object from its x86_def_t and before setting any additional -cpu arguments, set any global properties for the designated subclass <name>-{i386,x86_64}-cpu.
--- target-i386/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
target-i386/cpu.c +9 -0
@@ -1751,6 +1751,7 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,CPUX86State *env;gchar **model_pieces;char *name, *features; +char *typename;Error *error =NULL ; model_pieces =g_strsplit (cpu_model,"," ,2 );
@@ -1778,6 +1779,14 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge, goto out; } +/* Emulate per-model subclasses for global properties */ + typename =g_strdup_printf ("%s-" TYPE_X86_CPU , name); +qdev_prop_set_globals_for_type (DEVICE (cpu), typename, &error); +g_free (typename); +if (error) { + goto out; + } +cpu_x86_parse_featurestr (cpu, features, &error);if (error) { goto out;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 09/11] target-i386: Change CPUID model of 486 to 8
In reply to Andreas FärberThis changes the model number of 486 to 8 (DX4) which matches the feature set presented, and actually has the CPUID instruction.
This adds a compatibility property, to keep model=0 on pc-*-1.4 and older.
--- include/hw/i386/pc.h | 4 ++++ target-i386/cpu.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
include/hw/i386/pc.h +4 -0
@@ -242,6 +242,10 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t); .driver = "pc-sysfw",\ .property = "rom_only",\ .value = stringify(0),\ + },{\ + .driver = "486-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(0),\ }#endif
target-i386/cpu.c +1 -1
@@ -588,7 +588,7 @@ static x86_def_t builtin_x86_defs[] = { .level = 1, .vendor = CPUID_VENDOR_INTEL, .family = 4, - .model = 0, + .model = 8, .stepping = 0, .features[FEAT_1_EDX ] = I486_FEATURES,
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 06/11] qdev: Let qdev_prop_parse() pass through Error
In reply to Andreas FärberMove error reporting to callers.
--- hw/core/qdev-properties.c | 25 +++++++++++-------------- hw/core/qdev.c | 7 ++++++- include/hw/qdev-properties.h | 5 +++-- qdev-monitor.c | 6 +++++- 4 files changed, 25 insertions(+), 18 deletions(-)
hw/core/qdev-properties.c +11 -14
@@ -986,25 +986,18 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev, } } -int qdev_prop_parse (DeviceState *dev,const char *name,const char *value) +void qdev_prop_parse (DeviceState *dev,const char *name,const char *value, +Error **errp) {char *legacy_name; -Error *err =NULL ; legacy_name =g_strdup_printf ("legacy-%s" , name);if (object_property_get_type (OBJECT (dev), legacy_name,NULL )) { -object_property_parse (OBJECT (dev), value, legacy_name, &err); +object_property_parse (OBJECT (dev), value, legacy_name, errp); }else { -object_property_parse (OBJECT (dev), value, name, &err); +object_property_parse (OBJECT (dev), value, name, errp); }g_free (legacy_name); - -if (err) { -qerror_report_err (err); -error_free (err); -return -1 ; - } -return 0 ; }void qdev_prop_set_bit (DeviceState *dev,const char *name,bool value)
@@ -1106,18 +1099,22 @@ void qdev_prop_register_global_list(GlobalProperty *props) } } -void qdev_prop_set_globals (DeviceState *dev) +void qdev_prop_set_globals (DeviceState *dev,Error **errp) {ObjectClass *class =object_get_class (OBJECT (dev)); do { GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { + Error *err = NULL; + if (strcmp(object_class_get_name(class), prop->driver) != 0) { continue; } - if (qdev_prop_parse(dev, prop->property, prop->value) != 0) { - exit(1); + qdev_prop_parse(dev, prop->property, prop->value, &err); + if (err != NULL) { + error_propagate(errp, err); + return; } } class = object_class_get_parent(class);
hw/core/qdev.c +6 -1
@@ -752,7 +752,12 @@ static void device_initfn(Object *obj) } class =object_class_get_parent (class); }while (class !=object_class_by_name (TYPE_DEVICE )); -qdev_prop_set_globals (dev); +qdev_prop_set_globals (dev, &err); +if (err !=NULL ) { +qerror_report_err (err); +error_free (err); +exit (1 ); + }object_property_add_link (OBJECT (dev),"parent_bus" ,TYPE_BUS , (Object **)&dev->parent_bus, &err);
include/hw/qdev-properties.h +3 -2
@@ -148,7 +148,8 @@ extern PropertyInfo qdev_prop_arraylen;/* Set properties between creation and init. */ void *qdev_get_prop_ptr (DeviceState *dev,Property *prop); -int qdev_prop_parse (DeviceState *dev,const char *name,const char *value); +void qdev_prop_parse (DeviceState *dev,const char *name,const char *value, +Error **errp);void qdev_prop_set_bit (DeviceState *dev,const char *name,bool value);void qdev_prop_set_uint8 (DeviceState *dev,const char *name,uint8_t value);void qdev_prop_set_uint16 (DeviceState *dev,const char *name,uint16_t value);
@@ -167,7 +168,7 @@ void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value);void qdev_prop_register_global (GlobalProperty *prop);void qdev_prop_register_global_list (GlobalProperty *props); -void qdev_prop_set_globals (DeviceState *dev); +void qdev_prop_set_globals (DeviceState *dev,Error **errp);void error_set_from_qdev_prop_error (Error **errp,int ret,DeviceState *dev,Property *prop,const char *value);
qdev-monitor.c +5 -1
@@ -105,13 +105,17 @@ static void qdev_print_devinfo(ObjectClass *klass, void *opaque)static int set_property (const char *name,const char *value,void *opaque) {DeviceState *dev = opaque; +Error *err =NULL ;if (strcmp (name,"driver" ) ==0 )return 0 ;if (strcmp (name,"bus" ) ==0 )return 0 ; -if (qdev_prop_parse (dev, name, value) ==-1 ) { +qdev_prop_parse (dev, name, value, &err); +if (err !=NULL ) { +qerror_report_err (err); +error_free (err);return -1 ; }return 0 ;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 07/11] qdev: Introduce qdev_prop_set_globals_for_type()
In reply to Andreas FärberReuse it in qdev_prop_set_globals().
--- hw/core/qdev-properties.c | 36 +++++++++++++++++++++++++----------- include/hw/qdev-properties.h | 2 ++ 2 files changed, 27 insertions(+), 11 deletions(-)
hw/core/qdev-properties.c +25 -11
@@ -1099,23 +1099,37 @@ void qdev_prop_register_global_list(GlobalProperty *props) } } +void qdev_prop_set_globals_for_type (DeviceState *dev,const char *typename, +Error **errp) +{ +GlobalProperty *prop; + + QTAILQ_FOREACH(prop, &global_props, next) { +Error *err =NULL ; + +if (strcmp (typename, prop->driver) !=0 ) { +continue ; + } +qdev_prop_parse (dev, prop->property, prop->value, &err); +if (err !=NULL ) { +error_propagate (errp, err); +return ; + } + } +} +void qdev_prop_set_globals (DeviceState *dev,Error **errp) {ObjectClass *class =object_get_class (OBJECT (dev));do { -GlobalProperty *prop; - QTAILQ_FOREACH(prop, &global_props, next) { -Error *err =NULL ; +Error *err =NULL ; -if (strcmp (object_class_get_name (class), prop->driver) !=0 ) { -continue ; - } -qdev_prop_parse (dev, prop->property, prop->value, &err); -if (err !=NULL ) { -error_propagate (errp, err); -return ; - } +qdev_prop_set_globals_for_type (dev,object_class_get_name (class), + &err); +if (err !=NULL ) { +error_propagate (errp, err); +return ; } class =object_class_get_parent (class); }while (class);
include/hw/qdev-properties.h +2 -0
@@ -169,6 +169,8 @@ void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value);void qdev_prop_register_global (GlobalProperty *prop);void qdev_prop_register_global_list (GlobalProperty *props);void qdev_prop_set_globals (DeviceState *dev,Error **errp); +void qdev_prop_set_globals_for_type (DeviceState *dev,const char *typename, +Error **errp);void error_set_from_qdev_prop_error (Error **errp,int ret,DeviceState *dev,Property *prop,const char *value);
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 10/11] target-i386: Introduce generic CPUID feature compat function
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Introduce x86_cpu_compat_set_features(), that can be used to set/unset feature bits on specific CPU models for machine-type compatibility.
--- target-i386/cpu.c | 26 ++++++++++++++++++++++++++ target-i386/cpu.h | 4 ++++ 2 files changed, 30 insertions(+)
target-i386/cpu.c +26 -0
@@ -971,6 +971,32 @@ static x86_def_t builtin_x86_defs[] = { }, }; +/** +* x86_cpu_compat_set_features: +* @cpu_model: CPU model name to be changed. If NULL, all CPU models are changed +* @w: Identifies the feature word to be changed. +* @feat_add: Feature bits to be added to feature word +* @feat_remove: Feature bits to be removed from feature word +* +* Change CPU model feature bits for compatibility. +* +* This function may be used by machine-type compatibility functions +* to enable or disable feature bits on specific CPU models. +*/ +void x86_cpu_compat_set_features (const char *cpu_model,FeatureWord w, +uint32_t feat_add,uint32_t feat_remove) +{ +x86_def_t *def; +int i; +for (i =0 ; i <ARRAY_SIZE (builtin_x86_defs); i++) { + def = &builtin_x86_defs[i]; +if (!cpu_model || !strcmp (cpu_model, def->name)) { + def->features[w] |= feat_add; + def->features[w] &= ~feat_remove; + } + } +} +#ifdef CONFIG_KVM static int cpu_x86_fill_model_id (char *str) {
target-i386/cpu.h +4 -0
@@ -1255,6 +1255,10 @@ void cpu_report_tpr_access(CPUX86State *env, TPRAccess access);void disable_kvm_pv_eoi (void ); +void x86_cpu_compat_set_features (const char *cpu_model,FeatureWord w, +uint32_t feat_add,uint32_t feat_remove); + +/* Return name of 32-bit register, from a R_* constant */ const char *get_register_name_32 (unsigned int reg);
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 11/11] target-i386: n270 can MOVBE
In reply to Andreas FärberFrom: Borislav Petkov <[email protected]>
The Atom core (cpu name "n270" in QEMU speak) supports MOVBE. This is needed when booting 3.8 and later linux kernels built with the MATOM target because we require MOVBE in order to boot properly now.
--- hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + target-i386/cpu.c | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -0
@@ -250,6 +250,7 @@ static void pc_init_pci_1_4(QEMUMachineInitArgs *args) { pc_sysfw_flash_vs_rom_bug_compatible = true; has_pvpanic = false; +x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE );pc_init_pci (args); }
hw/i386/pc_q35.c +1 -0
@@ -212,6 +212,7 @@ static void pc_q35_init_1_4(QEMUMachineInitArgs *args) { pc_sysfw_flash_vs_rom_bug_compatible = true; has_pvpanic = false; +x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE );pc_q35_init (args); }
target-i386/cpu.c +2 -1
@@ -657,7 +657,8 @@ static x86_def_t builtin_x86_defs[] = {/* Some CPUs got no CPUID_SEP */ .features[FEAT_1_ECX] =CPUID_EXT_SSE3 |CPUID_EXT_MONITOR |CPUID_EXT_SSSE3 | - CPUID_EXT_DSCPL | CPUID_EXT_EST | CPUID_EXT_TM2 | CPUID_EXT_XTPR, +CPUID_EXT_DSCPL |CPUID_EXT_EST |CPUID_EXT_TM2 |CPUID_EXT_XTPR | + CPUID_EXT_MOVBE, .features[FEAT_8000_0001_EDX ] = (PPRO_FEATURES &CPUID_EXT2_AMD_ALIASES ) | CPUID_EXT2_NX,
Signature · 1 line
1.8.1.4