diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-04-26 05:49:58 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-04-26 05:49:58 -0400 |
commit | 9715b8c7d55912fb6f5dd9b1c084d8eefcd0d848 (patch) | |
tree | a98a752ea797ddd241a10c9100bff91bc1f37f2f /arch/sh/kernel/smp.c | |
parent | 7acb59eb4b5eee113eb74eeafd1e6536171eeced (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>
Diffstat (limited to 'arch/sh/kernel/smp.c')
-rw-r--r-- | arch/sh/kernel/smp.c | 14 |
1 files changed, 10 insertions, 4 deletions
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 | ||
34 | struct plat_smp_ops *mp_ops = NULL; | 34 | struct plat_smp_ops *mp_ops = NULL; |
35 | 35 | ||
36 | /* State of each CPU */ | ||
37 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | ||
38 | |||
36 | void __cpuinit register_smp_ops(struct plat_smp_ops *ops) | 39 | void __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 | ||
77 | asmlinkage void __cpuinit start_secondary(void) | 82 | asmlinkage 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; |