From patchwork Thu Nov 1 01:24:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yangfei (Felix)" X-Patchwork-Id: 1682971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 4E5AEDFB80 for ; Thu, 1 Nov 2012 01:29:21 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TTjYD-0000OJ-Fj; Thu, 01 Nov 2012 01:26:29 +0000 Received: from szxga02-in.huawei.com ([119.145.14.65]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TTjY7-0000Ld-6y for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2012 01:26:25 +0000 Received: from 172.24.2.119 (EHLO szxeml205-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id ARM34459; Thu, 01 Nov 2012 09:25:51 +0800 (CST) Received: from SZXEML425-HUB.china.huawei.com (10.72.61.33) by szxeml205-edg.china.huawei.com (172.24.2.58) with Microsoft SMTP Server (TLS) id 14.1.323.3; Thu, 1 Nov 2012 09:24:40 +0800 Received: from szxeml549-mbx.china.huawei.com ([169.254.1.57]) by szxeml425-hub.china.huawei.com ([10.72.61.33]) with mapi id 14.01.0323.003; Thu, 1 Nov 2012 09:24:38 +0800 From: "Yangfei (Felix)" To: Russell King , Kukjin Kim , Paul Mundt , Magnus Damm , "linux-arm-kernel@lists.infradead.org" , "linux-samsung-soc@vger.kernel.org" , "linux-sh@vger.kernel.org" Subject: [PATCH] ARM: Fix the "WFI" instruction opcode definition. Thread-Topic: [PATCH] ARM: Fix the "WFI" instruction opcode definition. Thread-Index: Ac23z6d/3tbLKIaaQtK80YZQCsebpQ== Date: Thu, 1 Nov 2012 01:24:38 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.135.72.226] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121031_212624_300494_5DCD2986 X-CRM114-Status: UNSURE ( 8.57 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "linux-kernel@vger.kernel.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The current "WFI" opcode definiton causes CPU hot-plug feature fails to work if the kernel is built with CONFIG_THUMB2_KERNEL/CONFIG_CPU_ENDIAN_BE8 being defined. An invalid instruction exception will be generated. Signed-off-by: yangfei.kernel@gmail.com --- arch/arm/mach-exynos/hotplug.c | 8 +++++++- arch/arm/mach-realview/hotplug.c | 8 +++++++- arch/arm/mach-shmobile/hotplug.c | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) -- diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index f4d7dd2..823a0e4 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c @@ -18,11 +18,17 @@ #include #include #include +#include #include #include "common.h" +/* + * Define opcode of the WFI instruction. + */ +#define __WFI __inst_arm_thumb16(0xe320f003, 0xbf30) + static inline void cpu_enter_lowpower(void) { unsigned int v; @@ -72,7 +78,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) /* * here's the WFI */ - asm(".word 0xe320f003\n" + asm(__WFI : : : "memory", "cc"); diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c index 53818e5..5271a1a 100644 --- a/arch/arm/mach-realview/hotplug.c +++ b/arch/arm/mach-realview/hotplug.c @@ -15,6 +15,12 @@ #include #include #include +#include + +/* + * Define opcode of the WFI instruction. + */ +#define __WFI __inst_arm_thumb16(0xe320f003, 0xbf30) static inline void cpu_enter_lowpower(void) { @@ -64,7 +70,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) /* * here's the WFI */ - asm(".word 0xe320f003\n" + asm(__WFI : : : "memory", "cc"); diff --git a/arch/arm/mach-shmobile/hotplug.c b/arch/arm/mach-shmobile/hotplug.c index b09a0bd..0d7b7d1 100644 --- a/arch/arm/mach-shmobile/hotplug.c +++ b/arch/arm/mach-shmobile/hotplug.c @@ -20,6 +20,12 @@ #include #include #include +#include + +/* + * Define opcode of the WFI instruction. + */ ++#define __WFI __inst_arm_thumb16(0xe320f003, 0xbf30) static cpumask_t dead_cpus; @@ -39,7 +45,7 @@ void shmobile_cpu_die(unsigned int cpu) /* * here's the WFI */ - asm(".word 0xe320f003\n" + asm(__WFI : : : "memory", "cc");