aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/smpboot.c
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-03-19 13:25:56 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:02 -0400
commit7cc3959ecd830796231f50bf5e42dc018b3694f2 (patch)
tree31975cc806d948e4dbea61f5241a81b4910498d2 /arch/x86/kernel/smpboot.c
parentb9f9294a86fd274e4055891450033e8bc9d68f66 (diff)
x86: move {un}map_cpu_to_logical_apicid to smpboot.c
Move map_cpu_to_logical_apicid() and unmap_cpu_to_logical_apicid() to smpboot.c. They take together all the bunch of static functions they rely upon Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/smpboot.c')
-rw-r--r--arch/x86/kernel/smpboot.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 253be86a88e4..5bff87e99898 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -50,6 +50,66 @@ static cpumask_t cpu_sibling_setup_map;
50/* Set if we find a B stepping CPU */ 50/* Set if we find a B stepping CPU */
51int __cpuinitdata smp_b_stepping; 51int __cpuinitdata smp_b_stepping;
52 52
53#if defined(CONFIG_NUMA) && defined(CONFIG_X86_32)
54
55/* which logical CPUs are on which nodes */
56cpumask_t node_to_cpumask_map[MAX_NUMNODES] __read_mostly =
57 { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE };
58EXPORT_SYMBOL(node_to_cpumask_map);
59/* which node each logical CPU is on */
60int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 };
61EXPORT_SYMBOL(cpu_to_node_map);
62
63/* set up a mapping between cpu and node. */
64static void map_cpu_to_node(int cpu, int node)
65{
66 printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node);
67 cpu_set(cpu, node_to_cpumask_map[node]);
68 cpu_to_node_map[cpu] = node;
69}
70
71/* undo a mapping between cpu and node. */
72static void unmap_cpu_to_node(int cpu)
73{
74 int node;
75
76 printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu);
77 for (node = 0; node < MAX_NUMNODES; node++)
78 cpu_clear(cpu, node_to_cpumask_map[node]);
79 cpu_to_node_map[cpu] = 0;
80}
81#else /* !(CONFIG_NUMA && CONFIG_X86_32) */
82#define map_cpu_to_node(cpu, node) ({})
83#define unmap_cpu_to_node(cpu) ({})
84#endif
85
86#ifdef CONFIG_X86_32
87u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly =
88 { [0 ... NR_CPUS-1] = BAD_APICID };
89
90void map_cpu_to_logical_apicid(void)
91{
92 int cpu = smp_processor_id();
93 int apicid = logical_smp_processor_id();
94 int node = apicid_to_node(apicid);
95
96 if (!node_online(node))
97 node = first_online_node;
98
99 cpu_2_logical_apicid[cpu] = apicid;
100 map_cpu_to_node(cpu, node);
101}
102
103void unmap_cpu_to_logical_apicid(int cpu)
104{
105 cpu_2_logical_apicid[cpu] = BAD_APICID;
106 unmap_cpu_to_node(cpu);
107}
108#else
109#define unmap_cpu_to_logical_apicid(cpu) do {} while (0)
110#define map_cpu_to_logical_apicid() do {} while (0)
111#endif
112
53static void __cpuinit smp_apply_quirks(struct cpuinfo_x86 *c) 113static void __cpuinit smp_apply_quirks(struct cpuinfo_x86 *c)
54{ 114{
55#ifdef CONFIG_X86_32 115#ifdef CONFIG_X86_32