aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic/apic.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-15 22:49:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-15 22:49:10 -0400
commit181f977d134a9f8e3f8839f42af655b045fc059e (patch)
tree5d9bb67c62ef1476c18ed350106a84c02f0dd8e4 /arch/x86/kernel/apic/apic.c
parentd5d42399bd7b66bd6b55363b311810504110c967 (diff)
parent25542c646afbf14c43fa7d2b443055cadb73b07a (diff)
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (93 commits) x86, tlb, UV: Do small micro-optimization for native_flush_tlb_others() x86-64, NUMA: Don't call numa_set_distanc() for all possible node combinations during emulation x86-64, NUMA: Don't assume phys node 0 is always online in numa_emulation() x86-64, NUMA: Clean up initmem_init() x86-64, NUMA: Fix numa_emulation code with node0 without RAM x86-64, NUMA: Revert NUMA affine page table allocation x86: Work around old gas bug x86-64, NUMA: Better explain numa_distance handling x86-64, NUMA: Fix distance table handling mm: Move early_node_map[] reverse scan helpers under HAVE_MEMBLOCK x86-64, NUMA: Fix size of numa_distance array x86: Rename e820_table_* to pgt_buf_* bootmem: Move __alloc_memory_core_early() to nobootmem.c bootmem: Move contig_page_data definition to bootmem.c/nobootmem.c bootmem: Separate out CONFIG_NO_BOOTMEM code into nobootmem.c x86-64, NUMA: Seperate out numa_alloc_distance() from numa_set_distance() x86-64, NUMA: Add proper function comments to global functions x86-64, NUMA: Move NUMA emulation into numa_emulation.c x86-64, NUMA: Prepare numa_emulation() for moving NUMA emulation into a separate file x86-64, NUMA: Do not scan two times for setup_node_bootmem() ... Fix up conflicts in arch/x86/kernel/smpboot.c
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
-rw-r--r--arch/x86/kernel/apic/apic.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 48dcd2e83b46..562a8325cc1c 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -79,6 +79,15 @@ EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_apicid);
79EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid); 79EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
80 80
81#ifdef CONFIG_X86_32 81#ifdef CONFIG_X86_32
82
83/*
84 * On x86_32, the mapping between cpu and logical apicid may vary
85 * depending on apic in use. The following early percpu variable is
86 * used for the mapping. This is where the behaviors of x86_64 and 32
87 * actually diverge. Let's keep it ugly for now.
88 */
89DEFINE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid, BAD_APICID);
90
82/* 91/*
83 * Knob to control our willingness to enable the local APIC. 92 * Knob to control our willingness to enable the local APIC.
84 * 93 *
@@ -1238,6 +1247,19 @@ void __cpuinit setup_local_APIC(void)
1238 */ 1247 */
1239 apic->init_apic_ldr(); 1248 apic->init_apic_ldr();
1240 1249
1250#ifdef CONFIG_X86_32
1251 /*
1252 * APIC LDR is initialized. If logical_apicid mapping was
1253 * initialized during get_smp_config(), make sure it matches the
1254 * actual value.
1255 */
1256 i = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
1257 WARN_ON(i != BAD_APICID && i != logical_smp_processor_id());
1258 /* always use the value from LDR */
1259 early_per_cpu(x86_cpu_to_logical_apicid, cpu) =
1260 logical_smp_processor_id();
1261#endif
1262
1241 /* 1263 /*
1242 * Set Task Priority to 'accept all'. We never change this 1264 * Set Task Priority to 'accept all'. We never change this
1243 * later on. 1265 * later on.
@@ -1979,7 +2001,10 @@ void __cpuinit generic_processor_info(int apicid, int version)
1979 early_per_cpu(x86_cpu_to_apicid, cpu) = apicid; 2001 early_per_cpu(x86_cpu_to_apicid, cpu) = apicid;
1980 early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid; 2002 early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
1981#endif 2003#endif
1982 2004#ifdef CONFIG_X86_32
2005 early_per_cpu(x86_cpu_to_logical_apicid, cpu) =
2006 apic->x86_32_early_logical_apicid(cpu);
2007#endif
1983 set_cpu_possible(cpu, true); 2008 set_cpu_possible(cpu, true);
1984 set_cpu_present(cpu, true); 2009 set_cpu_present(cpu, true);
1985} 2010}
@@ -2000,10 +2025,14 @@ void default_init_apic_ldr(void)
2000} 2025}
2001 2026
2002#ifdef CONFIG_X86_32 2027#ifdef CONFIG_X86_32
2003int default_apicid_to_node(int logical_apicid) 2028int default_x86_32_numa_cpu_node(int cpu)
2004{ 2029{
2005#ifdef CONFIG_SMP 2030#ifdef CONFIG_NUMA
2006 return apicid_2_node[hard_smp_processor_id()]; 2031 int apicid = early_per_cpu(x86_cpu_to_apicid, cpu);
2032
2033 if (apicid != BAD_APICID)
2034 return __apicid_to_node[apicid];
2035 return NUMA_NO_NODE;
2007#else 2036#else
2008 return 0; 2037 return 0;
2009#endif 2038#endif