aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-05-22 10:13:46 -0400
committerShawn Guo <shawn.guo@linaro.org>2012-06-07 09:47:32 -0400
commit602bf40971d7f9a1ec0b7ba2b7e6427849828651 (patch)
tree15eae3d2cd13220ed178d2c48924b159247bb81a /arch
parenteb5558dd46dab1e3023f052f99979b0e2bfd1b19 (diff)
ARM: imx6: exit coherency when shutting down a cpu
There is a system hang issue on imx6q which can easily be seen with running a cpu hotplug stress testing (hotplug secondary cores from user space via sysfs interface for thousands iterations). It turns out that the issue is caused by coherency of the cpu that is being shut down. When shutting down a cpu, we need to have the cpu exit coherency to prevent it from receiving cache, TLB, or BTB maintenance operations broadcast by other CPUs in the cluster. Copy cpu_enter_lowpower() and cpu_leave_lowpower() from mach-vexpress to have coherency properly handled in platform_cpu_die(), thus fix the issue. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: stable@kernel.org
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/hotplug.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 89493abd497..20ed2d56c1a 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/cp15.h>
15#include <mach/common.h> 16#include <mach/common.h>
16 17
17int platform_cpu_kill(unsigned int cpu) 18int platform_cpu_kill(unsigned int cpu)
@@ -19,6 +20,44 @@ int platform_cpu_kill(unsigned int cpu)
19 return 1; 20 return 1;
20} 21}
21 22
23static inline void cpu_enter_lowpower(void)
24{
25 unsigned int v;
26
27 flush_cache_all();
28 asm volatile(
29 "mcr p15, 0, %1, c7, c5, 0\n"
30 " mcr p15, 0, %1, c7, c10, 4\n"
31 /*
32 * Turn off coherency
33 */
34 " mrc p15, 0, %0, c1, c0, 1\n"
35 " bic %0, %0, %3\n"
36 " mcr p15, 0, %0, c1, c0, 1\n"
37 " mrc p15, 0, %0, c1, c0, 0\n"
38 " bic %0, %0, %2\n"
39 " mcr p15, 0, %0, c1, c0, 0\n"
40 : "=&r" (v)
41 : "r" (0), "Ir" (CR_C), "Ir" (0x40)
42 : "cc");
43}
44
45static inline void cpu_leave_lowpower(void)
46{
47 unsigned int v;
48
49 asm volatile(
50 "mrc p15, 0, %0, c1, c0, 0\n"
51 " orr %0, %0, %1\n"
52 " mcr p15, 0, %0, c1, c0, 0\n"
53 " mrc p15, 0, %0, c1, c0, 1\n"
54 " orr %0, %0, %2\n"
55 " mcr p15, 0, %0, c1, c0, 1\n"
56 : "=&r" (v)
57 : "Ir" (CR_C), "Ir" (0x40)
58 : "cc");
59}
60
22/* 61/*
23 * platform-specific code to shutdown a CPU 62 * platform-specific code to shutdown a CPU
24 * 63 *
@@ -26,9 +65,10 @@ int platform_cpu_kill(unsigned int cpu)
26 */ 65 */
27void platform_cpu_die(unsigned int cpu) 66void platform_cpu_die(unsigned int cpu)
28{ 67{
29 flush_cache_all(); 68 cpu_enter_lowpower();
30 imx_enable_cpu(cpu, false); 69 imx_enable_cpu(cpu, false);
31 cpu_do_idle(); 70 cpu_do_idle();
71 cpu_leave_lowpower();
32 72
33 /* We should never return from idle */ 73 /* We should never return from idle */
34 panic("cpu %d unexpectedly exit from shutdown\n", cpu); 74 panic("cpu %d unexpectedly exit from shutdown\n", cpu);