qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Igor Mammedov" <imammedo@redhat.com>,
	"Don Slutz" <Don@CloudSwitch.Com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 3/5] target-i386: postpone cpuid_level update to realize time
Date: Mon,  3 Dec 2012 15:27:59 -0200	[thread overview]
Message-ID: <1354555681-15343-4-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1354555681-15343-1-git-send-email-ehabkost@redhat.com>

From: Igor Mammedov <imammedo@redhat.com>

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>
---
 target-i386/cpu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 569acac..ee03652 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1380,9 +1380,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:
@@ -2073,6 +2070,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);
-- 
1.7.11.7

  parent reply	other threads:[~2012-12-03 17:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 17:27 [Qemu-devel] [PATCH 0/5] x86 CPU init cleanup, short version Eduardo Habkost
2012-12-03 17:27 ` [Qemu-devel] [PATCH 1/5] target-i386: cpu: separate feature string parsing from CPU model lookup Eduardo Habkost
2012-12-03 23:27   ` Igor Mammedov
2012-12-04 18:24   ` Blue Swirl
2012-12-03 17:27 ` [Qemu-devel] [PATCH 2/5] target-i386: use define for cpuid vendor string size Eduardo Habkost
2012-12-03 17:27 ` Eduardo Habkost [this message]
2012-12-03 17:28 ` [Qemu-devel] [PATCH 4/5] add visitor for parsing hz[KMG] input string Eduardo Habkost
2012-12-03 17:28 ` [Qemu-devel] [PATCH 5/5] target-i386: use visit_type_hz to parse tsc_freq property value Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354555681-15343-4-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=Don@CloudSwitch.Com \
    --cc=afaerber@suse.de \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).