[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 14/20] target-i386: introduce vendor-override property
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [RFC 14/20] target-i386: introduce vendor-override property |
Date: |
Fri, 10 Aug 2012 13:22:30 +0200 |
currently 'cpuid_vendor_override' can be set only via cmd line cpu_model
string. But setting it in 'vendor' property prevents using 'vendor'
property on its own without setting cpuid_vendor_override.
So fix/remove enabling cpuid_vendor_override from "vendor" property setter.
It's up-to cpu_model string parser to maintain legacy behavior when user
overrides vendor on command line.
v2:
- convert cpuid_vendor_override to bool to reflect its real usage
Signed-off-by: Igor Mammedov <address@hidden>
---
target-i386/cpu.c | 31 +++++++++++++++++++++++++++++--
target-i386/cpu.h | 2 +-
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index c935c04..d3ce849 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -894,7 +894,6 @@ static void x86_cpuid_set_vendor(Object *obj, const char
*value,
env->cpuid_vendor2 |= ((uint8_t)value[i + 4]) << (8 * i);
env->cpuid_vendor3 |= ((uint8_t)value[i + 8]) << (8 * i);
}
- env->cpuid_vendor_override = 1;
}
static char *x86_cpuid_get_model_id(Object *obj, Error **errp)
@@ -1068,6 +1067,31 @@ static void x86_cpuid_set_enforce(Object *obj, Visitor
*v, void *opaque,
object_property_set_bool(obj, value, "check", errp);
}
+static void
+x86_cpuid_get_vendor_override(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ X86CPU *cpu = X86_CPU(obj);
+ CPUX86State *env = &cpu->env;
+
+ visit_type_bool(v, &env->cpuid_vendor_override, name, errp);
+}
+
+static void
+x86_cpuid_set_vendor_override(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ X86CPU *cpu = X86_CPU(obj);
+ CPUX86State *env = &cpu->env;
+ bool value;
+
+ visit_type_bool(v, &value, name, errp);
+ if (error_is_set(errp)) {
+ return;
+ }
+ env->cpuid_vendor_override = value;
+}
+
static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp)
{
CPUX86State *env = &cpu->env;
@@ -1081,7 +1105,7 @@ static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def,
Error **errp)
env->cpuid_vendor2 = CPUID_VENDOR_INTEL_2;
env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3;
}
- env->cpuid_vendor_override = def->vendor_override;
+ object_property_set_bool(OBJECT(cpu), true, "vendor-override", errp);
object_property_set_int(OBJECT(cpu), def->level, "level", errp);
object_property_set_int(OBJECT(cpu), def->family, "family", errp);
object_property_set_int(OBJECT(cpu), def->model, "model", errp);
@@ -1998,6 +2022,9 @@ static void x86_cpu_initfn(Object *obj)
object_property_add_str(obj, "vendor",
x86_cpuid_get_vendor,
x86_cpuid_set_vendor, NULL);
+ object_property_add(obj, "vendor-override", "bool",
+ x86_cpuid_get_vendor_override,
+ x86_cpuid_set_vendor_override, NULL, NULL, NULL);
object_property_add_str(obj, "model-id",
x86_cpuid_get_model_id,
x86_cpuid_set_model_id, NULL);
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 60f9e97..979682a 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -739,7 +739,7 @@ typedef struct CPUX86State {
uint32_t cpuid_ext2_features;
uint32_t cpuid_ext3_features;
uint32_t cpuid_apic_id;
- int cpuid_vendor_override;
+ bool cpuid_vendor_override;
/* Store the results of Centaur's CPUID instructions */
uint32_t cpuid_xlevel2;
uint32_t cpuid_ext4_features;
--
1.7.11.2
- Re: [Qemu-devel] [RFC 12/20] add visitor for parsing hz[KMG] input string, (continued)
- Re: [Qemu-devel] [RFC 00/20] target-i386: convert CPU features into properties, Igor Mammedov, 2012/08/10
- [Qemu-devel] [RFC 19/20] target-i386: move init of "hypervisor" feature into CPU initializer from cpudef, Igor Mammedov, 2012/08/10
- [Qemu-devel] [RFC 13/20] target-i386: use visit_type_hz to parse tsc_freq property value, Igor Mammedov, 2012/08/10
- [Qemu-devel] [RFC 14/20] target-i386: introduce vendor-override property,
Igor Mammedov <=
- [Qemu-devel] [RFC 18/20] target-i386: use properties to set/unset user specified features on CPU, Igor Mammedov, 2012/08/10
- [Qemu-devel] [RFC 15/20] target-i386: use define for cpuid vendor string size, Igor Mammedov, 2012/08/10