diff mbox

[v2] ARM: vexpress: Use wfi macro in platform_do_lowpower.

Message ID 1314021259-31710-1-git-send-email-nbowler@elliptictech.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nick Bowler Aug. 22, 2011, 1:54 p.m. UTC
Current Versatile Express CPU hotplug code includes a hardcoded WFI
instruction, in ARM encoding.  When the kernel is compiled in Thumb-2
mode, this is invalid and causes the machine to hang hard when a CPU
is offlined.

Using the wfi macro (which uses the appropriate assembler mnemonic)
causes the correct instruction to be emitted in either case.  As a
consequence of this change, an apparently vestigial "cc" clobber is
dropped from the asm (the macro uses "memory" only).

Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
---
 arch/arm/mach-vexpress/hotplug.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

OK.  If this version is acceptable, I'll follow up with patches for the
other platforms.

Comments

Jamie Iles Aug. 22, 2011, 1:59 p.m. UTC | #1
On Mon, Aug 22, 2011 at 09:54:19AM -0400, Nick Bowler wrote:
> Current Versatile Express CPU hotplug code includes a hardcoded WFI
> instruction, in ARM encoding.  When the kernel is compiled in Thumb-2
> mode, this is invalid and causes the machine to hang hard when a CPU
> is offlined.
> 
> Using the wfi macro (which uses the appropriate assembler mnemonic)
> causes the correct instruction to be emitted in either case.  As a
> consequence of this change, an apparently vestigial "cc" clobber is
> dropped from the asm (the macro uses "memory" only).
> 
> Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
> ---

Reviewed-by: Jamie Iles <jamie@jamieiles.com>

if it helps!

Jamie
Nick Bowler Aug. 24, 2011, 5:51 p.m. UTC | #2
On 2011-08-22 14:59 +0100, Jamie Iles wrote:
> On Mon, Aug 22, 2011 at 09:54:19AM -0400, Nick Bowler wrote:
> > Current Versatile Express CPU hotplug code includes a hardcoded WFI
> > instruction, in ARM encoding.  When the kernel is compiled in Thumb-2
> > mode, this is invalid and causes the machine to hang hard when a CPU
> > is offlined.
> > 
> > Using the wfi macro (which uses the appropriate assembler mnemonic)
> > causes the correct instruction to be emitted in either case.  As a
> > consequence of this change, an apparently vestigial "cc" clobber is
> > dropped from the asm (the macro uses "memory" only).
> > 
> > Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
> > ---
> 
> Reviewed-by: Jamie Iles <jamie@jamieiles.com>
> 
> if it helps!

Thanks!

Since there seem to be no objections, I'll send this off to Russell's
tracker.

Cheers,
diff mbox

Patch

diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index ea4cbfb..3668cf9 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -13,6 +13,7 @@ 
 #include <linux/smp.h>
 
 #include <asm/cacheflush.h>
+#include <asm/system.h>
 
 extern volatile int pen_release;
 
@@ -62,13 +63,7 @@  static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
 	 * code will have already disabled interrupts
 	 */
 	for (;;) {
-		/*
-		 * here's the WFI
-		 */
-		asm(".word	0xe320f003\n"
-		    :
-		    :
-		    : "memory", "cc");
+		wfi();
 
 		if (pen_release == cpu) {
 			/*