[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 8/15] isolate cpu initialization function in hw/pc.c
From: |
Glauber Costa |
Subject: |
[Qemu-devel] [PATCH 8/15] isolate cpu initialization function in hw/pc.c |
Date: |
Tue, 26 Feb 2008 16:56:38 -0300 |
This patch wraps up the piece of code in hw/pc.c that
actually allocates and initializates a cpu. After that,
plan is to be able to start it later on.
Signed-off-by: Glauber Costa <address@hidden>
---
qemu/hw/pc.c | 40 +++++++++++++++++++++++-----------------
qemu/hw/pc.h | 1 +
2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 77a7d53..982377d 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -740,6 +740,28 @@ static int load_option_rom(const char *f
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->hflags |= HF_HALTED_MASK;
+ if (smp_cpus > 1) {
+ /* XXX: enable it in all cases */
+ env->cpuid_features |= CPUID_APIC;
+ }
+ register_savevm("cpu", cpu, 4, cpu_save, cpu_load, env);
+ qemu_register_reset(main_cpu_reset, env);
+ if (pci_enabled) {
+ apic_init(env);
+ }
+ vmport_init(env);
+ return env;
+}
+
/* PC hardware initialisation */
static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
@@ -779,23 +801,7 @@ #endif
}
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->hflags |= HF_HALTED_MASK;
- if (smp_cpus > 1) {
- /* XXX: enable it in all cases */
- env->cpuid_features |= CPUID_APIC;
- }
- register_savevm("cpu", i, 4, cpu_save, cpu_load, env);
- qemu_register_reset(main_cpu_reset, env);
- if (pci_enabled) {
- apic_init(env);
- }
- vmport_init(env);
+ env = pc_new_cpu(i, cpu_model, pci_enabled);
}
/* allocate RAM */
diff --git a/qemu/hw/pc.h b/qemu/hw/pc.h
index f640395..f70ab55 100644
--- a/qemu/hw/pc.h
+++ b/qemu/hw/pc.h
@@ -85,6 +85,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.4.2
- [Qemu-devel] [PATCH 0/15] acpi processor hotplug, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 1/15] Make a GPE register block be acessible., Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 2/15] mark extra cpus as present, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 3/15] introduce cpu_set to qemu monitor, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 4/15] mark processors as presents, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 5/15] provide gpe _L0x methods, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 6/15] provide operation region for pio to the gpes, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 7/15] implement method _L00 for GPE0, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 8/15] isolate cpu initialization function in hw/pc.c,
Glauber Costa <=
- [Qemu-devel] [PATCH 9/15] initialize hot add system., Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 10/15] handle gpe data for pio, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 11/15] manipulate the gpe bits and send sci up the os., Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 12/15] isolate cpu thread creation in qemu-kvm.c, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 13/15] provide _MAT to acpi processor, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 14/15] start a new cpu thread, Glauber Costa, 2008/02/26
- [Qemu-devel] [PATCH 15/15] remove acpi_build_processor_ssdt, Glauber Costa, 2008/02/26
- [Qemu-devel] Re: [kvm-devel] [PATCH 4/15] mark processors as presents, Alexander Graf, 2008/02/26
- [Qemu-devel] Re: [kvm-devel] [PATCH 4/15] mark processors as presents, Alexander Graf, 2008/02/26
[Qemu-devel] Re: [kvm-devel] [PATCH 0/15] acpi processor hotplug, Avi Kivity, 2008/02/27