From patchwork Thu Sep 1 14:52:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 1119422 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 p81Eqtfn016693 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 1 Sep 2011 14:53:16 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qz8dE-0000oh-FJ; Thu, 01 Sep 2011 14:52:40 +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 1Qz8dE-0004YP-1X; Thu, 01 Sep 2011 14:52:40 +0000 Received: from moutng.kundenserver.de ([212.227.126.171]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qz8dA-0004Xx-VF for linux-arm-kernel@lists.infradead.org; Thu, 01 Sep 2011 14:52:38 +0000 Received: from klappe2.localnet (deibp9eh1--blueice3n2.emea.ibm.com [195.212.29.180]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MKMnS-1QxUCU0wfm-001CjJ; Thu, 01 Sep 2011 16:52:16 +0200 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH 5/5] ARM: entry: Fix Thumb-2 undef handling for multi-CPU kernels Date: Thu, 1 Sep 2011 16:52:12 +0200 User-Agent: KMail/1.12.2 (Linux/2.6.37; KDE/4.3.2; x86_64; ; ) References: <1312971223-28165-1-git-send-email-dave.martin@linaro.org> <1312971223-28165-6-git-send-email-dave.martin@linaro.org> In-Reply-To: <1312971223-28165-6-git-send-email-dave.martin@linaro.org> MIME-Version: 1.0 Message-Id: <201109011652.12711.arnd@arndb.de> X-Provags-ID: V02:K0:Q0yqCUFAu22agRxMGScnmcbRKvfRWop2xolSQtutq5D VH4SrnC0pIeC4MM93/A2PXH9VnrNOplMm5rozLQ5qq4JWfPDTH naluFpvdfUQAElkEmlcMBBUasZybM8583MqvsCWMMvfZi7m5zY Ew+eBXYEnfHyPt28uxru2bsDJdnEyV9j0/cdYG/ilEsk8YJZww HRo3UkQr5kfBjhj34qamaFx8K9Qyn2VffUT6s+1gYG4+2a/GJj ywYb6zmQQ4aiahkDIZizkRH5svfrNxlUE1Z/hOp4BCGsatPjVq Ir64cJeXpWQapKto2jLr/LpaKJ75O++6sRQ/X5WE3/VutlpsO+ 8iwgdo/26qRgarPMd1Go= X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110901_105237_314322_CE233904 X-CRM114-Status: GOOD ( 18.38 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.171 listed in list.dnswl.org] Cc: Nicolas Pitre , Dave Martin , Kukjin Kim , patches@linaro.org, Jon Medhurst , Ben Dooks 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: , 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]); Thu, 01 Sep 2011 14:53:16 +0000 (UTC) On Wednesday 10 August 2011, Dave Martin wrote: > When v6 and >=v7 boards are supported in the same kernel, the > __und_usr code currently makes a build-time assumption that Thumb-2 > instructions occurring in userspace don't need to be supported. > Strictly speaking this is incorrect. > > This patch fixes the above case by doing a run-time check on the > CPU architecture in these cases. This only affects kernels which > support v6 and >=v7 CPUs together: plain v6 and plain v7 kernels > are unaffected. I think this patch broke random configurations (!THUMB2 && v7) for me: > @@ -439,7 +440,27 @@ __und_usr: > #endif > beq call_fpe > @ Thumb instruction > -#if __LINUX_ARM_ARCH__ >= 7 > +#if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7 > +/* > + * Thumb-2 instruction handling. Note that because pre-v6 and >= v6 platforms > + * can never be supported in a single kernel, this code is not applicable at > + * all when __LINUX_ARM_ARCH__ < 6. This allows simplifying assumptions to be > + * made about .arch directives. > + */ > +#if __LINUX_ARM_ARCH__ < 7 > +/* If the target CPU may not be Thumb-2-capable, a run-time check is needed: */ > +#define NEED_CPU_ARCHITECTURE > + ldr r5, .LCcpu_architecture > + ldr r5, [r5] > + cmp r5, #CPU_ARCH_ARMv7 > + blo __und_usr_unknown > +/* > + * The following code won't get run unless the running CPU really is v7, so > + * coding round the lack of ldrht on older arches is pointless. Temporarily > + * override the assembler target arch with the minimum required instead: > + */ > + .arch armv6t2 > +#endif > 2: > ARM( ldrht r5, [r4], #2 ) This fixes it, please fold into the patch or apply on top. Arnd 8<--- ARM: entry: refix Fix Thumb-2 undef handling for multi-CPU kernels In some configurations labels become obsolete, so don't generate fixups for them. Signed-off-by: Arnd Bergmann diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 9ad50c4..b145f16 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -497,7 +497,7 @@ ENDPROC(__und_usr) .popsection .pushsection __ex_table,"a" .long 1b, 4b -#if __LINUX_ARM_ARCH__ >= 7 +#if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7 .long 2b, 4b .long 3b, 4b #endif