mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
[linux/fpc-iii.git] / arch / arm / mach-oxnas / hotplug.c
blob854f29b8cba6e795b9f1ff45c389b2f49aea231f
1 /*
2 * Copyright (C) 2002 ARM Ltd.
3 * All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9 #include <linux/kernel.h>
10 #include <linux/errno.h>
11 #include <linux/smp.h>
13 #include <asm/cp15.h>
14 #include <asm/smp_plat.h>
16 static inline void cpu_enter_lowpower(void)
18 unsigned int v;
20 asm volatile(
21 " mcr p15, 0, %1, c7, c5, 0\n"
22 " mcr p15, 0, %1, c7, c10, 4\n"
24 * Turn off coherency
26 " mrc p15, 0, %0, c1, c0, 1\n"
27 " bic %0, %0, #0x20\n"
28 " mcr p15, 0, %0, c1, c0, 1\n"
29 " mrc p15, 0, %0, c1, c0, 0\n"
30 " bic %0, %0, %2\n"
31 " mcr p15, 0, %0, c1, c0, 0\n"
32 : "=&r" (v)
33 : "r" (0), "Ir" (CR_C)
34 : "cc");
37 static inline void cpu_leave_lowpower(void)
39 unsigned int v;
41 asm volatile( "mrc p15, 0, %0, c1, c0, 0\n"
42 " orr %0, %0, %1\n"
43 " mcr p15, 0, %0, c1, c0, 0\n"
44 " mrc p15, 0, %0, c1, c0, 1\n"
45 " orr %0, %0, #0x20\n"
46 " mcr p15, 0, %0, c1, c0, 1\n"
47 : "=&r" (v)
48 : "Ir" (CR_C)
49 : "cc");
52 static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
55 * there is no power-control hardware on this platform, so all
56 * we can do is put the core into WFI; this is safe as the calling
57 * code will have already disabled interrupts
59 for (;;) {
61 * here's the WFI
63 asm(".word 0xe320f003\n"
66 : "memory", "cc");
68 if (pen_release == cpu_logical_map(cpu)) {
70 * OK, proper wakeup, we're done
72 break;
76 * Getting here, means that we have come out of WFI without
77 * having been woken up - this shouldn't happen
79 * Just note it happening - when we're woken, we can report
80 * its occurrence.
82 (*spurious)++;
87 * platform-specific code to shutdown a CPU
89 * Called with IRQs disabled
91 void ox820_cpu_die(unsigned int cpu)
93 int spurious = 0;
96 * we're ready for shutdown now, so do it
98 cpu_enter_lowpower();
99 platform_do_lowpower(cpu, &spurious);
102 * bring this CPU back into the world of cache
103 * coherency, and then restore interrupts
105 cpu_leave_lowpower();
107 if (spurious)
108 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);