qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: anthony.perard@citrix.com, pbonzini@redhat.com,
	aliguori@us.ibm.com, afaerber@suse.de, ehabkost@redhat.com
Subject: [Qemu-devel] [PATCH 4/5] target-i386: get default cpu_model from QEMUMachine
Date: Tue, 30 Apr 2013 15:41:27 +0200	[thread overview]
Message-ID: <1367329288-27178-5-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1367329288-27178-1-git-send-email-imammedo@redhat.com>

allows to remove:
 * checks for cpu_model ==  NULL
 * and dynamic setting of default value

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/pc.c      |    9 ---------
 hw/i386/pc_piix.c |   16 ++++++++++++++--
 hw/i386/pc_q35.c  |    2 ++
 target-i386/cpu.h |    6 ++++++
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 28f958d..0b75016 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -925,15 +925,6 @@ void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge)
     X86CPU *cpu = NULL;
     Error *error = NULL;
 
-    /* init CPUs */
-    if (cpu_model == NULL) {
-#ifdef TARGET_X86_64
-        cpu_model = "qemu64";
-#else
-        cpu_model = "qemu32";
-#endif
-    }
-
     for (i = 0; i < smp_cpus; i++) {
         cpu = pc_new_cpu(cpu_model, x86_cpu_apic_id_from_index(i),
                          icc_bridge, &error);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 3717796..465c48b 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -295,8 +295,6 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
     const char *kernel_cmdline = args->kernel_cmdline;
     const char *initrd_filename = args->initrd_filename;
     const char *boot_device = args->boot_device;
-    if (cpu_model == NULL)
-        cpu_model = "486";
     disable_kvm_pv_eoi();
     enable_compat_apic_id_mode();
     pc_init1(get_system_memory(),
@@ -323,6 +321,7 @@ static QEMUMachine pc_i440fx_machine_v1_5 = {
     .desc = "Standard PC (i440FX + PIIX, 1996)",
     .init = pc_init_pci,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .is_default = 1,
     DEFAULT_MACHINE_OPTIONS,
 };
@@ -332,6 +331,7 @@ static QEMUMachine pc_i440fx_machine_v1_4 = {
     .desc = "Standard PC (i440FX + PIIX, 1996)",
     .init = pc_init_pci_1_4,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_4,
         { /* end of list */ }
@@ -364,6 +364,7 @@ static QEMUMachine pc_machine_v1_3 = {
     .desc = "Standard PC",
     .init = pc_init_pci_1_3,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_3,
         { /* end of list */ }
@@ -404,6 +405,7 @@ static QEMUMachine pc_machine_v1_2 = {
     .desc = "Standard PC",
     .init = pc_init_pci_1_2,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_2,
         { /* end of list */ }
@@ -448,6 +450,7 @@ static QEMUMachine pc_machine_v1_1 = {
     .desc = "Standard PC",
     .init = pc_init_pci_1_2,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_1,
         { /* end of list */ }
@@ -484,6 +487,7 @@ static QEMUMachine pc_machine_v1_0 = {
     .desc = "Standard PC",
     .init = pc_init_pci_1_0,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_0,
         { /* end of list */ }
@@ -500,6 +504,7 @@ static QEMUMachine pc_machine_v0_15 = {
     .desc = "Standard PC",
     .init = pc_init_pci_1_0,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_0_15,
         { /* end of list */ }
@@ -533,6 +538,7 @@ static QEMUMachine pc_machine_v0_14 = {
     .desc = "Standard PC",
     .init = pc_init_pci_1_0,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_0_14, 
         {
@@ -567,6 +573,7 @@ static QEMUMachine pc_machine_v0_13 = {
     .desc = "Standard PC",
     .init = pc_init_pci_no_kvmclock,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_0_13,
         {
@@ -605,6 +612,7 @@ static QEMUMachine pc_machine_v0_12 = {
     .desc = "Standard PC",
     .init = pc_init_pci_no_kvmclock,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_0_12,
         {
@@ -639,6 +647,7 @@ static QEMUMachine pc_machine_v0_11 = {
     .desc = "Standard PC, qemu 0.11",
     .init = pc_init_pci_no_kvmclock,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_0_11,
         {
@@ -661,6 +670,7 @@ static QEMUMachine pc_machine_v0_10 = {
     .desc = "Standard PC, qemu 0.10",
     .init = pc_init_pci_no_kvmclock,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_0_11,
         {
@@ -694,6 +704,7 @@ static QEMUMachine isapc_machine = {
     .name = "isapc",
     .desc = "ISA-only PC",
     .init = pc_init_isa,
+    .cpu_model = "486",
     .max_cpus = 1,
     .compat_props = (GlobalProperty[]) {
         {
@@ -712,6 +723,7 @@ static QEMUMachine xenfv_machine = {
     .desc = "Xen Fully-virtualized PC",
     .init = pc_xen_hvm_init,
     .max_cpus = HVM_MAX_VCPUS,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     .default_machine_opts = "accel=xen",
     DEFAULT_MACHINE_OPTIONS,
 };
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 073543e..ab864db 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -214,6 +214,7 @@ static QEMUMachine pc_q35_machine_v1_5 = {
     .desc = "Standard PC (Q35 + ICH9, 2009)",
     .init = pc_q35_init,
     .max_cpus = 255,
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     DEFAULT_MACHINE_OPTIONS,
 };
 
@@ -226,6 +227,7 @@ static QEMUMachine pc_q35_machine_v1_4 = {
         PC_COMPAT_1_4,
         { /* end of list */ }
     },
+    .cpu_model = DEFAULT_X86CPU_MODEL,
     DEFAULT_MACHINE_OPTIONS,
 };
 
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index f193752..a49f68a 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -896,6 +896,12 @@ typedef struct CPUX86State {
 
 #include "cpu-qom.h"
 
+#ifdef TARGET_X86_64
+#define DEFAULT_X86CPU_MODEL "qemu64"
+#else
+#define DEFAULT_X86CPU_MODEL "qemu32"
+#endif
+
 X86CPU *cpu_x86_init(const char *cpu_model);
 X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
                        Error **errp);
-- 
1.7.1

  parent reply	other threads:[~2013-04-30 13:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30 13:41 [Qemu-devel] [PATCH 0/5 v9 for-1.5] target-i386: CPU hot-add with cpu-add QMP command Igor Mammedov
2013-04-30 13:41 ` [Qemu-devel] [PATCH 1/5] add hot_add_cpu hook to QEMUMachine Igor Mammedov
2013-04-30 14:19   ` Eduardo Habkost
2013-04-30 15:48   ` Andreas Färber
2013-04-30 13:41 ` [Qemu-devel] [PATCH 2/5] QMP: add cpu-add command Igor Mammedov
2013-04-30 14:19   ` Eduardo Habkost
2013-04-30 15:58   ` Andreas Färber
2013-04-30 13:41 ` [Qemu-devel] [PATCH 3/5] add cpu_model to QEMUMachine Igor Mammedov
2013-04-30 14:30   ` Eduardo Habkost
2013-04-30 14:48     ` [Qemu-devel] [PATCH] target-arm: cpu: set default cpu_model via QEMUMachine.cpu_model Igor Mammedov
2013-04-30 14:55       ` Peter Maydell
2013-04-30 15:01         ` Igor Mammedov
2013-04-30 15:06         ` Eduardo Habkost
2013-04-30 14:54     ` [Qemu-devel] [PATCH 3/5] add cpu_model to QEMUMachine Peter Maydell
2013-04-30 15:14       ` Igor Mammedov
2013-04-30 15:32         ` Peter Maydell
2013-04-30 13:41 ` Igor Mammedov [this message]
2013-04-30 14:47   ` [Qemu-devel] [PATCH 4/5] target-i386: get default cpu_model from QEMUMachine Eduardo Habkost
2013-04-30 13:41 ` [Qemu-devel] [PATCH 5/5] target-i386: implement machine->hot_add_cpu hook Igor Mammedov
2013-04-30 16:00   ` Igor Mammedov
2013-04-30 16:31     ` Eduardo Habkost
2013-05-01 19:32     ` Andreas Färber
2013-05-02  7:18       ` Igor Mammedov
2013-05-02 11:46         ` Andreas Färber
2013-04-30 16:32   ` [Qemu-devel] [PATCH 5/5 v10] " Igor Mammedov

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=1367329288-27178-5-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=anthony.perard@citrix.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@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).