diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-03-19 13:25:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:02 -0400 |
commit | 7cc3959ecd830796231f50bf5e42dc018b3694f2 (patch) | |
tree | 31975cc806d948e4dbea61f5241a81b4910498d2 | |
parent | b9f9294a86fd274e4055891450033e8bc9d68f66 (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>
-rw-r--r-- | arch/x86/kernel/smpboot.c | 60 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot_32.c | 59 |
2 files changed, 62 insertions, 57 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 */ |
51 | int __cpuinitdata smp_b_stepping; | 51 | int __cpuinitdata smp_b_stepping; |
52 | 52 | ||
53 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) | ||
54 | |||
55 | /* which logical CPUs are on which nodes */ | ||
56 | cpumask_t node_to_cpumask_map[MAX_NUMNODES] __read_mostly = | ||
57 | { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE }; | ||
58 | EXPORT_SYMBOL(node_to_cpumask_map); | ||
59 | /* which node each logical CPU is on */ | ||
60 | int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 }; | ||
61 | EXPORT_SYMBOL(cpu_to_node_map); | ||
62 | |||
63 | /* set up a mapping between cpu and node. */ | ||
64 | static 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. */ | ||
72 | static 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 | ||
87 | u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = | ||
88 | { [0 ... NR_CPUS-1] = BAD_APICID }; | ||
89 | |||
90 | void 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 | |||
103 | void 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 | |||
53 | static void __cpuinit smp_apply_quirks(struct cpuinfo_x86 *c) | 113 | static void __cpuinit smp_apply_quirks(struct cpuinfo_x86 *c) |
54 | { | 114 | { |
55 | #ifdef CONFIG_X86_32 | 115 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c index 33758a2ddd48..1eb7b73b45a3 100644 --- a/arch/x86/kernel/smpboot_32.c +++ b/arch/x86/kernel/smpboot_32.c | |||
@@ -74,7 +74,8 @@ EXPORT_PER_CPU_SYMBOL(x86_bios_cpu_apicid); | |||
74 | 74 | ||
75 | u8 apicid_2_node[MAX_APICID]; | 75 | u8 apicid_2_node[MAX_APICID]; |
76 | 76 | ||
77 | static void map_cpu_to_logical_apicid(void); | 77 | extern void map_cpu_to_logical_apicid(void); |
78 | extern void unmap_cpu_to_logical_apicid(int cpu); | ||
78 | 79 | ||
79 | /* State of each CPU. */ | 80 | /* State of each CPU. */ |
80 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | 81 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; |
@@ -262,62 +263,6 @@ extern struct { | |||
262 | unsigned short ss; | 263 | unsigned short ss; |
263 | } stack_start; | 264 | } stack_start; |
264 | 265 | ||
265 | #ifdef CONFIG_NUMA | ||
266 | |||
267 | /* which logical CPUs are on which nodes */ | ||
268 | cpumask_t node_to_cpumask_map[MAX_NUMNODES] __read_mostly = | ||
269 | { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE }; | ||
270 | EXPORT_SYMBOL(node_to_cpumask_map); | ||
271 | /* which node each logical CPU is on */ | ||
272 | int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 }; | ||
273 | EXPORT_SYMBOL(cpu_to_node_map); | ||
274 | |||
275 | /* set up a mapping between cpu and node. */ | ||
276 | static inline void map_cpu_to_node(int cpu, int node) | ||
277 | { | ||
278 | printk("Mapping cpu %d to node %d\n", cpu, node); | ||
279 | cpu_set(cpu, node_to_cpumask_map[node]); | ||
280 | cpu_to_node_map[cpu] = node; | ||
281 | } | ||
282 | |||
283 | /* undo a mapping between cpu and node. */ | ||
284 | static inline void unmap_cpu_to_node(int cpu) | ||
285 | { | ||
286 | int node; | ||
287 | |||
288 | printk("Unmapping cpu %d from all nodes\n", cpu); | ||
289 | for (node = 0; node < MAX_NUMNODES; node ++) | ||
290 | cpu_clear(cpu, node_to_cpumask_map[node]); | ||
291 | cpu_to_node_map[cpu] = 0; | ||
292 | } | ||
293 | #else /* !CONFIG_NUMA */ | ||
294 | |||
295 | #define map_cpu_to_node(cpu, node) ({}) | ||
296 | #define unmap_cpu_to_node(cpu) ({}) | ||
297 | |||
298 | #endif /* CONFIG_NUMA */ | ||
299 | |||
300 | u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; | ||
301 | |||
302 | static void map_cpu_to_logical_apicid(void) | ||
303 | { | ||
304 | int cpu = smp_processor_id(); | ||
305 | int apicid = logical_smp_processor_id(); | ||
306 | int node = apicid_to_node(apicid); | ||
307 | |||
308 | if (!node_online(node)) | ||
309 | node = first_online_node; | ||
310 | |||
311 | cpu_2_logical_apicid[cpu] = apicid; | ||
312 | map_cpu_to_node(cpu, node); | ||
313 | } | ||
314 | |||
315 | static void unmap_cpu_to_logical_apicid(int cpu) | ||
316 | { | ||
317 | cpu_2_logical_apicid[cpu] = BAD_APICID; | ||
318 | unmap_cpu_to_node(cpu); | ||
319 | } | ||
320 | |||
321 | static inline void __inquire_remote_apic(int apicid) | 266 | static inline void __inquire_remote_apic(int apicid) |
322 | { | 267 | { |
323 | unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 }; | 268 | unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 }; |