aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-04-20 09:05:56 -0400
committerThomas Gleixner <tglx@linutronix.de>2012-04-26 06:06:12 -0400
commitf0a2bc7e54bb51f64d4c2cd5942ba6018a13d762 (patch)
tree63f4a4d8e6a11e09996e631d884aa6208bdefbbf
parent2ec9415c71a1ddad969602e690a9c848b81256b3 (diff)
sparc: Use generic idle thread allocation
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Tested-by: David S. Miller <davem@davemloft.net> Link: http://lkml.kernel.org/r/20120420124558.055198736@linutronix.de
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/leon.h5
-rw-r--r--arch/sparc/kernel/leon_smp.c9
-rw-r--r--arch/sparc/kernel/smp_32.c10
-rw-r--r--arch/sparc/kernel/smp_64.c10
-rw-r--r--arch/sparc/kernel/sun4d_smp.c8
-rw-r--r--arch/sparc/kernel/sun4m_smp.c7
7 files changed, 18 insertions, 32 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 6c0683d3fcba..e417f35d5912 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -30,6 +30,7 @@ config SPARC
30 select USE_GENERIC_SMP_HELPERS if SMP 30 select USE_GENERIC_SMP_HELPERS if SMP
31 select GENERIC_PCI_IOMAP 31 select GENERIC_PCI_IOMAP
32 select HAVE_NMI_WATCHDOG if SPARC64 32 select HAVE_NMI_WATCHDOG if SPARC64
33 select GENERIC_SMP_IDLE_THREAD
33 34
34config SPARC32 35config SPARC32
35 def_bool !64BIT 36 def_bool !64BIT
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index a4e457f003ed..6a1585b52c49 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -315,6 +315,7 @@ struct leon2_cacheregs {
315#include <linux/interrupt.h> 315#include <linux/interrupt.h>
316 316
317struct device_node; 317struct device_node;
318struct task_struct;
318extern unsigned int leon_build_device_irq(unsigned int real_irq, 319extern unsigned int leon_build_device_irq(unsigned int real_irq,
319 irq_flow_handler_t flow_handler, 320 irq_flow_handler_t flow_handler,
320 const char *name, int do_ack); 321 const char *name, int do_ack);
@@ -344,7 +345,7 @@ extern int leon_smp_nrcpus(void);
344extern void leon_clear_profile_irq(int cpu); 345extern void leon_clear_profile_irq(int cpu);
345extern void leon_smp_done(void); 346extern void leon_smp_done(void);
346extern void leon_boot_cpus(void); 347extern void leon_boot_cpus(void);
347extern int leon_boot_one_cpu(int i); 348extern int leon_boot_one_cpu(int i, struct task_struct *);
348void leon_init_smp(void); 349void leon_init_smp(void);
349extern void cpu_idle(void); 350extern void cpu_idle(void);
350extern void init_IRQ(void); 351extern void init_IRQ(void);
@@ -380,7 +381,7 @@ extern int leon_ipi_irq;
380#define init_leon() do {} while (0) 381#define init_leon() do {} while (0)
381#define leon_smp_done() do {} while (0) 382#define leon_smp_done() do {} while (0)
382#define leon_boot_cpus() do {} while (0) 383#define leon_boot_cpus() do {} while (0)
383#define leon_boot_one_cpu(i) 1 384#define leon_boot_one_cpu(i, t) 1
384#define leon_init_smp() do {} while (0) 385#define leon_init_smp() do {} while (0)
385 386
386#endif /* !defined(CONFIG_SPARC_LEON) */ 387#endif /* !defined(CONFIG_SPARC_LEON) */
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 160cac9c4036..b34c93c351b6 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -204,16 +204,11 @@ void __init leon_boot_cpus(void)
204 204
205} 205}
206 206
207int __cpuinit leon_boot_one_cpu(int i) 207int __cpuinit leon_boot_one_cpu(int i, struct task_struct *idle)
208{ 208{
209
210 struct task_struct *p;
211 int timeout; 209 int timeout;
212 210
213 /* Cook up an idler for this guy. */ 211 current_set[i] = task_thread_info(idle);
214 p = fork_idle(i);
215
216 current_set[i] = task_thread_info(p);
217 212
218 /* See trampoline.S:leon_smp_cpu_startup for details... 213 /* See trampoline.S:leon_smp_cpu_startup for details...
219 * Initialize the contexts table 214 * Initialize the contexts table
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index 1f397ae11028..9028566b3cd6 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -413,8 +413,8 @@ void __init smp_prepare_boot_cpu(void)
413 413
414int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 414int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
415{ 415{
416 extern int __cpuinit smp4m_boot_one_cpu(int); 416 extern int __cpuinit smp4m_boot_one_cpu(int, struct task_struct *);
417 extern int __cpuinit smp4d_boot_one_cpu(int); 417 extern int __cpuinit smp4d_boot_one_cpu(int, struct task_struct *);
418 int ret=0; 418 int ret=0;
419 419
420 switch(sparc_cpu_model) { 420 switch(sparc_cpu_model) {
@@ -427,13 +427,13 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
427 BUG(); 427 BUG();
428 break; 428 break;
429 case sun4m: 429 case sun4m:
430 ret = smp4m_boot_one_cpu(cpu); 430 ret = smp4m_boot_one_cpu(cpu, tidle);
431 break; 431 break;
432 case sun4d: 432 case sun4d:
433 ret = smp4d_boot_one_cpu(cpu); 433 ret = smp4d_boot_one_cpu(cpu, tidle);
434 break; 434 break;
435 case sparc_leon: 435 case sparc_leon:
436 ret = leon_boot_one_cpu(cpu); 436 ret = leon_boot_one_cpu(cpu, tidle);
437 break; 437 break;
438 case sun4e: 438 case sun4e:
439 printk("SUN4E\n"); 439 printk("SUN4E\n");
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 2f9948c4107c..f591598d92f6 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -343,21 +343,17 @@ extern unsigned long sparc64_cpu_startup;
343 */ 343 */
344static struct thread_info *cpu_new_thread = NULL; 344static struct thread_info *cpu_new_thread = NULL;
345 345
346static int __cpuinit smp_boot_one_cpu(unsigned int cpu) 346static int __cpuinit smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle)
347{ 347{
348 unsigned long entry = 348 unsigned long entry =
349 (unsigned long)(&sparc64_cpu_startup); 349 (unsigned long)(&sparc64_cpu_startup);
350 unsigned long cookie = 350 unsigned long cookie =
351 (unsigned long)(&cpu_new_thread); 351 (unsigned long)(&cpu_new_thread);
352 struct task_struct *p;
353 void *descr = NULL; 352 void *descr = NULL;
354 int timeout, ret; 353 int timeout, ret;
355 354
356 p = fork_idle(cpu);
357 if (IS_ERR(p))
358 return PTR_ERR(p);
359 callin_flag = 0; 355 callin_flag = 0;
360 cpu_new_thread = task_thread_info(p); 356 cpu_new_thread = task_thread_info(idle);
361 357
362 if (tlb_type == hypervisor) { 358 if (tlb_type == hypervisor) {
363#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) 359#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
@@ -1229,7 +1225,7 @@ void __devinit smp_fill_in_sib_core_maps(void)
1229 1225
1230int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 1226int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
1231{ 1227{
1232 int ret = smp_boot_one_cpu(cpu); 1228 int ret = smp_boot_one_cpu(cpu, tidle);
1233 1229
1234 if (!ret) { 1230 if (!ret) {
1235 cpumask_set_cpu(cpu, &smp_commenced_mask); 1231 cpumask_set_cpu(cpu, &smp_commenced_mask);
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index 540b2fec09f0..4c11030dc1e8 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -127,18 +127,14 @@ void __init smp4d_boot_cpus(void)
127 local_flush_cache_all(); 127 local_flush_cache_all();
128} 128}
129 129
130int __cpuinit smp4d_boot_one_cpu(int i) 130int __cpuinit smp4d_boot_one_cpu(int i, struct task_struct *idle)
131{ 131{
132 unsigned long *entry = &sun4d_cpu_startup; 132 unsigned long *entry = &sun4d_cpu_startup;
133 struct task_struct *p;
134 int timeout; 133 int timeout;
135 int cpu_node; 134 int cpu_node;
136 135
137 cpu_find_by_instance(i, &cpu_node, NULL); 136 cpu_find_by_instance(i, &cpu_node, NULL);
138 /* Cook up an idler for this guy. */ 137 current_set[i] = task_thread_info(idle);
139 p = fork_idle(i);
140 current_set[i] = task_thread_info(p);
141
142 /* 138 /*
143 * Initialize the contexts table 139 * Initialize the contexts table
144 * Since the call to prom_startcpu() trashes the structure, 140 * Since the call to prom_startcpu() trashes the structure,
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index 02db9a0412ce..579427359d4f 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -91,18 +91,15 @@ void __init smp4m_boot_cpus(void)
91 local_flush_cache_all(); 91 local_flush_cache_all();
92} 92}
93 93
94int __cpuinit smp4m_boot_one_cpu(int i) 94int __cpuinit smp4m_boot_one_cpu(int i, struct task_struct *idle)
95{ 95{
96 unsigned long *entry = &sun4m_cpu_startup; 96 unsigned long *entry = &sun4m_cpu_startup;
97 struct task_struct *p;
98 int timeout; 97 int timeout;
99 int cpu_node; 98 int cpu_node;
100 99
101 cpu_find_by_mid(i, &cpu_node); 100 cpu_find_by_mid(i, &cpu_node);
101 current_set[i] = task_thread_info(idle);
102 102
103 /* Cook up an idler for this guy. */
104 p = fork_idle(i);
105 current_set[i] = task_thread_info(p);
106 /* See trampoline.S for details... */ 103 /* See trampoline.S for details... */
107 entry += ((i - 1) * 3); 104 entry += ((i - 1) * 3);
108 105