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>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [RFC 5/9] target-i386: Move kvm_features/hypervisor initialization to cpu_x86_find_by_name()
Date: Fri, 28 Dec 2012 18:34:02 -0200	[thread overview]
Message-ID: <1356726846-10637-6-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1356726846-10637-1-git-send-email-ehabkost@redhat.com>

Move the initialization to the cpu_x86_find_by_name(), inside the block
for predefined CPU models.

That code is not necessary for -cpu "host", because:

- kvm_features doesn't need to be set because kvm_cpu_fill_host()
  already sets all bits supported by the host.
- the CPUID_EXT_HYPERVISOR flag doesn't need to be manually set because
  kvm_arch_get_supported_cpuid() already sets it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/cpu.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index aa96535..b3bd2f5 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1244,6 +1244,15 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *name)
             host_cpuid(0, 0, NULL, &ebx, &ecx, &edx);
             x86cpu_vendor_words2str(x86_cpu_def->vendor, ebx, edx, ecx);
         }
+
+        x86_cpu_def->kvm_features |= kvm_default_features;
+        add_flagname_to_bitmaps("hypervisor", &x86_cpu_def->features,
+                                &x86_cpu_def->ext_features,
+                                &x86_cpu_def->ext2_features,
+                                &x86_cpu_def->ext3_features,
+                                &x86_cpu_def->kvm_features,
+                                &x86_cpu_def->svm_features,
+                                &x86_cpu_def->cpuid_7_0_ebx_features);
     }
 
     return 0;
@@ -1518,12 +1527,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, Error **errp)
     env = &cpu->env;
     env->cpu_model_str = cpu_model;
 
-    def->kvm_features |= kvm_default_features;
-    add_flagname_to_bitmaps("hypervisor", &def->features,
-                            &def->ext_features, &def->ext2_features,
-                            &def->ext3_features, &def->kvm_features,
-                            &def->svm_features, &def->cpuid_7_0_ebx_features);
-
     cpudef_2_x86_cpu(cpu, def, &error);
 
     if (cpu_x86_parse_featurestr(cpu, features, &props) < 0) {
-- 
1.7.11.7

  parent reply	other threads:[~2012-12-28 20:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-28 20:33 [Qemu-devel] [PATCH 0/9] x86 CPU subclasses Eduardo Habkost
2012-12-28 20:33 ` [Qemu-devel] [PATCH 1/9] target-i386: Move CPU object creation to cpu.c Eduardo Habkost
2012-12-28 20:33 ` [Qemu-devel] [PATCH 2/9] target-i386: Make cpu_x86_create() get Error argument Eduardo Habkost
2012-12-28 20:34 ` [Qemu-devel] [PATCH 3/9] target-i386: Simplify cpu_x86_find_by_name() logic Eduardo Habkost
2012-12-28 20:34 ` [Qemu-devel] [RFC 4/9] target-i386: Set feature string parsing results directly on CPU object Eduardo Habkost
2012-12-28 20:34 ` Eduardo Habkost [this message]
2012-12-28 20:34 ` [Qemu-devel] [RFC 6/9] target-i386: Move CPU creation code to model name lookup function Eduardo Habkost
2012-12-28 20:34 ` [Qemu-devel] [RFC 7/9] target-i386: CPU subclass for -cpu "host" Eduardo Habkost
2013-01-02 19:00   ` Igor Mammedov
2013-01-02 20:07     ` Igor Mammedov
2013-01-02 20:20       ` Eduardo Habkost
2013-01-02 20:16     ` Eduardo Habkost
2012-12-28 20:34 ` [Qemu-devel] [RFC 8/9] target-i386: CPU subclasses for predefined CPU models Eduardo Habkost
2012-12-28 20:34 ` [Qemu-devel] [RFC 9/9] target-i386: Unify CPU object creation on x86_cpu_create_from_name() 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=1356726846-10637-6-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.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).