aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-04-26 05:49:58 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-04-26 05:49:58 -0400
commit9715b8c7d55912fb6f5dd9b1c084d8eefcd0d848 (patch)
treea98a752ea797ddd241a10c9100bff91bc1f37f2f
parent7acb59eb4b5eee113eb74eeafd1e6536171eeced (diff)
sh: provide percpu CPU states for hotplug notifiers.
This provides percpu CPU states in preparation for CPU hotplug and the associated notifier chains. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/include/asm/smp.h3
-rw-r--r--arch/sh/kernel/smp.c14
2 files changed, 13 insertions, 4 deletions
diff --git a/arch/sh/include/asm/smp.h b/arch/sh/include/asm/smp.h
index 7f13d46ec8d7..da5135b2579e 100644
--- a/arch/sh/include/asm/smp.h
+++ b/arch/sh/include/asm/smp.h
@@ -10,6 +10,7 @@
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <asm/atomic.h> 11#include <asm/atomic.h>
12#include <asm/current.h> 12#include <asm/current.h>
13#include <asm/percpu.h>
13 14
14#define raw_smp_processor_id() (current_thread_info()->cpu) 15#define raw_smp_processor_id() (current_thread_info()->cpu)
15 16
@@ -30,6 +31,8 @@ enum {
30 SMP_MSG_NR, /* must be last */ 31 SMP_MSG_NR, /* must be last */
31}; 32};
32 33
34DECLARE_PER_CPU(int, cpu_state);
35
33void smp_message_recv(unsigned int msg); 36void smp_message_recv(unsigned int msg);
34void smp_timer_broadcast(const struct cpumask *mask); 37void smp_timer_broadcast(const struct cpumask *mask);
35 38
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index cc87830ace7f..4d27597c5da8 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -33,6 +33,9 @@ int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
33 33
34struct plat_smp_ops *mp_ops = NULL; 34struct plat_smp_ops *mp_ops = NULL;
35 35
36/* State of each CPU */
37DEFINE_PER_CPU(int, cpu_state) = { 0 };
38
36void __cpuinit register_smp_ops(struct plat_smp_ops *ops) 39void __cpuinit register_smp_ops(struct plat_smp_ops *ops)
37{ 40{
38 if (mp_ops) 41 if (mp_ops)
@@ -72,11 +75,13 @@ void __devinit smp_prepare_boot_cpu(void)
72 75
73 set_cpu_online(cpu, true); 76 set_cpu_online(cpu, true);
74 set_cpu_possible(cpu, true); 77 set_cpu_possible(cpu, true);
78
79 per_cpu(cpu_state, cpu) = CPU_ONLINE;
75} 80}
76 81
77asmlinkage void __cpuinit start_secondary(void) 82asmlinkage void __cpuinit start_secondary(void)
78{ 83{
79 unsigned int cpu; 84 unsigned int cpu = smp_processor_id();
80 struct mm_struct *mm = &init_mm; 85 struct mm_struct *mm = &init_mm;
81 86
82 enable_mmu(); 87 enable_mmu();
@@ -90,12 +95,10 @@ asmlinkage void __cpuinit start_secondary(void)
90 95
91 preempt_disable(); 96 preempt_disable();
92 97
93 notify_cpu_starting(smp_processor_id()); 98 notify_cpu_starting(cpu);
94 99
95 local_irq_enable(); 100 local_irq_enable();
96 101
97 cpu = smp_processor_id();
98
99 /* Enable local timers */ 102 /* Enable local timers */
100 local_timer_setup(cpu); 103 local_timer_setup(cpu);
101 calibrate_delay(); 104 calibrate_delay();
@@ -103,6 +106,7 @@ asmlinkage void __cpuinit start_secondary(void)
103 smp_store_cpu_info(cpu); 106 smp_store_cpu_info(cpu);
104 107
105 set_cpu_online(cpu, true); 108 set_cpu_online(cpu, true);
109 per_cpu(cpu_state, cpu) = CPU_ONLINE;
106 110
107 cpu_idle(); 111 cpu_idle();
108} 112}
@@ -127,6 +131,8 @@ int __cpuinit __cpu_up(unsigned int cpu)
127 return PTR_ERR(tsk); 131 return PTR_ERR(tsk);
128 } 132 }
129 133
134 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
135
130 /* Fill in data in head.S for secondary cpus */ 136 /* Fill in data in head.S for secondary cpus */
131 stack_start.sp = tsk->thread.sp; 137 stack_start.sp = tsk->thread.sp;
132 stack_start.thread_info = tsk->stack; 138 stack_start.thread_info = tsk->stack;