summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2012-10-22 17:03:00 +0200
committerAndreas Färber <afaerber@suse.de>2012-12-07 19:03:04 +0100
commitb34d12d153e6e5c5e5e00eac510b054a94409deb (patch)
treed08e0e401396e3fa23f0708e6db2929008670001
parent9df694eeb8447ae5a302b4d40df9a8b91dfc61da (diff)
downloadfocaccia-qemu-b34d12d153e6e5c5e5e00eac510b054a94409deb.tar.gz
focaccia-qemu-b34d12d153e6e5c5e5e00eac510b054a94409deb.zip
target-i386: Postpone cpuid_level update to realize time
Delay capping cpuid_level to 7 to realize time so property setters
for cpuid_7_0_ebx_features and "level" could be used in any order/time
between x86_cpu_initfn() and x86_cpu_realize().

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--target-i386/cpu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index a631ae9c87..7be3ad82cb 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1381,9 +1381,6 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features)
         if (kvm_check_features_against_host(x86_cpu_def) && enforce_cpuid)
             goto error;
     }
-    if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level < 7) {
-        x86_cpu_def->level = 7;
-    }
     return 0;
 
 error:
@@ -2074,6 +2071,11 @@ static void x86_cpu_apic_init(X86CPU *cpu, Error **errp)
 void x86_cpu_realize(Object *obj, Error **errp)
 {
     X86CPU *cpu = X86_CPU(obj);
+    CPUX86State *env = &cpu->env;
+
+    if (env->cpuid_7_0_ebx_features && env->cpuid_level < 7) {
+        env->cpuid_level = 7;
+    }
 
 #ifndef CONFIG_USER_ONLY
     qemu_register_reset(x86_cpu_machine_reset_cb, cpu);