Commit c70dcb74 authored by Glauber de Oliveira Costa's avatar Glauber de Oliveira Costa Committed by Ingo Molnar

x86: change boot_cpu_id to boot_cpu_physical_apicid

This is to match i386. The former name was cuter,
but the current is more meaningful and more general,
since cpu_id can be a logical id.
Signed-off-by: default avatarGlauber Costa <gcosta@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 9d97d0da
...@@ -431,7 +431,8 @@ void __cpuinit check_boot_apic_timer_broadcast(void) ...@@ -431,7 +431,8 @@ void __cpuinit check_boot_apic_timer_broadcast(void)
lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY; lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY;
local_irq_enable(); local_irq_enable();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, &boot_cpu_id); clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
&boot_cpu_physical_apicid);
local_irq_disable(); local_irq_disable();
} }
...@@ -857,7 +858,7 @@ static int __init detect_init_APIC(void) ...@@ -857,7 +858,7 @@ static int __init detect_init_APIC(void)
} }
mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
boot_cpu_id = 0; boot_cpu_physical_apicid = 0;
return 0; return 0;
} }
...@@ -882,7 +883,7 @@ void __init early_init_lapic_mapping(void) ...@@ -882,7 +883,7 @@ void __init early_init_lapic_mapping(void)
* Fetch the APIC ID of the BSP in case we have a * Fetch the APIC ID of the BSP in case we have a
* default configuration (or the MP table is broken). * default configuration (or the MP table is broken).
*/ */
boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
} }
/** /**
...@@ -909,7 +910,7 @@ void __init init_apic_mappings(void) ...@@ -909,7 +910,7 @@ void __init init_apic_mappings(void)
* Fetch the APIC ID of the BSP in case we have a * Fetch the APIC ID of the BSP in case we have a
* default configuration (or the MP table is broken). * default configuration (or the MP table is broken).
*/ */
boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
} }
/* /*
...@@ -930,8 +931,8 @@ int __init APIC_init_uniprocessor(void) ...@@ -930,8 +931,8 @@ int __init APIC_init_uniprocessor(void)
verify_local_APIC(); verify_local_APIC();
phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id)); apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid));
setup_local_APIC(); setup_local_APIC();
......
...@@ -59,8 +59,8 @@ unsigned long mp_lapic_addr = 0; ...@@ -59,8 +59,8 @@ unsigned long mp_lapic_addr = 0;
/* Processor that is doing the boot up */ /* Processor that is doing the boot up */
unsigned int boot_cpu_id = -1U; unsigned int boot_cpu_physical_apicid = -1U;
EXPORT_SYMBOL(boot_cpu_id); EXPORT_SYMBOL(boot_cpu_physical_apicid);
/* Internal processor count */ /* Internal processor count */
unsigned int num_processors; unsigned int num_processors;
...@@ -107,7 +107,7 @@ static void __cpuinit MP_processor_info(struct mpc_config_processor *m) ...@@ -107,7 +107,7 @@ static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
} }
if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
bootup_cpu = " (Bootup-CPU)"; bootup_cpu = " (Bootup-CPU)";
boot_cpu_id = m->mpc_apicid; boot_cpu_physical_apicid = m->mpc_apicid;
} }
printk(KERN_INFO "Processor #%d%s\n", m->mpc_apicid, bootup_cpu); printk(KERN_INFO "Processor #%d%s\n", m->mpc_apicid, bootup_cpu);
...@@ -665,8 +665,8 @@ void __init mp_register_lapic_address(u64 address) ...@@ -665,8 +665,8 @@ void __init mp_register_lapic_address(u64 address)
{ {
mp_lapic_addr = (unsigned long) address; mp_lapic_addr = (unsigned long) address;
set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
if (boot_cpu_id == -1U) if (boot_cpu_physical_apicid == -1U)
boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
} }
void __cpuinit mp_register_lapic (u8 id, u8 enabled) void __cpuinit mp_register_lapic (u8 id, u8 enabled)
...@@ -674,7 +674,7 @@ void __cpuinit mp_register_lapic (u8 id, u8 enabled) ...@@ -674,7 +674,7 @@ void __cpuinit mp_register_lapic (u8 id, u8 enabled)
struct mpc_config_processor processor; struct mpc_config_processor processor;
int boot_cpu = 0; int boot_cpu = 0;
if (id == boot_cpu_id) if (id == boot_cpu_physical_apicid)
boot_cpu = 1; boot_cpu = 1;
processor.mpc_type = MP_PROCESSOR; processor.mpc_type = MP_PROCESSOR;
......
...@@ -602,7 +602,8 @@ static __init void disable_smp(void) ...@@ -602,7 +602,8 @@ static __init void disable_smp(void)
cpu_present_map = cpumask_of_cpu(0); cpu_present_map = cpumask_of_cpu(0);
cpu_possible_map = cpumask_of_cpu(0); cpu_possible_map = cpumask_of_cpu(0);
if (smp_found_config) if (smp_found_config)
phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); phys_cpu_present_map =
physid_mask_of_physid(boot_cpu_physical_apicid);
else else
phys_cpu_present_map = physid_mask_of_physid(0); phys_cpu_present_map = physid_mask_of_physid(0);
cpu_set(0, per_cpu(cpu_sibling_map, 0)); cpu_set(0, per_cpu(cpu_sibling_map, 0));
...@@ -637,9 +638,10 @@ static int __init smp_sanity_check(unsigned max_cpus) ...@@ -637,9 +638,10 @@ static int __init smp_sanity_check(unsigned max_cpus)
* Should not be necessary because the MP table should list the boot * Should not be necessary because the MP table should list the boot
* CPU too, but we do it for the sake of robustness anyway. * CPU too, but we do it for the sake of robustness anyway.
*/ */
if (!physid_isset(boot_cpu_id, phys_cpu_present_map)) { if (!physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map)) {
printk(KERN_NOTICE "weird, boot CPU (#%d) not listed by the BIOS.\n", printk(KERN_NOTICE
boot_cpu_id); "weird, boot CPU (#%d) not listed by the BIOS.\n",
boot_cpu_physical_apicid);
physid_set(hard_smp_processor_id(), phys_cpu_present_map); physid_set(hard_smp_processor_id(), phys_cpu_present_map);
} }
...@@ -648,7 +650,7 @@ static int __init smp_sanity_check(unsigned max_cpus) ...@@ -648,7 +650,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
*/ */
if (!cpu_has_apic) { if (!cpu_has_apic) {
printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
boot_cpu_id); boot_cpu_physical_apicid);
printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
nr_ioapics = 0; nr_ioapics = 0;
return -1; return -1;
...@@ -709,9 +711,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) ...@@ -709,9 +711,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
enable_IO_APIC(); enable_IO_APIC();
end_local_APIC_setup(); end_local_APIC_setup();
if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) { if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid) {
panic("Boot APIC ID in local APIC unexpected (%d vs %d)", panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_id); GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_physical_apicid);
/* Or can we switch back to PIC here? */ /* Or can we switch back to PIC here? */
} }
...@@ -756,7 +758,7 @@ int __cpuinit native_cpu_up(unsigned int cpu) ...@@ -756,7 +758,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
Dprintk("++++++++++++++++++++=_---CPU UP %u\n", cpu); Dprintk("++++++++++++++++++++=_---CPU UP %u\n", cpu);
if (apicid == BAD_APICID || apicid == boot_cpu_id || if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid ||
!physid_isset(apicid, phys_cpu_present_map)) { !physid_isset(apicid, phys_cpu_present_map)) {
printk("__cpu_up: bad cpu %d\n", cpu); printk("__cpu_up: bad cpu %d\n", cpu);
return -EINVAL; return -EINVAL;
......
...@@ -44,7 +44,6 @@ extern int apic_runs_main_timer; ...@@ -44,7 +44,6 @@ extern int apic_runs_main_timer;
extern int ioapic_force; extern int ioapic_force;
extern int disable_apic; extern int disable_apic;
extern int disable_apic_timer; extern int disable_apic_timer;
extern unsigned boot_cpu_id;
/* /*
* Basic functions accessing APICs. * Basic functions accessing APICs.
......
...@@ -109,6 +109,9 @@ extern void prefill_possible_map(void); ...@@ -109,6 +109,9 @@ extern void prefill_possible_map(void);
extern unsigned long setup_trampoline(void); extern unsigned long setup_trampoline(void);
void smp_store_cpu_info(int id); void smp_store_cpu_info(int id);
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
#else
#define cpu_physical_id(cpu) boot_cpu_physical_apicid
#endif #endif
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
......
...@@ -30,8 +30,6 @@ extern void zap_low_mappings (void); ...@@ -30,8 +30,6 @@ extern void zap_low_mappings (void);
DECLARE_PER_CPU(int, cpu_number); DECLARE_PER_CPU(int, cpu_number);
#define raw_smp_processor_id() (x86_read_percpu(cpu_number)) #define raw_smp_processor_id() (x86_read_percpu(cpu_number))
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
extern int safe_smp_processor_id(void); extern int safe_smp_processor_id(void);
/* We don't mark CPUs online until __cpu_up(), so we need another measure */ /* We don't mark CPUs online until __cpu_up(), so we need another measure */
...@@ -41,10 +39,7 @@ static inline int num_booting_cpus(void) ...@@ -41,10 +39,7 @@ static inline int num_booting_cpus(void)
} }
#else /* CONFIG_SMP */ #else /* CONFIG_SMP */
#define safe_smp_processor_id() 0 #define safe_smp_processor_id() 0
#define cpu_physical_id(cpu) boot_cpu_physical_apicid
#endif /* !CONFIG_SMP */ #endif /* !CONFIG_SMP */
#ifdef CONFIG_X86_LOCAL_APIC #ifdef CONFIG_X86_LOCAL_APIC
......
...@@ -22,7 +22,6 @@ extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *), ...@@ -22,7 +22,6 @@ extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#define raw_smp_processor_id() read_pda(cpunumber) #define raw_smp_processor_id() read_pda(cpunumber)
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
#define stack_smp_processor_id() \ #define stack_smp_processor_id() \
({ \ ({ \
...@@ -41,9 +40,6 @@ static inline int num_booting_cpus(void) ...@@ -41,9 +40,6 @@ static inline int num_booting_cpus(void)
} }
#else /* CONFIG_SMP */ #else /* CONFIG_SMP */
extern unsigned int boot_cpu_id;
#define cpu_physical_id(cpu) boot_cpu_id
#define stack_smp_processor_id() 0 #define stack_smp_processor_id() 0
#endif /* !CONFIG_SMP */ #endif /* !CONFIG_SMP */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment