Commit f0a2bc7e authored by Thomas Gleixner's avatar Thomas Gleixner

sparc: Use generic idle thread allocation

Signed-off-by: default avatarThomas 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: default avatarDavid S. Miller <davem@davemloft.net>
Link: http://lkml.kernel.org/r/20120420124558.055198736@linutronix.de
parent 2ec9415c
...@@ -30,6 +30,7 @@ config SPARC ...@@ -30,6 +30,7 @@ config SPARC
select USE_GENERIC_SMP_HELPERS if SMP select USE_GENERIC_SMP_HELPERS if SMP
select GENERIC_PCI_IOMAP select GENERIC_PCI_IOMAP
select HAVE_NMI_WATCHDOG if SPARC64 select HAVE_NMI_WATCHDOG if SPARC64
select GENERIC_SMP_IDLE_THREAD
config SPARC32 config SPARC32
def_bool !64BIT def_bool !64BIT
......
...@@ -315,6 +315,7 @@ struct leon2_cacheregs { ...@@ -315,6 +315,7 @@ struct leon2_cacheregs {
#include <linux/interrupt.h> #include <linux/interrupt.h>
struct device_node; struct device_node;
struct task_struct;
extern unsigned int leon_build_device_irq(unsigned int real_irq, extern unsigned int leon_build_device_irq(unsigned int real_irq,
irq_flow_handler_t flow_handler, irq_flow_handler_t flow_handler,
const char *name, int do_ack); const char *name, int do_ack);
...@@ -344,7 +345,7 @@ extern int leon_smp_nrcpus(void); ...@@ -344,7 +345,7 @@ extern int leon_smp_nrcpus(void);
extern void leon_clear_profile_irq(int cpu); extern void leon_clear_profile_irq(int cpu);
extern void leon_smp_done(void); extern void leon_smp_done(void);
extern void leon_boot_cpus(void); extern void leon_boot_cpus(void);
extern int leon_boot_one_cpu(int i); extern int leon_boot_one_cpu(int i, struct task_struct *);
void leon_init_smp(void); void leon_init_smp(void);
extern void cpu_idle(void); extern void cpu_idle(void);
extern void init_IRQ(void); extern void init_IRQ(void);
...@@ -380,7 +381,7 @@ extern int leon_ipi_irq; ...@@ -380,7 +381,7 @@ extern int leon_ipi_irq;
#define init_leon() do {} while (0) #define init_leon() do {} while (0)
#define leon_smp_done() do {} while (0) #define leon_smp_done() do {} while (0)
#define leon_boot_cpus() do {} while (0) #define leon_boot_cpus() do {} while (0)
#define leon_boot_one_cpu(i) 1 #define leon_boot_one_cpu(i, t) 1
#define leon_init_smp() do {} while (0) #define leon_init_smp() do {} while (0)
#endif /* !defined(CONFIG_SPARC_LEON) */ #endif /* !defined(CONFIG_SPARC_LEON) */
......
...@@ -204,16 +204,11 @@ void __init leon_boot_cpus(void) ...@@ -204,16 +204,11 @@ void __init leon_boot_cpus(void)
} }
int __cpuinit leon_boot_one_cpu(int i) int __cpuinit leon_boot_one_cpu(int i, struct task_struct *idle)
{ {
struct task_struct *p;
int timeout; int timeout;
/* Cook up an idler for this guy. */ current_set[i] = task_thread_info(idle);
p = fork_idle(i);
current_set[i] = task_thread_info(p);
/* See trampoline.S:leon_smp_cpu_startup for details... /* See trampoline.S:leon_smp_cpu_startup for details...
* Initialize the contexts table * Initialize the contexts table
......
...@@ -413,8 +413,8 @@ void __init smp_prepare_boot_cpu(void) ...@@ -413,8 +413,8 @@ void __init smp_prepare_boot_cpu(void)
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
{ {
extern int __cpuinit smp4m_boot_one_cpu(int); extern int __cpuinit smp4m_boot_one_cpu(int, struct task_struct *);
extern int __cpuinit smp4d_boot_one_cpu(int); extern int __cpuinit smp4d_boot_one_cpu(int, struct task_struct *);
int ret=0; int ret=0;
switch(sparc_cpu_model) { switch(sparc_cpu_model) {
...@@ -427,13 +427,13 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) ...@@ -427,13 +427,13 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
BUG(); BUG();
break; break;
case sun4m: case sun4m:
ret = smp4m_boot_one_cpu(cpu); ret = smp4m_boot_one_cpu(cpu, tidle);
break; break;
case sun4d: case sun4d:
ret = smp4d_boot_one_cpu(cpu); ret = smp4d_boot_one_cpu(cpu, tidle);
break; break;
case sparc_leon: case sparc_leon:
ret = leon_boot_one_cpu(cpu); ret = leon_boot_one_cpu(cpu, tidle);
break; break;
case sun4e: case sun4e:
printk("SUN4E\n"); printk("SUN4E\n");
......
...@@ -343,21 +343,17 @@ extern unsigned long sparc64_cpu_startup; ...@@ -343,21 +343,17 @@ extern unsigned long sparc64_cpu_startup;
*/ */
static struct thread_info *cpu_new_thread = NULL; static struct thread_info *cpu_new_thread = NULL;
static int __cpuinit smp_boot_one_cpu(unsigned int cpu) static int __cpuinit smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle)
{ {
unsigned long entry = unsigned long entry =
(unsigned long)(&sparc64_cpu_startup); (unsigned long)(&sparc64_cpu_startup);
unsigned long cookie = unsigned long cookie =
(unsigned long)(&cpu_new_thread); (unsigned long)(&cpu_new_thread);
struct task_struct *p;
void *descr = NULL; void *descr = NULL;
int timeout, ret; int timeout, ret;
p = fork_idle(cpu);
if (IS_ERR(p))
return PTR_ERR(p);
callin_flag = 0; callin_flag = 0;
cpu_new_thread = task_thread_info(p); cpu_new_thread = task_thread_info(idle);
if (tlb_type == hypervisor) { if (tlb_type == hypervisor) {
#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
...@@ -1229,7 +1225,7 @@ void __devinit smp_fill_in_sib_core_maps(void) ...@@ -1229,7 +1225,7 @@ void __devinit smp_fill_in_sib_core_maps(void)
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
{ {
int ret = smp_boot_one_cpu(cpu); int ret = smp_boot_one_cpu(cpu, tidle);
if (!ret) { if (!ret) {
cpumask_set_cpu(cpu, &smp_commenced_mask); cpumask_set_cpu(cpu, &smp_commenced_mask);
......
...@@ -127,18 +127,14 @@ void __init smp4d_boot_cpus(void) ...@@ -127,18 +127,14 @@ void __init smp4d_boot_cpus(void)
local_flush_cache_all(); local_flush_cache_all();
} }
int __cpuinit smp4d_boot_one_cpu(int i) int __cpuinit smp4d_boot_one_cpu(int i, struct task_struct *idle)
{ {
unsigned long *entry = &sun4d_cpu_startup; unsigned long *entry = &sun4d_cpu_startup;
struct task_struct *p;
int timeout; int timeout;
int cpu_node; int cpu_node;
cpu_find_by_instance(i, &cpu_node, NULL); cpu_find_by_instance(i, &cpu_node, NULL);
/* Cook up an idler for this guy. */ current_set[i] = task_thread_info(idle);
p = fork_idle(i);
current_set[i] = task_thread_info(p);
/* /*
* Initialize the contexts table * Initialize the contexts table
* Since the call to prom_startcpu() trashes the structure, * Since the call to prom_startcpu() trashes the structure,
......
...@@ -91,18 +91,15 @@ void __init smp4m_boot_cpus(void) ...@@ -91,18 +91,15 @@ void __init smp4m_boot_cpus(void)
local_flush_cache_all(); local_flush_cache_all();
} }
int __cpuinit smp4m_boot_one_cpu(int i) int __cpuinit smp4m_boot_one_cpu(int i, struct task_struct *idle)
{ {
unsigned long *entry = &sun4m_cpu_startup; unsigned long *entry = &sun4m_cpu_startup;
struct task_struct *p;
int timeout; int timeout;
int cpu_node; int cpu_node;
cpu_find_by_mid(i, &cpu_node); cpu_find_by_mid(i, &cpu_node);
current_set[i] = task_thread_info(idle);
/* Cook up an idler for this guy. */
p = fork_idle(i);
current_set[i] = task_thread_info(p);
/* See trampoline.S for details... */ /* See trampoline.S for details... */
entry += ((i - 1) * 3); entry += ((i - 1) * 3);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment