diff options
Diffstat (limited to 'arch/arm/kernel/smp.c')
-rw-r--r-- | arch/arm/kernel/smp.c | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index ebd8ad274d76..d9241885521b 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
21 | #include <linux/cpu.h> | 21 | #include <linux/cpu.h> |
22 | #include <linux/smp.h> | ||
23 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
24 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
25 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
@@ -27,6 +26,7 @@ | |||
27 | #include <linux/completion.h> | 26 | #include <linux/completion.h> |
28 | 27 | ||
29 | #include <linux/atomic.h> | 28 | #include <linux/atomic.h> |
29 | #include <asm/smp.h> | ||
30 | #include <asm/cacheflush.h> | 30 | #include <asm/cacheflush.h> |
31 | #include <asm/cpu.h> | 31 | #include <asm/cpu.h> |
32 | #include <asm/cputype.h> | 32 | #include <asm/cputype.h> |
@@ -42,6 +42,7 @@ | |||
42 | #include <asm/ptrace.h> | 42 | #include <asm/ptrace.h> |
43 | #include <asm/localtimer.h> | 43 | #include <asm/localtimer.h> |
44 | #include <asm/smp_plat.h> | 44 | #include <asm/smp_plat.h> |
45 | #include <asm/mach/arch.h> | ||
45 | 46 | ||
46 | /* | 47 | /* |
47 | * as from 2.5, kernels no longer have an init_tasks structure | 48 | * as from 2.5, kernels no longer have an init_tasks structure |
@@ -60,6 +61,14 @@ enum ipi_msg_type { | |||
60 | 61 | ||
61 | static DECLARE_COMPLETION(cpu_running); | 62 | static DECLARE_COMPLETION(cpu_running); |
62 | 63 | ||
64 | static struct smp_operations smp_ops; | ||
65 | |||
66 | void __init smp_set_ops(struct smp_operations *ops) | ||
67 | { | ||
68 | if (ops) | ||
69 | smp_ops = *ops; | ||
70 | }; | ||
71 | |||
63 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) | 72 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) |
64 | { | 73 | { |
65 | int ret; | 74 | int ret; |
@@ -100,9 +109,60 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) | |||
100 | return ret; | 109 | return ret; |
101 | } | 110 | } |
102 | 111 | ||
112 | /* platform specific SMP operations */ | ||
113 | void __attribute__((weak)) __init smp_init_cpus(void) | ||
114 | { | ||
115 | if (smp_ops.smp_init_cpus) | ||
116 | smp_ops.smp_init_cpus(); | ||
117 | } | ||
118 | |||
119 | void __attribute__((weak)) __init platform_smp_prepare_cpus(unsigned int max_cpus) | ||
120 | { | ||
121 | if (smp_ops.smp_prepare_cpus) | ||
122 | smp_ops.smp_prepare_cpus(max_cpus); | ||
123 | } | ||
124 | |||
125 | void __attribute__((weak)) __cpuinit platform_secondary_init(unsigned int cpu) | ||
126 | { | ||
127 | if (smp_ops.smp_secondary_init) | ||
128 | smp_ops.smp_secondary_init(cpu); | ||
129 | } | ||
130 | |||
131 | int __attribute__((weak)) __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
132 | { | ||
133 | if (smp_ops.smp_boot_secondary) | ||
134 | return smp_ops.smp_boot_secondary(cpu, idle); | ||
135 | return -ENOSYS; | ||
136 | } | ||
137 | |||
103 | #ifdef CONFIG_HOTPLUG_CPU | 138 | #ifdef CONFIG_HOTPLUG_CPU |
104 | static void percpu_timer_stop(void); | 139 | static void percpu_timer_stop(void); |
105 | 140 | ||
141 | int __attribute__((weak)) platform_cpu_kill(unsigned int cpu) | ||
142 | { | ||
143 | if (smp_ops.cpu_kill) | ||
144 | return smp_ops.cpu_kill(cpu); | ||
145 | return 1; | ||
146 | } | ||
147 | |||
148 | void __attribute__((weak)) platform_cpu_die(unsigned int cpu) | ||
149 | { | ||
150 | if (smp_ops.cpu_die) | ||
151 | smp_ops.cpu_die(cpu); | ||
152 | } | ||
153 | |||
154 | int __attribute__((weak)) platform_cpu_disable(unsigned int cpu) | ||
155 | { | ||
156 | if (smp_ops.cpu_disable) | ||
157 | return smp_ops.cpu_disable(cpu); | ||
158 | |||
159 | /* | ||
160 | * By default, allow disabling all CPUs except the first one, | ||
161 | * since this is special on a lot of platforms, e.g. because | ||
162 | * of clock tick interrupts. | ||
163 | */ | ||
164 | return cpu == 0 ? -EPERM : 0; | ||
165 | } | ||
106 | /* | 166 | /* |
107 | * __cpu_disable runs on the processor to be shutdown. | 167 | * __cpu_disable runs on the processor to be shutdown. |
108 | */ | 168 | */ |