From patchwork Wed Apr 9 14:54:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Jensen X-Patchwork-Id: 3956021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C1169BFF02 for ; Wed, 9 Apr 2014 14:55:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0056205CB for ; Wed, 9 Apr 2014 14:55:14 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 060D2205C7 for ; Wed, 9 Apr 2014 14:55:14 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXttt-0004TM-Aq; Wed, 09 Apr 2014 14:54:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXttl-0005NZ-57; Wed, 09 Apr 2014 14:54:45 +0000 Received: from mail-ig0-x233.google.com ([2607:f8b0:4001:c05::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXtte-0005KO-DA for linux-arm-kernel@lists.infradead.org; Wed, 09 Apr 2014 14:54:40 +0000 Received: by mail-ig0-f179.google.com with SMTP id hl10so2509570igb.12 for ; Wed, 09 Apr 2014 07:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vqDDWd0ZMC8wKKAJAzzGY1D7NXz8o+Dqjm0OAhHmSgs=; b=CUsz/3kZpHLVLbYhJ26+Rh6pvjbTtNCfnLnyABiG7jkR+hcjN1kVkwK1nvZyTO08HI U42DUIWEeQiMX9bxRU6LNhRXAGU7CHSRpbLodXmzZRWdCit3FVTlMSPkrW3Yp0+lgiEz ihfHxsUnzX7NrVfsefqGFBjcYqtw/3NaBLjXEkn2QsVwpspKFUynVDyp5znfap+lRiTK t1ZwymSgLnol+lSs68ZyCW8vnW61MgUKCDFFgXo7sR8F24Gn60vU0wO4SBjux10XxbzN 9JRM3MWgaiqzyoNen8On2JS5t3ZJGGfCho/hYaZbw2hyJFPF6ZnrGlFOijHYbGfD6qvj +xFw== MIME-Version: 1.0 X-Received: by 10.50.78.201 with SMTP id d9mr4991374igx.17.1397055256703; Wed, 09 Apr 2014 07:54:16 -0700 (PDT) Received: by 10.50.104.136 with HTTP; Wed, 9 Apr 2014 07:54:16 -0700 (PDT) In-Reply-To: <20131213113903.GE4360@n2100.arm.linux.org.uk> References: <1386922149-4561-1-git-send-email-jonas.jensen@gmail.com> <20131213095655.GB4360@n2100.arm.linux.org.uk> <20131213113903.GE4360@n2100.arm.linux.org.uk> Date: Wed, 9 Apr 2014 16:54:16 +0200 Message-ID: Subject: Re: [PATCH] ARM: reinsert ARCH_MULTI_V4 Kconfig option From: Jonas Jensen To: Russell King - ARM Linux X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140409_105440_306235_21DED1AB X-CRM114-Status: GOOD ( 20.06 ) X-Spam-Score: -2.0 (--) Cc: Arnd Bergmann , ulli.kroll@googlemail.com, "linux-kernel@vger.kernel.org" , "arm@kernel.org" , u.kleine-koenig@pengutronix.de, Olof Johansson , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 13 December 2013 12:39, Russell King - ARM Linux wrote: > I see what's causing this: the kuser helpers are using "bx lr" to return > which will be undefined on non-Thumb CPUs. We generally cope fine with > non-Thumb CPUs, conditionalising where necessary on HWCAP_THUMB or the > T bit in the PSR being set. > > However, it looks like the kuser helpers got missed. As a check, please > look at arch/arm/kernel/entry-armv.S, find the line with: > > .macro usr_ret, reg > > and ensure that the mov pc, \reg case always gets used. Please report > back. Uwe and Arnd came up with a solution except it doesn't work when I test it. The suggested patch is: With this applied, and the following two possibilities in next-20140403: [1] ARCH_MULTI_V4 only (no CONFIG_ARM_THUMB) CONFIG_CPU_32v4=y [2] ARCH_MULTI_V4 and ARCH_MULTI_V4T CONFIG_ARM_THUMB=y CONFIG_CPU_32v4=y CONFIG_CPU_32v4T=y Booting a kernel with either option [1] or [2] yield the following results: [1] works [2] hangs after "[ 2.730000] Freeing unused kernel memory: 104K (c02f5000 - c030f000)" Any help why the moveq doesn't work would be much appreciated. The commit where this was tested: https://bitbucket.org/Kasreyn/linux-next/commits/48320cbe0d5a1fb6ada52cea9efd87c7712367cb Regards, Jonas diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 1879e8d..de15bfd 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -739,6 +739,18 @@ ENDPROC(__switch_to) .macro usr_ret, reg #ifdef CONFIG_ARM_THUMB + /* + * Having CONFIG_ARM_THUMB isn't a guarantee that the cpu has support + * for Thumb and so the bx instruction. Use a mov if the address to + * jump to is 32 bit aligned. (Note that this code is compiled in ARM + * mode, so this is the right test.) + */ +#if defined(CONFIG_CPU_32v4) + tst \reg, #3 + moveq pc, \reg + b . +#endif + bx \reg #else mov pc, \reg