aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-10 15:40:48 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-13 19:19:22 -0500
commit678e12cc9054e8a9eafc43a5b4b65d335d6651d4 (patch)
treee70fc49775b9312023fec2130c3d9b685016ece1 /hw/pc.c
parentc4f31a0a0c1f44a5253f892fea4e711028021c66 (diff)
Don't use cpu_index as apic_id.
(patch is on top of "Apic creation should not depend on pci" series) Currently cpu_index is used as cpu apic id on x86. This is incorrect since apic ids not have to be continuous (they can also encode cpu hierarchy information). This patch uses cpuid_apic_id for initial apic id value. For now cpuid_apic_id is set to be equal to cpu_index so behaviour is fully backward compatible, but it allows us to add qemu option to provide other values for cpu apic id. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/pc.c b/hw/pc.c
index dc284970e4..143b697c70 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -830,6 +830,11 @@ static int load_option_rom(const char *oprom, target_phys_addr_t start,
return size;
}
+int cpu_is_bsp(CPUState *env)
+{
+ return env->cpuid_apic_id == 0;
+}
+
/* PC hardware initialisation */
static void pc_init1(ram_addr_t ram_size,
const char *boot_device,
@@ -877,6 +882,7 @@ static void pc_init1(ram_addr_t ram_size,
exit(1);
}
if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) {
+ env->cpuid_apic_id = env->cpu_index;
apic_init(env);
}
qemu_register_reset(main_cpu_reset, 0, env);