aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-11-30 06:07:35 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-12-20 10:09:10 -0500
commit3c030beabf937b1d3b4ecaedfd1fb2f1e2aa0c70 (patch)
tree3cac64838c83ecc2d0d070be268fb087dffd8d4b /arch/arm
parent2c0136dba4e43b0916ccc9ecc7f11e6d6b73f046 (diff)
ARM: CPU hotplug: move cpu_killed completion to core code
We always need to wait for the dying CPU to reach a safe state before taking it down, irrespective of the requirements of the platform. Move the completion code into the ARM SMP hotplug code rather than having each platform re-implement this. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/kernel/smp.c14
-rw-r--r--arch/arm/mach-omap2/omap-hotplug.c8
-rw-r--r--arch/arm/mach-realview/hotplug.c8
-rw-r--r--arch/arm/mach-s5pv310/hotplug.c8
-rw-r--r--arch/arm/mach-tegra/hotplug.c8
-rw-r--r--arch/arm/mach-ux500/hotplug.c8
6 files changed, 19 insertions, 35 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index a30c4094db3a..8c81ff9b3732 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -24,6 +24,7 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/percpu.h> 25#include <linux/percpu.h>
26#include <linux/clockchips.h> 26#include <linux/clockchips.h>
27#include <linux/completion.h>
27 28
28#include <asm/atomic.h> 29#include <asm/atomic.h>
29#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
@@ -238,12 +239,20 @@ int __cpu_disable(void)
238 return 0; 239 return 0;
239} 240}
240 241
242static DECLARE_COMPLETION(cpu_died);
243
241/* 244/*
242 * called on the thread which is asking for a CPU to be shutdown - 245 * called on the thread which is asking for a CPU to be shutdown -
243 * waits until shutdown has completed, or it is timed out. 246 * waits until shutdown has completed, or it is timed out.
244 */ 247 */
245void __cpu_die(unsigned int cpu) 248void __cpu_die(unsigned int cpu)
246{ 249{
250 if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
251 pr_err("CPU%u: cpu didn't die\n", cpu);
252 return;
253 }
254 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
255
247 if (!platform_cpu_kill(cpu)) 256 if (!platform_cpu_kill(cpu))
248 printk("CPU%u: unable to kill\n", cpu); 257 printk("CPU%u: unable to kill\n", cpu);
249} 258}
@@ -263,9 +272,12 @@ void __ref cpu_die(void)
263 local_irq_disable(); 272 local_irq_disable();
264 idle_task_exit(); 273 idle_task_exit();
265 274
275 /* Tell __cpu_die() that this CPU is now safe to dispose of */
276 complete(&cpu_died);
277
266 /* 278 /*
267 * actual CPU shutdown procedure is at least platform (if not 279 * actual CPU shutdown procedure is at least platform (if not
268 * CPU) specific 280 * CPU) specific.
269 */ 281 */
270 platform_cpu_die(cpu); 282 platform_cpu_die(cpu);
271 283
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index 6cee456ca542..ace979d74bfc 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -17,16 +17,13 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/completion.h>
21 20
22#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
23#include <mach/omap4-common.h> 22#include <mach/omap4-common.h>
24 23
25static DECLARE_COMPLETION(cpu_killed);
26
27int platform_cpu_kill(unsigned int cpu) 24int platform_cpu_kill(unsigned int cpu)
28{ 25{
29 return wait_for_completion_timeout(&cpu_killed, 5000); 26 return 1;
30} 27}
31 28
32/* 29/*
@@ -42,8 +39,7 @@ void platform_cpu_die(unsigned int cpu)
42 this_cpu, cpu); 39 this_cpu, cpu);
43 BUG(); 40 BUG();
44 } 41 }
45 pr_notice("CPU%u: shutdown\n", cpu); 42
46 complete(&cpu_killed);
47 flush_cache_all(); 43 flush_cache_all();
48 dsb(); 44 dsb();
49 45
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index f95521a5e5ce..7d58c16c83a7 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -11,14 +11,11 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/completion.h>
15 14
16#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
17 16
18extern volatile int pen_release; 17extern volatile int pen_release;
19 18
20static DECLARE_COMPLETION(cpu_killed);
21
22static inline void cpu_enter_lowpower(void) 19static inline void cpu_enter_lowpower(void)
23{ 20{
24 unsigned int v; 21 unsigned int v;
@@ -95,7 +92,7 @@ static inline void platform_do_lowpower(unsigned int cpu)
95 92
96int platform_cpu_kill(unsigned int cpu) 93int platform_cpu_kill(unsigned int cpu)
97{ 94{
98 return wait_for_completion_timeout(&cpu_killed, 5000); 95 return 1;
99} 96}
100 97
101/* 98/*
@@ -115,9 +112,6 @@ void platform_cpu_die(unsigned int cpu)
115 } 112 }
116#endif 113#endif
117 114
118 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
119 complete(&cpu_killed);
120
121 /* 115 /*
122 * we're ready for shutdown now, so do it 116 * we're ready for shutdown now, so do it
123 */ 117 */
diff --git a/arch/arm/mach-s5pv310/hotplug.c b/arch/arm/mach-s5pv310/hotplug.c
index 03652c3605f6..d7be70ac7536 100644
--- a/arch/arm/mach-s5pv310/hotplug.c
+++ b/arch/arm/mach-s5pv310/hotplug.c
@@ -13,14 +13,11 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/completion.h>
17 16
18#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
19 18
20extern volatile int pen_release; 19extern volatile int pen_release;
21 20
22static DECLARE_COMPLETION(cpu_killed);
23
24static inline void cpu_enter_lowpower(void) 21static inline void cpu_enter_lowpower(void)
25{ 22{
26 unsigned int v; 23 unsigned int v;
@@ -98,7 +95,7 @@ static inline void platform_do_lowpower(unsigned int cpu)
98 95
99int platform_cpu_kill(unsigned int cpu) 96int platform_cpu_kill(unsigned int cpu)
100{ 97{
101 return wait_for_completion_timeout(&cpu_killed, 5000); 98 return 1;
102} 99}
103 100
104/* 101/*
@@ -118,9 +115,6 @@ void platform_cpu_die(unsigned int cpu)
118 } 115 }
119#endif 116#endif
120 117
121 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
122 complete(&cpu_killed);
123
124 /* 118 /*
125 * we're ready for shutdown now, so do it 119 * we're ready for shutdown now, so do it
126 */ 120 */
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index 8e7f115aa21e..ecaa41ce4976 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -11,12 +11,9 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/completion.h>
15 14
16#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
17 16
18static DECLARE_COMPLETION(cpu_killed);
19
20static inline void cpu_enter_lowpower(void) 17static inline void cpu_enter_lowpower(void)
21{ 18{
22 unsigned int v; 19 unsigned int v;
@@ -94,7 +91,7 @@ static inline void platform_do_lowpower(unsigned int cpu)
94 91
95int platform_cpu_kill(unsigned int cpu) 92int platform_cpu_kill(unsigned int cpu)
96{ 93{
97 return wait_for_completion_timeout(&cpu_killed, 5000); 94 return 1;
98} 95}
99 96
100/* 97/*
@@ -114,9 +111,6 @@ void platform_cpu_die(unsigned int cpu)
114 } 111 }
115#endif 112#endif
116 113
117 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
118 complete(&cpu_killed);
119
120 /* 114 /*
121 * we're ready for shutdown now, so do it 115 * we're ready for shutdown now, so do it
122 */ 116 */
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
index b782a03024be..7a4890b96e5c 100644
--- a/arch/arm/mach-ux500/hotplug.c
+++ b/arch/arm/mach-ux500/hotplug.c
@@ -11,14 +11,11 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/completion.h>
15 14
16#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
17 16
18extern volatile int pen_release; 17extern volatile int pen_release;
19 18
20static DECLARE_COMPLETION(cpu_killed);
21
22static inline void platform_do_lowpower(unsigned int cpu) 19static inline void platform_do_lowpower(unsigned int cpu)
23{ 20{
24 flush_cache_all(); 21 flush_cache_all();
@@ -38,7 +35,7 @@ static inline void platform_do_lowpower(unsigned int cpu)
38 35
39int platform_cpu_kill(unsigned int cpu) 36int platform_cpu_kill(unsigned int cpu)
40{ 37{
41 return wait_for_completion_timeout(&cpu_killed, 5000); 38 return 1;
42} 39}
43 40
44/* 41/*
@@ -58,9 +55,6 @@ void platform_cpu_die(unsigned int cpu)
58 } 55 }
59#endif 56#endif
60 57
61 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
62 complete(&cpu_killed);
63
64 /* directly enter low power state, skipping secure registers */ 58 /* directly enter low power state, skipping secure registers */
65 platform_do_lowpower(cpu); 59 platform_do_lowpower(cpu);
66} 60}