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: 3843 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D1B3423F41 for ; Thu, 1 Sep 2011 14:52:22 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id BE044A18355 for ; Thu, 1 Sep 2011 14:52:22 +0000 (UTC) Received: by fxd18 with SMTP id 18so1091509fxd.11 for ; Thu, 01 Sep 2011 07:52:22 -0700 (PDT) Received: by 10.223.22.16 with SMTP id l16mr451624fab.62.1314888742559; Thu, 01 Sep 2011 07:52:22 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.11.8 with SMTP id m8cs55235lab; Thu, 1 Sep 2011 07:52:21 -0700 (PDT) Received: by 10.204.135.1 with SMTP id l1mr1123782bkt.270.1314888741225; Thu, 01 Sep 2011 07:52:21 -0700 (PDT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mx.google.com with ESMTP id z18si141924fah.201.2011.09.01.07.52.19; Thu, 01 Sep 2011 07:52:20 -0700 (PDT) Received-SPF: neutral (google.com: 212.227.126.171 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.126.171; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.227.126.171 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mail=arnd@arndb.de 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; ; ) Cc: Dave Martin , Nicolas Pitre , Kukjin Kim , Jon Medhurst , Ben Dooks , patches@linaro.org 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= 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