diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-03-19 13:26:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:03 -0400 |
commit | a8db8453ff52609b14716361651ad10d2ab66682 (patch) | |
tree | 1356ff182b2399c391a1ac90a7828910ed108259 /arch | |
parent | bbc2ff6a91a4eef8030018cd389bb12352d11b34 (diff) |
x86: merge smp_prepare_boot_cpu
it is practically the same between arches now, so it is
moved to smpboot.c. Minor differences (gdt initialization)
live inside an ifdef
Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/smpboot.c | 18 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot_32.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot_64.c | 14 |
3 files changed, 18 insertions, 28 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index a36ae2785c48..b214d8dcc07a 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -24,6 +24,9 @@ | |||
24 | #include <mach_wakecpu.h> | 24 | #include <mach_wakecpu.h> |
25 | #include <smpboot_hooks.h> | 25 | #include <smpboot_hooks.h> |
26 | 26 | ||
27 | /* State of each CPU */ | ||
28 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | ||
29 | |||
27 | /* Store all idle threads, this can be reused instead of creating | 30 | /* Store all idle threads, this can be reused instead of creating |
28 | * a new thread. Also avoids complicated thread destroy functionality | 31 | * a new thread. Also avoids complicated thread destroy functionality |
29 | * for idle threads. | 32 | * for idle threads. |
@@ -999,6 +1002,21 @@ int __cpuinit native_cpu_up(unsigned int cpu) | |||
999 | return 0; | 1002 | return 0; |
1000 | } | 1003 | } |
1001 | 1004 | ||
1005 | /* | ||
1006 | * Early setup to make printk work. | ||
1007 | */ | ||
1008 | void __init native_smp_prepare_boot_cpu(void) | ||
1009 | { | ||
1010 | int me = smp_processor_id(); | ||
1011 | #ifdef CONFIG_X86_32 | ||
1012 | init_gdt(me); | ||
1013 | switch_to_new_gdt(); | ||
1014 | #endif | ||
1015 | /* already set me in cpu_online_map in boot_cpu_init() */ | ||
1016 | cpu_set(me, cpu_callout_map); | ||
1017 | per_cpu(cpu_state, me) = CPU_ONLINE; | ||
1018 | } | ||
1019 | |||
1002 | #ifdef CONFIG_HOTPLUG_CPU | 1020 | #ifdef CONFIG_HOTPLUG_CPU |
1003 | void remove_siblinginfo(int cpu) | 1021 | void remove_siblinginfo(int cpu) |
1004 | { | 1022 | { |
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c index 77b045cfebd4..5d27b1db6c26 100644 --- a/arch/x86/kernel/smpboot_32.c +++ b/arch/x86/kernel/smpboot_32.c | |||
@@ -77,9 +77,6 @@ u8 apicid_2_node[MAX_APICID]; | |||
77 | extern 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 | extern void unmap_cpu_to_logical_apicid(int cpu); |
79 | 79 | ||
80 | /* State of each CPU. */ | ||
81 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | ||
82 | |||
83 | #ifdef CONFIG_HOTPLUG_CPU | 80 | #ifdef CONFIG_HOTPLUG_CPU |
84 | void cpu_exit_clear(void) | 81 | void cpu_exit_clear(void) |
85 | { | 82 | { |
@@ -219,17 +216,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
219 | smp_boot_cpus(max_cpus); | 216 | smp_boot_cpus(max_cpus); |
220 | } | 217 | } |
221 | 218 | ||
222 | void __init native_smp_prepare_boot_cpu(void) | ||
223 | { | ||
224 | unsigned int cpu = smp_processor_id(); | ||
225 | |||
226 | init_gdt(cpu); | ||
227 | switch_to_new_gdt(); | ||
228 | |||
229 | cpu_set(cpu, cpu_callout_map); | ||
230 | __get_cpu_var(cpu_state) = CPU_ONLINE; | ||
231 | } | ||
232 | |||
233 | extern void impress_friends(void); | 219 | extern void impress_friends(void); |
234 | extern void smp_checks(void); | 220 | extern void smp_checks(void); |
235 | 221 | ||
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c index 60cd8cf1b073..f77299b0639e 100644 --- a/arch/x86/kernel/smpboot_64.c +++ b/arch/x86/kernel/smpboot_64.c | |||
@@ -68,9 +68,6 @@ | |||
68 | /* Set when the idlers are all forked */ | 68 | /* Set when the idlers are all forked */ |
69 | int smp_threads_ready; | 69 | int smp_threads_ready; |
70 | 70 | ||
71 | /* State of each CPU */ | ||
72 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | ||
73 | |||
74 | cycles_t cacheflush_time; | 71 | cycles_t cacheflush_time; |
75 | unsigned long cache_decay_ticks; | 72 | unsigned long cache_decay_ticks; |
76 | 73 | ||
@@ -216,17 +213,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
216 | print_cpu_info(&cpu_data(0)); | 213 | print_cpu_info(&cpu_data(0)); |
217 | } | 214 | } |
218 | 215 | ||
219 | /* | ||
220 | * Early setup to make printk work. | ||
221 | */ | ||
222 | void __init native_smp_prepare_boot_cpu(void) | ||
223 | { | ||
224 | int me = smp_processor_id(); | ||
225 | /* already set me in cpu_online_map in boot_cpu_init() */ | ||
226 | cpu_set(me, cpu_callout_map); | ||
227 | per_cpu(cpu_state, me) = CPU_ONLINE; | ||
228 | } | ||
229 | |||
230 | extern void impress_friends(void); | 216 | extern void impress_friends(void); |
231 | extern void smp_checks(void); | 217 | extern void smp_checks(void); |
232 | 218 | ||