qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@redhat.com>
To: qemu-devel@nongnu.org
Cc: jan.kiszka@siemens.com, aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 1/6] split pc_new_cpu
Date: Fri, 17 Apr 2009 11:20:44 -0400	[thread overview]
Message-ID: <1239981649-6366-2-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1239981649-6366-1-git-send-email-glommer@redhat.com>

since it is useful elsewhere.

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 hw/pc.c |   37 ++++++++++++++++++++++---------------
 hw/pc.h |    1 +
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 6a1750e..39ed066 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -775,6 +775,26 @@ static int load_option_rom(const char *oprom, target_phys_addr_t start,
         return size;
 }
 
+CPUState *pc_new_cpu(int cpu, const char *cpu_model, int pci_enabled)
+{
+    CPUState *env = cpu_init(cpu_model);
+    if (!env) {
+        fprintf(stderr, "Unable to find x86 CPU definition\n");
+        exit(1);
+    }
+    if (cpu != 0)
+        env->halted = 1;
+    if (smp_cpus > 1) {
+        /* XXX: enable it in all cases */
+        env->cpuid_features |= CPUID_APIC;
+    }
+    qemu_register_reset(main_cpu_reset, env);
+    if (pci_enabled) {
+        apic_init(env);
+    }
+    return env;
+}
+
 /* PC hardware initialisation */
 static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
                      const char *boot_device,
@@ -816,23 +836,10 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     }
     
     for(i = 0; i < smp_cpus; i++) {
-        env = cpu_init(cpu_model);
-        if (!env) {
-            fprintf(stderr, "Unable to find x86 CPU definition\n");
-            exit(1);
-        }
-        if (i != 0)
-            env->halted = 1;
-        if (smp_cpus > 1) {
-            /* XXX: enable it in all cases */
-            env->cpuid_features |= CPUID_APIC;
-        }
-        qemu_register_reset(main_cpu_reset, env);
-        if (pci_enabled) {
-            apic_init(env);
-        }
+        env = pc_new_cpu(i, cpu_model, pci_enabled);
     }
 
+
     vmport_init();
 
     /* allocate RAM */
diff --git a/hw/pc.h b/hw/pc.h
index 50e6c39..59047b5 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -102,6 +102,7 @@ extern int fd_bootchk;
 
 void ioport_set_a20(int enable);
 int ioport_get_a20(void);
+CPUState *pc_new_cpu(int cpu, const char *cpu_model, int pci_enabled);
 
 /* acpi.c */
 extern int acpi_enabled;
-- 
1.5.6.6

  reply	other threads:[~2009-04-17 15:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 15:20 [Qemu-devel] [PATCH 0/6] Add support for cpu hotplug Glauber Costa
2009-04-17 15:20 ` Glauber Costa [this message]
2009-04-17 15:20   ` [Qemu-devel] [PATCH 2/6] always have apic Glauber Costa
2009-04-17 15:20     ` [Qemu-devel] [PATCH 3/6] Fix warnings and errors with DEBUG enabled Glauber Costa
2009-04-17 15:20       ` [Qemu-devel] [PATCH 4/6] disallow kqemu if we fail to load it Glauber Costa
2009-04-17 15:20         ` [Qemu-devel] [PATCH 5/6] enable cpu hotplug Glauber Costa
2009-04-17 15:20           ` [Qemu-devel] [PATCH 6/6] add bios support for " Glauber Costa
2009-04-17 20:06             ` [Qemu-devel] " Anthony Liguori
2009-04-17 20:18           ` [Qemu-devel] Re: [PATCH 5/6] enable " Anthony Liguori

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=1239981649-6366-2-git-send-email-glommer@redhat.com \
    --to=glommer@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.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).