Skip to content

Commit c70dcb7

Browse files
glommerIngo Molnar
authored andcommitted
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: Glauber Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 9d97d0d commit c70dcb7

7 files changed

Lines changed: 26 additions & 30 deletions

File tree

‎arch/x86/kernel/apic_64.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,8 @@ void __cpuinit check_boot_apic_timer_broadcast(void)
431431
lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY;
432432

433433
local_irq_enable();
434-
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, &boot_cpu_id);
434+
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
435+
&boot_cpu_physical_apicid);
435436
local_irq_disable();
436437
}
437438

@@ -857,7 +858,7 @@ static int __init detect_init_APIC(void)
857858
}
858859

859860
mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
860-
boot_cpu_id = 0;
861+
boot_cpu_physical_apicid = 0;
861862
return 0;
862863
}
863864

@@ -882,7 +883,7 @@ void __init early_init_lapic_mapping(void)
882883
* Fetch the APIC ID of the BSP in case we have a
883884
* default configuration (or the MP table is broken).
884885
*/
885-
boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID));
886+
boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
886887
}
887888

888889
/**
@@ -909,7 +910,7 @@ void __init init_apic_mappings(void)
909910
* Fetch the APIC ID of the BSP in case we have a
910911
* default configuration (or the MP table is broken).
911912
*/
912-
boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID));
913+
boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
913914
}
914915

915916
/*
@@ -930,8 +931,8 @@ int __init APIC_init_uniprocessor(void)
930931

931932
verify_local_APIC();
932933

933-
phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
934-
apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id));
934+
phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
935+
apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid));
935936

936937
setup_local_APIC();
937938

‎arch/x86/kernel/mpparse_64.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ unsigned long mp_lapic_addr = 0;
5959

6060

6161
/* Processor that is doing the boot up */
62-
unsigned int boot_cpu_id = -1U;
63-
EXPORT_SYMBOL(boot_cpu_id);
62+
unsigned int boot_cpu_physical_apicid = -1U;
63+
EXPORT_SYMBOL(boot_cpu_physical_apicid);
6464

6565
/* Internal processor count */
6666
unsigned int num_processors;
@@ -107,7 +107,7 @@ static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
107107
}
108108
if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
109109
bootup_cpu = " (Bootup-CPU)";
110-
boot_cpu_id = m->mpc_apicid;
110+
boot_cpu_physical_apicid = m->mpc_apicid;
111111
}
112112

113113
printk(KERN_INFO "Processor #%d%s\n", m->mpc_apicid, bootup_cpu);
@@ -665,16 +665,16 @@ void __init mp_register_lapic_address(u64 address)
665665
{
666666
mp_lapic_addr = (unsigned long) address;
667667
set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
668-
if (boot_cpu_id == -1U)
669-
boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID));
668+
if (boot_cpu_physical_apicid == -1U)
669+
boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
670670
}
671671

672672
void __cpuinit mp_register_lapic (u8 id, u8 enabled)
673673
{
674674
struct mpc_config_processor processor;
675675
int boot_cpu = 0;
676676

677-
if (id == boot_cpu_id)
677+
if (id == boot_cpu_physical_apicid)
678678
boot_cpu = 1;
679679

680680
processor.mpc_type = MP_PROCESSOR;

‎arch/x86/kernel/smpboot_64.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ static __init void disable_smp(void)
602602
cpu_present_map = cpumask_of_cpu(0);
603603
cpu_possible_map = cpumask_of_cpu(0);
604604
if (smp_found_config)
605-
phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
605+
phys_cpu_present_map =
606+
physid_mask_of_physid(boot_cpu_physical_apicid);
606607
else
607608
phys_cpu_present_map = physid_mask_of_physid(0);
608609
cpu_set(0, per_cpu(cpu_sibling_map, 0));
@@ -637,9 +638,10 @@ static int __init smp_sanity_check(unsigned max_cpus)
637638
* Should not be necessary because the MP table should list the boot
638639
* CPU too, but we do it for the sake of robustness anyway.
639640
*/
640-
if (!physid_isset(boot_cpu_id, phys_cpu_present_map)) {
641-
printk(KERN_NOTICE "weird, boot CPU (#%d) not listed by the BIOS.\n",
642-
boot_cpu_id);
641+
if (!physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map)) {
642+
printk(KERN_NOTICE
643+
"weird, boot CPU (#%d) not listed by the BIOS.\n",
644+
boot_cpu_physical_apicid);
643645
physid_set(hard_smp_processor_id(), phys_cpu_present_map);
644646
}
645647

@@ -648,7 +650,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
648650
*/
649651
if (!cpu_has_apic) {
650652
printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
651-
boot_cpu_id);
653+
boot_cpu_physical_apicid);
652654
printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
653655
nr_ioapics = 0;
654656
return -1;
@@ -709,9 +711,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
709711
enable_IO_APIC();
710712
end_local_APIC_setup();
711713

712-
if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) {
714+
if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid) {
713715
panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
714-
GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_id);
716+
GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_physical_apicid);
715717
/* Or can we switch back to PIC here? */
716718
}
717719

@@ -756,7 +758,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
756758

757759
Dprintk("++++++++++++++++++++=_---CPU UP %u\n", cpu);
758760

759-
if (apicid == BAD_APICID || apicid == boot_cpu_id ||
761+
if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid ||
760762
!physid_isset(apicid, phys_cpu_present_map)) {
761763
printk("__cpu_up: bad cpu %d\n", cpu);
762764
return -EINVAL;

‎include/asm-x86/apic.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ extern int apic_runs_main_timer;
4444
extern int ioapic_force;
4545
extern int disable_apic;
4646
extern int disable_apic_timer;
47-
extern unsigned boot_cpu_id;
4847

4948
/*
5049
* Basic functions accessing APICs.

‎include/asm-x86/smp.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ extern void prefill_possible_map(void);
109109
extern unsigned long setup_trampoline(void);
110110

111111
void smp_store_cpu_info(int id);
112+
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
113+
#else
114+
#define cpu_physical_id(cpu) boot_cpu_physical_apicid
112115
#endif
113116

114117
#ifdef CONFIG_X86_32

‎include/asm-x86/smp_32.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ extern void zap_low_mappings (void);
3030
DECLARE_PER_CPU(int, cpu_number);
3131
#define raw_smp_processor_id() (x86_read_percpu(cpu_number))
3232

33-
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
34-
3533
extern int safe_smp_processor_id(void);
3634

3735
/* 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)
4139
}
4240

4341
#else /* CONFIG_SMP */
44-
4542
#define safe_smp_processor_id() 0
46-
#define cpu_physical_id(cpu) boot_cpu_physical_apicid
47-
4843
#endif /* !CONFIG_SMP */
4944

5045
#ifdef CONFIG_X86_LOCAL_APIC

‎include/asm-x86/smp_64.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
2222
#ifdef CONFIG_SMP
2323

2424
#define raw_smp_processor_id() read_pda(cpunumber)
25-
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
2625

2726
#define stack_smp_processor_id() \
2827
({ \
@@ -41,9 +40,6 @@ static inline int num_booting_cpus(void)
4140
}
4241

4342
#else /* CONFIG_SMP */
44-
45-
extern unsigned int boot_cpu_id;
46-
#define cpu_physical_id(cpu) boot_cpu_id
4743
#define stack_smp_processor_id() 0
4844

4945
#endif /* !CONFIG_SMP */

0 commit comments

Comments
 (0)