aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/apic_64.c13
-rw-r--r--arch/x86/kernel/mpparse_64.c12
-rw-r--r--arch/x86/kernel/smpboot_64.c18
-rw-r--r--include/asm-x86/apic.h1
-rw-r--r--include/asm-x86/smp.h3
-rw-r--r--include/asm-x86/smp_32.h5
-rw-r--r--include/asm-x86/smp_64.h4
7 files changed, 26 insertions, 30 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 8a475793f736..868ec1deb19a 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -431,7 +431,8 @@ void __cpuinit check_boot_apic_timer_broadcast(void)
431 lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY; 431 lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY;
432 432
433 local_irq_enable(); 433 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);
435 local_irq_disable(); 436 local_irq_disable();
436} 437}
437 438
@@ -857,7 +858,7 @@ static int __init detect_init_APIC(void)
857 } 858 }
858 859
859 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; 860 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
860 boot_cpu_id = 0; 861 boot_cpu_physical_apicid = 0;
861 return 0; 862 return 0;
862} 863}
863 864
@@ -882,7 +883,7 @@ void __init early_init_lapic_mapping(void)
882 * Fetch the APIC ID of the BSP in case we have a 883 * Fetch the APIC ID of the BSP in case we have a
883 * default configuration (or the MP table is broken). 884 * default configuration (or the MP table is broken).
884 */ 885 */
885 boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); 886 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
886} 887}
887 888
888/** 889/**
@@ -909,7 +910,7 @@ void __init init_apic_mappings(void)
909 * Fetch the APIC ID of the BSP in case we have a 910 * Fetch the APIC ID of the BSP in case we have a
910 * default configuration (or the MP table is broken). 911 * default configuration (or the MP table is broken).
911 */ 912 */
912 boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); 913 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
913} 914}
914 915
915/* 916/*
@@ -930,8 +931,8 @@ int __init APIC_init_uniprocessor(void)
930 931
931 verify_local_APIC(); 932 verify_local_APIC();
932 933
933 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); 934 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
934 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id)); 935 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid));
935 936
936 setup_local_APIC(); 937 setup_local_APIC();
937 938
diff --git a/arch/x86/kernel/mpparse_64.c b/arch/x86/kernel/mpparse_64.c
index 03ef1a8b53e8..20a345dd425b 100644
--- a/arch/x86/kernel/mpparse_64.c
+++ b/arch/x86/kernel/mpparse_64.c
@@ -59,8 +59,8 @@ unsigned long mp_lapic_addr = 0;
59 59
60 60
61/* Processor that is doing the boot up */ 61/* Processor that is doing the boot up */
62unsigned int boot_cpu_id = -1U; 62unsigned int boot_cpu_physical_apicid = -1U;
63EXPORT_SYMBOL(boot_cpu_id); 63EXPORT_SYMBOL(boot_cpu_physical_apicid);
64 64
65/* Internal processor count */ 65/* Internal processor count */
66unsigned int num_processors; 66unsigned int num_processors;
@@ -107,7 +107,7 @@ static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
107 } 107 }
108 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { 108 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
109 bootup_cpu = " (Bootup-CPU)"; 109 bootup_cpu = " (Bootup-CPU)";
110 boot_cpu_id = m->mpc_apicid; 110 boot_cpu_physical_apicid = m->mpc_apicid;
111 } 111 }
112 112
113 printk(KERN_INFO "Processor #%d%s\n", m->mpc_apicid, bootup_cpu); 113 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{ 665{
666 mp_lapic_addr = (unsigned long) address; 666 mp_lapic_addr = (unsigned long) address;
667 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); 667 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
668 if (boot_cpu_id == -1U) 668 if (boot_cpu_physical_apicid == -1U)
669 boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); 669 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
670} 670}
671 671
672void __cpuinit mp_register_lapic (u8 id, u8 enabled) 672void __cpuinit mp_register_lapic (u8 id, u8 enabled)
@@ -674,7 +674,7 @@ void __cpuinit mp_register_lapic (u8 id, u8 enabled)
674 struct mpc_config_processor processor; 674 struct mpc_config_processor processor;
675 int boot_cpu = 0; 675 int boot_cpu = 0;
676 676
677 if (id == boot_cpu_id) 677 if (id == boot_cpu_physical_apicid)
678 boot_cpu = 1; 678 boot_cpu = 1;
679 679
680 processor.mpc_type = MP_PROCESSOR; 680 processor.mpc_type = MP_PROCESSOR;
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 7ec96218a97e..420ae4a33548 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -602,7 +602,8 @@ static __init void disable_smp(void)
602 cpu_present_map = cpumask_of_cpu(0); 602 cpu_present_map = cpumask_of_cpu(0);
603 cpu_possible_map = cpumask_of_cpu(0); 603 cpu_possible_map = cpumask_of_cpu(0);
604 if (smp_found_config) 604 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);
606 else 607 else
607 phys_cpu_present_map = physid_mask_of_physid(0); 608 phys_cpu_present_map = physid_mask_of_physid(0);
608 cpu_set(0, per_cpu(cpu_sibling_map, 0)); 609 cpu_set(0, per_cpu(cpu_sibling_map, 0));
@@ -637,9 +638,10 @@ static int __init smp_sanity_check(unsigned max_cpus)
637 * Should not be necessary because the MP table should list the boot 638 * Should not be necessary because the MP table should list the boot
638 * CPU too, but we do it for the sake of robustness anyway. 639 * CPU too, but we do it for the sake of robustness anyway.
639 */ 640 */
640 if (!physid_isset(boot_cpu_id, phys_cpu_present_map)) { 641 if (!physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map)) {
641 printk(KERN_NOTICE "weird, boot CPU (#%d) not listed by the BIOS.\n", 642 printk(KERN_NOTICE
642 boot_cpu_id); 643 "weird, boot CPU (#%d) not listed by the BIOS.\n",
644 boot_cpu_physical_apicid);
643 physid_set(hard_smp_processor_id(), phys_cpu_present_map); 645 physid_set(hard_smp_processor_id(), phys_cpu_present_map);
644 } 646 }
645 647
@@ -648,7 +650,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
648 */ 650 */
649 if (!cpu_has_apic) { 651 if (!cpu_has_apic) {
650 printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", 652 printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
651 boot_cpu_id); 653 boot_cpu_physical_apicid);
652 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); 654 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
653 nr_ioapics = 0; 655 nr_ioapics = 0;
654 return -1; 656 return -1;
@@ -709,9 +711,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
709 enable_IO_APIC(); 711 enable_IO_APIC();
710 end_local_APIC_setup(); 712 end_local_APIC_setup();
711 713
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) {
713 panic("Boot APIC ID in local APIC unexpected (%d vs %d)", 715 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);
715 /* Or can we switch back to PIC here? */ 717 /* Or can we switch back to PIC here? */
716 } 718 }
717 719
@@ -756,7 +758,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
756 758
757 Dprintk("++++++++++++++++++++=_---CPU UP %u\n", cpu); 759 Dprintk("++++++++++++++++++++=_---CPU UP %u\n", cpu);
758 760
759 if (apicid == BAD_APICID || apicid == boot_cpu_id || 761 if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid ||
760 !physid_isset(apicid, phys_cpu_present_map)) { 762 !physid_isset(apicid, phys_cpu_present_map)) {
761 printk("__cpu_up: bad cpu %d\n", cpu); 763 printk("__cpu_up: bad cpu %d\n", cpu);
762 return -EINVAL; 764 return -EINVAL;
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h
index 424e1dfe13c9..b804238489a1 100644
--- a/include/asm-x86/apic.h
+++ b/include/asm-x86/apic.h
@@ -44,7 +44,6 @@ extern int apic_runs_main_timer;
44extern int ioapic_force; 44extern int ioapic_force;
45extern int disable_apic; 45extern int disable_apic;
46extern int disable_apic_timer; 46extern int disable_apic_timer;
47extern unsigned boot_cpu_id;
48 47
49/* 48/*
50 * Basic functions accessing APICs. 49 * Basic functions accessing APICs.
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h
index 78ef16dd194b..2ad2f4ffe498 100644
--- a/include/asm-x86/smp.h
+++ b/include/asm-x86/smp.h
@@ -109,6 +109,9 @@ extern void prefill_possible_map(void);
109extern unsigned long setup_trampoline(void); 109extern unsigned long setup_trampoline(void);
110 110
111void smp_store_cpu_info(int id); 111void 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
112#endif 115#endif
113 116
114#ifdef CONFIG_X86_32 117#ifdef CONFIG_X86_32
diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h
index 478f5564630f..f861d0415171 100644
--- a/include/asm-x86/smp_32.h
+++ b/include/asm-x86/smp_32.h
@@ -30,8 +30,6 @@ extern void zap_low_mappings (void);
30DECLARE_PER_CPU(int, cpu_number); 30DECLARE_PER_CPU(int, cpu_number);
31#define raw_smp_processor_id() (x86_read_percpu(cpu_number)) 31#define raw_smp_processor_id() (x86_read_percpu(cpu_number))
32 32
33#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
34
35extern int safe_smp_processor_id(void); 33extern int safe_smp_processor_id(void);
36 34
37/* We don't mark CPUs online until __cpu_up(), so we need another measure */ 35/* 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} 39}
42 40
43#else /* CONFIG_SMP */ 41#else /* CONFIG_SMP */
44
45#define safe_smp_processor_id() 0 42#define safe_smp_processor_id() 0
46#define cpu_physical_id(cpu) boot_cpu_physical_apicid
47
48#endif /* !CONFIG_SMP */ 43#endif /* !CONFIG_SMP */
49 44
50#ifdef CONFIG_X86_LOCAL_APIC 45#ifdef CONFIG_X86_LOCAL_APIC
diff --git a/include/asm-x86/smp_64.h b/include/asm-x86/smp_64.h
index be870a4881fc..fd709cbba4d1 100644
--- a/include/asm-x86/smp_64.h
+++ b/include/asm-x86/smp_64.h
@@ -22,7 +22,6 @@ extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
22#ifdef CONFIG_SMP 22#ifdef CONFIG_SMP
23 23
24#define raw_smp_processor_id() read_pda(cpunumber) 24#define raw_smp_processor_id() read_pda(cpunumber)
25#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
26 25
27#define stack_smp_processor_id() \ 26#define stack_smp_processor_id() \
28 ({ \ 27 ({ \
@@ -41,9 +40,6 @@ static inline int num_booting_cpus(void)
41} 40}
42 41
43#else /* CONFIG_SMP */ 42#else /* CONFIG_SMP */
44
45extern unsigned int boot_cpu_id;
46#define cpu_physical_id(cpu) boot_cpu_id
47#define stack_smp_processor_id() 0 43#define stack_smp_processor_id() 0
48 44
49#endif /* !CONFIG_SMP */ 45#endif /* !CONFIG_SMP */