From patchwork Fri Aug 19 18:03:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Bowler X-Patchwork-Id: 1081612 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7JI4NSY011941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 19 Aug 2011 18:04:45 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QuTQG-0004dn-Fq; Fri, 19 Aug 2011 18:04:00 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QuTQG-0004gU-0G; Fri, 19 Aug 2011 18:04:00 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QuTQC-0004g9-VK for linux-arm-kernel@canuck.infradead.org; Fri, 19 Aug 2011 18:03:57 +0000 Received: from dsl-67-204-24-19.acanac.net ([67.204.24.19] helo=mail.ellipticsemi.com) by casper.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QuTQ9-0001zC-R0 for linux-arm-kernel@lists.infradead.org; Fri, 19 Aug 2011 18:03:55 +0000 Received: from nbowler by mail.ellipticsemi.com with local (Exim 4.76) (envelope-from ) id 1QuTPo-0001T6-UK; Fri, 19 Aug 2011 14:03:33 -0400 From: Nick Bowler To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC] ARM: vexpress: Use assembler mnemonic for WFI in platform_do_lowpower. Date: Fri, 19 Aug 2011 14:03:24 -0400 Message-Id: <1313777004-4716-1-git-send-email-nbowler@elliptictech.com> X-Mailer: git-send-email 1.7.3.4 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110819_190354_184922_11BFFC1D X-CRM114-Status: GOOD ( 13.64 ) X-Spam-Score: 4.8 (++++) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (4.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RCVD_IN_RP_RNBL RBL: Relay in RNBL, https://senderscore.org/blacklistlookup/ [67.204.24.19 listed in bl.score.senderscore.com] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 1.0 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 1.0 KHOP_DYNAMIC Relay looks like a dynamic address 2.0 FROM_12LTRDOM From a 12-letter domain 1.4 TO_NO_BRKTS_DYNIP To: misformatted and dynamic rDNS Cc: Russell King X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 19 Aug 2011 18:04:45 +0000 (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 assembler mnemonic instead of hardcoding it causes the correct instruction to be emitted in either case. Signed-off-by: Nick Bowler --- 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");