From patchwork Mon Oct 15 10:28:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yangfei (Felix)" X-Patchwork-Id: 1697861 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 E9460DF2AB for ; Mon, 5 Nov 2012 14:23:41 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TVNXZ-0001Li-Fy; Mon, 05 Nov 2012 14:20:38 +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 1TNhwA-0006wu-RI for linux-arm-kernel@lists.infradead.org; Mon, 15 Oct 2012 10:30:21 +0000 Received: from 172.24.2.119 (EHLO szxeml214-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id AQP12835; Mon, 15 Oct 2012 18:29:36 +0800 (CST) Received: from SZXEML417-HUB.china.huawei.com (10.82.67.156) by szxeml214-edg.china.huawei.com (172.24.2.29) with Microsoft SMTP Server (TLS) id 14.1.323.3; Mon, 15 Oct 2012 18:28:34 +0800 Received: from szxeml549-mbx.china.huawei.com ([169.254.1.26]) by szxeml417-hub.china.huawei.com ([10.82.67.156]) with mapi id 14.01.0323.003; Mon, 15 Oct 2012 18:28:23 +0800 From: "Yangfei (Felix)" To: Mikael Pettersson , "linux@arm.linux.org.uk" , "linux-arm-kernel@lists.infradead.org" Subject: =?gb2312?B?tPC4tDogSGFyZGNvZGVkIGluc3RydWN0aW9uIGNhdXNlcyBjZXJ0YWluIGZl?= =?gb2312?B?YXR1cmVzIHRvIGZhaWwgb24gQVJNIHBsYXRmcm9tIGR1ZSB0byBlbmRpYW5u?= =?gb2312?Q?ess?= Thread-Topic: Hardcoded instruction causes certain features to fail on ARM platfrom due to endianness Thread-Index: Ac2qh4xbYCm2qA8uSCiJR4GBLTZbOv//uBKA//9QANA= Date: Mon, 15 Oct 2012 10:28:22 +0000 Message-ID: References: <20603.47887.262025.941051@pilspetsen.it.uu.se> In-Reply-To: <20603.47887.262025.941051@pilspetsen.it.uu.se> 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-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.4 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] X-Mailman-Approved-At: Mon, 05 Nov 2012 09:14:27 -0500 Cc: "linux-hotplug@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Yangfei \(Felix\)" 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 Hi Mikael & Russell, Thanks for the suggestions. I tried to replace ".word" with ".inst" and the cpu-hotplug feature now works on big-endian (BE-8) ARM platform. And illegal instruction exception disappears. And the following is my small patch to fix the problem, Since ARM processor can be configured to work in BE-8 big-endian, I thinks this patch is necessary. Any suggestions is welcomed. Thanks Yangfei (Felix) writes: > Hi all, > > I found that hardcoded instruction in inline asm can cause certains certain features fail to work on ARM platform due to endianness. > As an example, consider the following code snippet of platform_do_lowpower function from arch/arm/mach-realview/hotplug.c: > / * > * here's the WFI > */ > asm(".word 0xe320f003\n" > : > : > : "memory", "cc"); > > The instruction generated from this inline asm will not work on big-endian ARM platform, such as ARM BE-8 format. Instead, an exception will be generated. > > Here the code should be: > / * > * here's the WFI > */ > asm("WFI\n" > : > : > : "memory", "cc"); > > Seems the kernel doesn't support ARM BE-8 well. I don't know why this problem happens. > Can anyone tell me who owns this part? I can prepare a patch then. > Thanks. Questions regarding the ARM kernel should go to the linux-arm-kernel mailing list (see the MAINTAINERS file), with an optional cc: to the regular LKML. BE-8 is, if I recall correctly, ARMv7's broken format where code and data have different endianess. GAS supports an ".inst" directive which is like ".word" except the data is assumed to be code. This matters for disassembly, and may also be required for BE-8. That is, just s/.word/.inst/g above and report back if that works or not. --- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff -urN linux-3.7-rc1/arch/arm/mach-exynos/hotplug.c linux/arch/arm/mach-exynos/hotplug.c --- linux-3.7-rc1/arch/arm/mach-exynos/hotplug.c 2012-10-15 05:41:04.000000000 +0800 +++ linux/arch/arm/mach-exynos/hotplug.c 2012-10-15 17:47:28.177103266 +0800 @@ -72,7 +72,7 @@ /* * here's the WFI */ - asm(".word 0xe320f003\n" + asm(".inst 0xe320f003\n" : : : "memory", "cc"); diff -urN linux-3.7-rc1/arch/arm/mach-realview/hotplug.c linux/arch/arm/mach-realview/hotplug.c --- linux-3.7-rc1/arch/arm/mach-realview/hotplug.c 2012-10-15 05:41:04.000000000 +0800 +++ linux/arch/arm/mach-realview/hotplug.c 2012-10-15 17:44:55.915942976 +0800 @@ -64,7 +64,7 @@ /* * here's the WFI */ - asm(".word 0xe320f003\n" + asm(".inst 0xe320f003\n" : : : "memory", "cc"); diff -urN linux-3.7-rc1/arch/arm/mach-shmobile/hotplug.c linux/arch/arm/mach-shmobile/hotplug.c --- linux-3.7-rc1/arch/arm/mach-shmobile/hotplug.c 2012-10-15 05:41:04.000000000 +0800 +++ linux/arch/arm/mach-shmobile/hotplug.c 2012-10-15 17:45:20.509879863 +0800 @@ -39,7 +39,7 @@ /* * here's the WFI */ - asm(".word 0xe320f003\n" + asm(".inst 0xe320f003\n" : : : "memory", "cc");