aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/smp.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2009-06-23 05:00:31 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-06-24 13:34:40 -0400
commit1b2bc75c1bde6581d2694cb3ed7fb06b69685008 (patch)
tree800fc23052bccb1fbf8acfbaabbf5648c69daa9e /arch/mips/kernel/smp.c
parent4ac4aa5cc3b00cc558575065ae71043e92d1a69a (diff)
MIPS: Add arch generic CPU hotplug
Each platform has to add support for CPU hotplugging itself by providing suitable definitions for the cpu_disable and cpu_die of the smp_ops methods and setting SYS_SUPPORTS_HOTPLUG_CPU. A platform should only set SYS_SUPPORTS_HOTPLUG_CPU once all it's smp_ops definitions have the necessary changes. This patch contains the changes to the dummy smp_ops definition for uni-processor systems. Parts of the code contributed by Cavium Inc. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/smp.c')
-rw-r--r--arch/mips/kernel/smp.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 58f4679bbd43..bc7d9b05e2f4 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -45,7 +45,7 @@
45#include <asm/mipsmtregs.h> 45#include <asm/mipsmtregs.h>
46#endif /* CONFIG_MIPS_MT_SMTC */ 46#endif /* CONFIG_MIPS_MT_SMTC */
47 47
48static volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ 48volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */
49int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ 49int __cpu_number_map[NR_CPUS]; /* Map physical to logical */
50int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ 50int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
51 51
@@ -201,6 +201,8 @@ void __devinit smp_prepare_boot_cpu(void)
201 * and keep control until "cpu_online(cpu)" is set. Note: cpu is 201 * and keep control until "cpu_online(cpu)" is set. Note: cpu is
202 * physical, not logical. 202 * physical, not logical.
203 */ 203 */
204static struct task_struct *cpu_idle_thread[NR_CPUS];
205
204int __cpuinit __cpu_up(unsigned int cpu) 206int __cpuinit __cpu_up(unsigned int cpu)
205{ 207{
206 struct task_struct *idle; 208 struct task_struct *idle;
@@ -210,9 +212,16 @@ int __cpuinit __cpu_up(unsigned int cpu)
210 * The following code is purely to make sure 212 * The following code is purely to make sure
211 * Linux can schedule processes on this slave. 213 * Linux can schedule processes on this slave.
212 */ 214 */
213 idle = fork_idle(cpu); 215 if (!cpu_idle_thread[cpu]) {
214 if (IS_ERR(idle)) 216 idle = fork_idle(cpu);
215 panic(KERN_ERR "Fork failed for CPU %d", cpu); 217 cpu_idle_thread[cpu] = idle;
218
219 if (IS_ERR(idle))
220 panic(KERN_ERR "Fork failed for CPU %d", cpu);
221 } else {
222 idle = cpu_idle_thread[cpu];
223 init_idle(idle, cpu);
224 }
216 225
217 mp_ops->boot_secondary(cpu, idle); 226 mp_ops->boot_secondary(cpu, idle);
218 227