From: jamie@jamieiles.com (Jamie Iles)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC] ARM: vexpress: Use assembler mnemonic for WFI in platform_do_lowpower.
Date: Fri, 19 Aug 2011 19:15:14 +0100 [thread overview]
Message-ID: <20110819181514.GA12654@gallagher> (raw)
In-Reply-To: <1313777004-4716-1-git-send-email-nbowler@elliptictech.com>
Hi Nick,
On Fri, Aug 19, 2011 at 02:03:24PM -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 assembler mnemonic instead of hardcoding it causes the correct
> instruction to be emitted in either case.
>
> Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
> ---
> arch/arm/mach-vexpress/hotplug.c | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
> OK. I assume that the reason for the hardcoded instruction is that
> older versions of binutils did not support the mnemonic. Looking at the
> binutils CVS history, support seems to have been added in 2005, and was
> included in the 2.16 release. If we care about those old assembler
> versions, I can resubmit this patch using ARM/THUMB macros instead,
> which should work just as well.
>
> I imagine that other platforms which use this same construct, such as
> realview, will have similar problems in thumb mode. I can't test
> changes on those platforms, unfortunately.
>
> diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
> index ea4cbfb..d6be197 100644
> --- a/arch/arm/mach-vexpress/hotplug.c
> +++ b/arch/arm/mach-vexpress/hotplug.c
> @@ -62,10 +62,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"
> + asm("wfi\n"
> :
> :
> : "memory", "cc");
There's a wfi() macro defined in arch/arm/include/asm/system.h that
could be used here.
Jamie
WARNING: multiple messages have this Message-ID (diff)
From: Jamie Iles <jamie@jamieiles.com>
To: Nick Bowler <nbowler@elliptictech.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Russell King <linux@arm.linux.org.uk>
Subject: Re: [PATCH RFC] ARM: vexpress: Use assembler mnemonic for WFI in platform_do_lowpower.
Date: Fri, 19 Aug 2011 19:15:14 +0100 [thread overview]
Message-ID: <20110819181514.GA12654@gallagher> (raw)
In-Reply-To: <1313777004-4716-1-git-send-email-nbowler@elliptictech.com>
Hi Nick,
On Fri, Aug 19, 2011 at 02:03:24PM -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 assembler mnemonic instead of hardcoding it causes the correct
> instruction to be emitted in either case.
>
> Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
> ---
> arch/arm/mach-vexpress/hotplug.c | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
> OK. I assume that the reason for the hardcoded instruction is that
> older versions of binutils did not support the mnemonic. Looking at the
> binutils CVS history, support seems to have been added in 2005, and was
> included in the 2.16 release. If we care about those old assembler
> versions, I can resubmit this patch using ARM/THUMB macros instead,
> which should work just as well.
>
> I imagine that other platforms which use this same construct, such as
> realview, will have similar problems in thumb mode. I can't test
> changes on those platforms, unfortunately.
>
> diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
> index ea4cbfb..d6be197 100644
> --- a/arch/arm/mach-vexpress/hotplug.c
> +++ b/arch/arm/mach-vexpress/hotplug.c
> @@ -62,10 +62,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"
> + asm("wfi\n"
> :
> :
> : "memory", "cc");
There's a wfi() macro defined in arch/arm/include/asm/system.h that
could be used here.
Jamie
next prev parent reply other threads:[~2011-08-19 18:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-19 18:03 [PATCH RFC] ARM: vexpress: Use assembler mnemonic for WFI in platform_do_lowpower Nick Bowler
2011-08-19 18:03 ` Nick Bowler
2011-08-19 18:15 ` Jamie Iles [this message]
2011-08-19 18:15 ` Jamie Iles
2011-08-19 19:26 ` Nick Bowler
2011-08-19 19:26 ` Nick Bowler
2011-08-19 21:14 ` Jamie Iles
2011-08-19 21:14 ` Jamie Iles
2011-08-22 9:43 ` Catalin Marinas
2011-08-22 9:43 ` Catalin Marinas
2011-08-22 13:54 ` [PATCH v2] ARM: vexpress: Use wfi macro " Nick Bowler
2011-08-22 13:54 ` Nick Bowler
2011-08-22 13:59 ` Jamie Iles
2011-08-22 13:59 ` Jamie Iles
2011-08-24 17:51 ` Nick Bowler
2011-08-24 17:51 ` Nick Bowler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110819181514.GA12654@gallagher \
--to=jamie@jamieiles.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.