qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 11/37] target-i386: introduce vendor-override static


From: Igor Mammedov
Subject: [Qemu-devel] [PATCH 11/37] target-i386: introduce vendor-override static property
Date: Mon, 22 Oct 2012 17:02:57 +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.

  - cpuid_vendor_override is converted to uint32_t so it could be used with
    DEFINE_PROP_BIT()

Signed-off-by: Igor Mammedov <address@hidden>
---
 target-i386/cpu.c | 6 ++++--
 target-i386/cpu.h | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 4bbfe9b..fa974e7 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -218,6 +218,7 @@ static Property cpu_x86_properties[] = {
     DEFINE_PROP_BIT("f-pfthreshold", X86CPU, env.cpuid_svm_features, 12, 
false),
     DEFINE_PROP_BIT("f-smep", X86CPU, env.cpuid_7_0_ebx_features,  7, false),
     DEFINE_PROP_BIT("f-smap", X86CPU, env.cpuid_7_0_ebx_features, 20, false),
+    DEFINE_PROP_BIT("vendor-override", X86CPU, env.cpuid_vendor_override, 0, 
false),
     DEFINE_PROP_END_OF_LIST(),
  };
 
@@ -1136,7 +1137,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)
@@ -1220,7 +1220,9 @@ 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;
+    if (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);
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 7903413..69f8691 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -788,7 +788,7 @@ typedef struct CPUX86State {
     uint32_t cpuid_ext2_features;
     uint32_t cpuid_ext3_features;
     uint32_t cpuid_apic_id;
-    int cpuid_vendor_override;
+    uint32_t cpuid_vendor_override;
     /* Store the results of Centaur's CPUID instructions */
     uint32_t cpuid_xlevel2;
     uint32_t cpuid_ext4_features;
-- 
1.7.11.7




reply via email to

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