diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-06 17:31:35 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-06 17:32:03 -0500 |
commit | 4ec3eb13634529c0bc7466658d84d0bbe3244aea (patch) | |
tree | b491daac2ccfc7b8ca88e171a43f66888463568a /arch/arm/mach-realview/hotplug.c | |
parent | 24056f525051a9e186af28904b396320e18bf9a0 (diff) | |
parent | 15095bb0fe779c0403091bda7adce5fb3bb9ca35 (diff) |
Merge branch 'smp' into misc
Conflicts:
arch/arm/kernel/entry-armv.S
arch/arm/mm/ioremap.c
Diffstat (limited to 'arch/arm/mach-realview/hotplug.c')
-rw-r--r-- | arch/arm/mach-realview/hotplug.c | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c index f95521a5e5ce..a87523d095e6 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 | ||
18 | extern volatile int pen_release; | 17 | extern volatile int pen_release; |
19 | 18 | ||
20 | static DECLARE_COMPLETION(cpu_killed); | ||
21 | |||
22 | static inline void cpu_enter_lowpower(void) | 19 | static inline void cpu_enter_lowpower(void) |
23 | { | 20 | { |
24 | unsigned int v; | 21 | unsigned int v; |
@@ -34,10 +31,10 @@ static inline void cpu_enter_lowpower(void) | |||
34 | " bic %0, %0, #0x20\n" | 31 | " bic %0, %0, #0x20\n" |
35 | " mcr p15, 0, %0, c1, c0, 1\n" | 32 | " mcr p15, 0, %0, c1, c0, 1\n" |
36 | " mrc p15, 0, %0, c1, c0, 0\n" | 33 | " mrc p15, 0, %0, c1, c0, 0\n" |
37 | " bic %0, %0, #0x04\n" | 34 | " bic %0, %0, %2\n" |
38 | " mcr p15, 0, %0, c1, c0, 0\n" | 35 | " mcr p15, 0, %0, c1, c0, 0\n" |
39 | : "=&r" (v) | 36 | : "=&r" (v) |
40 | : "r" (0) | 37 | : "r" (0), "Ir" (CR_C) |
41 | : "cc"); | 38 | : "cc"); |
42 | } | 39 | } |
43 | 40 | ||
@@ -46,17 +43,17 @@ static inline void cpu_leave_lowpower(void) | |||
46 | unsigned int v; | 43 | unsigned int v; |
47 | 44 | ||
48 | asm volatile( "mrc p15, 0, %0, c1, c0, 0\n" | 45 | asm volatile( "mrc p15, 0, %0, c1, c0, 0\n" |
49 | " orr %0, %0, #0x04\n" | 46 | " orr %0, %0, %1\n" |
50 | " mcr p15, 0, %0, c1, c0, 0\n" | 47 | " mcr p15, 0, %0, c1, c0, 0\n" |
51 | " mrc p15, 0, %0, c1, c0, 1\n" | 48 | " mrc p15, 0, %0, c1, c0, 1\n" |
52 | " orr %0, %0, #0x20\n" | 49 | " orr %0, %0, #0x20\n" |
53 | " mcr p15, 0, %0, c1, c0, 1\n" | 50 | " mcr p15, 0, %0, c1, c0, 1\n" |
54 | : "=&r" (v) | 51 | : "=&r" (v) |
55 | : | 52 | : "Ir" (CR_C) |
56 | : "cc"); | 53 | : "cc"); |
57 | } | 54 | } |
58 | 55 | ||
59 | static inline void platform_do_lowpower(unsigned int cpu) | 56 | static inline void platform_do_lowpower(unsigned int cpu, int *spurious) |
60 | { | 57 | { |
61 | /* | 58 | /* |
62 | * there is no power-control hardware on this platform, so all | 59 | * there is no power-control hardware on this platform, so all |
@@ -80,22 +77,19 @@ static inline void platform_do_lowpower(unsigned int cpu) | |||
80 | } | 77 | } |
81 | 78 | ||
82 | /* | 79 | /* |
83 | * getting here, means that we have come out of WFI without | 80 | * Getting here, means that we have come out of WFI without |
84 | * having been woken up - this shouldn't happen | 81 | * having been woken up - this shouldn't happen |
85 | * | 82 | * |
86 | * The trouble is, letting people know about this is not really | 83 | * Just note it happening - when we're woken, we can report |
87 | * possible, since we are currently running incoherently, and | 84 | * its occurrence. |
88 | * therefore cannot safely call printk() or anything else | ||
89 | */ | 85 | */ |
90 | #ifdef DEBUG | 86 | (*spurious)++; |
91 | printk("CPU%u: spurious wakeup call\n", cpu); | ||
92 | #endif | ||
93 | } | 87 | } |
94 | } | 88 | } |
95 | 89 | ||
96 | int platform_cpu_kill(unsigned int cpu) | 90 | int platform_cpu_kill(unsigned int cpu) |
97 | { | 91 | { |
98 | return wait_for_completion_timeout(&cpu_killed, 5000); | 92 | return 1; |
99 | } | 93 | } |
100 | 94 | ||
101 | /* | 95 | /* |
@@ -105,30 +99,22 @@ int platform_cpu_kill(unsigned int cpu) | |||
105 | */ | 99 | */ |
106 | void platform_cpu_die(unsigned int cpu) | 100 | void platform_cpu_die(unsigned int cpu) |
107 | { | 101 | { |
108 | #ifdef DEBUG | 102 | int spurious = 0; |
109 | unsigned int this_cpu = hard_smp_processor_id(); | ||
110 | |||
111 | if (cpu != this_cpu) { | ||
112 | printk(KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n", | ||
113 | this_cpu, cpu); | ||
114 | BUG(); | ||
115 | } | ||
116 | #endif | ||
117 | |||
118 | printk(KERN_NOTICE "CPU%u: shutdown\n", cpu); | ||
119 | complete(&cpu_killed); | ||
120 | 103 | ||
121 | /* | 104 | /* |
122 | * we're ready for shutdown now, so do it | 105 | * we're ready for shutdown now, so do it |
123 | */ | 106 | */ |
124 | cpu_enter_lowpower(); | 107 | cpu_enter_lowpower(); |
125 | platform_do_lowpower(cpu); | 108 | platform_do_lowpower(cpu, &spurious); |
126 | 109 | ||
127 | /* | 110 | /* |
128 | * bring this CPU back into the world of cache | 111 | * bring this CPU back into the world of cache |
129 | * coherency, and then restore interrupts | 112 | * coherency, and then restore interrupts |
130 | */ | 113 | */ |
131 | cpu_leave_lowpower(); | 114 | cpu_leave_lowpower(); |
115 | |||
116 | if (spurious) | ||
117 | pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); | ||
132 | } | 118 | } |
133 | 119 | ||
134 | int platform_cpu_disable(unsigned int cpu) | 120 | int platform_cpu_disable(unsigned int cpu) |