From patchwork Thu Apr 27 19:32:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9703395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41F0E602CC for ; Thu, 27 Apr 2017 19:32:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DFD128607 for ; Thu, 27 Apr 2017 19:32:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FBC92861E; Thu, 27 Apr 2017 19:32:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C47828607 for ; Thu, 27 Apr 2017 19:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=DpWTjJMUHrnKaR2fCzboWH1Kkrd0vqGdOQyxtNB0Huc=; b=Qm2 asNjxyccqT1XAX6892U/r8Ld7xYXsWYXYWih+02bjcaI/y6hS0BOjOhbuSpKp7wFl+sOhzwI2fajc /MK3wuY/tPXv08tqDiiyJRsttkHZgYOlgTbmzlo3QaW6xztcV44MWAv+dvJIlDj59+Qnm1NecQhhM cJCa9HyYZEbvu4IGc+36siR+LvZORS4KY7DVJleMoPb10gTyjl9SN2RebkqzUNonC7B+V3MEo7yOQ 7uuOKhb4XPGdskiCH5lz31s/AEbC3HvPlVvpaGdjGxBwcI+vPs9uCx9nQSgB9Hr8yYqLEkkmWuXUm 2bLp3RLQiVaWcYjp3p06DjMRuYVp5BQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d3p9b-00024g-3O; Thu, 27 Apr 2017 19:32:39 +0000 Received: from mout.kundenserver.de ([212.227.126.131]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d3p9Y-00022u-4y for linux-arm-kernel@lists.infradead.org; Thu, 27 Apr 2017 19:32:38 +0000 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MAHcX-1dF8jp3nQn-00BKAA; Thu, 27 Apr 2017 21:32:09 +0200 From: Arnd Bergmann To: gregkh@linuxfoundation.org Subject: [PATCH] [stable v3.18.y] ARM: 8383/1: nommu: avoid deprecated source register on mov Date: Thu, 27 Apr 2017 21:32:30 +0200 Message-Id: <20170427193230.2673449-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:ZbWbyTpnNnfce32d7qNS2CXlevovhUJpqQ+/jhZGkD4e6EZDccY a93OCM2WPOe4+E2Z9bLJXGbggYFW+Ejwesh+c5Z5m7fu2IAUpmH9GA7/lR/XG2xHw6m22j6 bOuaBm0V/YytD0zr1NbFw/YgQFxhooHtoZ9gHxigH3nAnZVLifk83YybfRwd9WCGzGjx2it QS1RVov6kPaAfd5U6w9PA== X-UI-Out-Filterresults: notjunk:1; V01:K0:bgfVIForssk=:uK9ioPkWx3LQw22IRIvjKg VlnuphDjjAFSwRXfmOuS0Wx4GxagWqMxcIX/s17aFUe9KvbiGPptRRhVQSSfW1sGfsIxMPAMZ UbBkReVAQAMVtlHex0vBeRPALHFiJyRrUKp2nyYDZwrV9I3BzKDDhfA1+YZOJxyjyXKfiHB01 mnYyl/98gotQHVGYeZ64xDCQf3Bj1wbcfQOSUdVO5lg+oG0oVNZPtpHEQcui+fF10ds9aIdEn 1tbdDeoXXwqLR69tS9IE8KDJsnjziRpAAA4i1DdXhxNIzMbHCZAYqXuJrTrBnm2BS47BKA3lH YAjc5vUSQgjngPFTEZoRNF2rw4JmucrydBDMyGQvf3p0Kqwh3nxgW2IdUkw0tnzO8JoYhx1ur MvfdjhF15UCiPldM4vtTzVwpbJlWR0cVZ69d59kR6x8RW8lCP4Yh5bapU3+726HPRBgqEL982 SGxewu3SV5EOAjYaGG67gzGxorNh6An5LNNc21+jVNP/AoVH1OX0yWNS24GSbt53kgOupYo3s oawQrBSYy78ROW7MdRi57ROGCLFT1afEk61XXIbcEzHcx8jNKt5oYtqkXV+5NagjAWaV/0zip m0FhMs8TnCbIpTxlelhV5QC3b9/lXptnNjWBjDHosQfTCaU7A1jreH/u9bqNH74Lc8mAVcH6O CovYySAqXUvHC52XjYKqCczhbkMXWFfnsnC2byosj5QSLCgIS0mC7LBvw6pXFEI53LPQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170427_123236_538355_39CCD2D7 X-CRM114-Status: GOOD ( 16.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Murzin , Alexandre TORGUE , Arnd Bergmann , Stefan Agner , Russell King , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Agner Commit 970d96f9a81b0dd83ddd8bce0e5e1ba31881c5f5 upstream. In Thumb2 mode, the stack register r13 is deprecated if the destination register is the program counter (r15). Similar to head.S, head-nommu.S uses r13 to store the return address used after configuring the CPU's CP15 register. However, since we do not enable a MMU, there will be no address switch and it is possible to use branch with link instruction to call __after_proc_init. Avoid using r13 completely by using bl to call __after_proc_init and get rid of __secondary_switched. Beside removing unnecessary complexity, this also fixes a compiler warning when compiling a !MMU kernel: Warning: Use of r13 as a source register is deprecated when r15 is the destination register. Tested-?by: Maxime Coquelin Signed-off-by: Stefan Agner Signed-off-by: Russell King Signed-off-by: Arnd Bergmann ---- I've backported this build fix to 3.18.y as the original patch did not apply cleanly. I rebased it one patch at a time, and each step was fairly straightforward, but I did not test it on hardware, so it would still be nice to have someone else look over the patch to see if I did something wrong. --- arch/arm/kernel/head-nommu.S | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S index cc176b67c134..c6c66dd4be89 100644 --- a/arch/arm/kernel/head-nommu.S +++ b/arch/arm/kernel/head-nommu.S @@ -77,13 +77,12 @@ ENTRY(stext) orr r6, r6, #(1 << MPU_RSR_EN) @ Set region enabled bit bl __setup_mpu #endif - ldr r13, =__mmap_switched @ address to jump to after - @ initialising sctlr adr lr, BSYM(1f) @ return (PIC) address ARM( add pc, r10, #PROCINFO_INITFUNC ) THUMB( add r12, r10, #PROCINFO_INITFUNC ) THUMB( ret r12 ) - 1: b __after_proc_init +1: bl __after_proc_init + b __mmap_switched ENDPROC(stext) #ifdef CONFIG_SMP @@ -106,8 +105,7 @@ ENTRY(secondary_startup) movs r10, r5 @ invalid processor? beq __error_p @ yes, error 'p' - adr r4, __secondary_data - ldmia r4, {r7, r12} + ldr r7, __secondary_data #ifdef CONFIG_ARM_MPU /* Use MPU region info supplied by __cpu_up */ @@ -115,23 +113,19 @@ ENTRY(secondary_startup) bl __setup_mpu @ Initialize the MPU #endif - adr lr, BSYM(__after_proc_init) @ return address - mov r13, r12 @ __secondary_switched address + adr lr, BSYM(1f) @ return (PIC) address ARM( add pc, r10, #PROCINFO_INITFUNC ) THUMB( add r12, r10, #PROCINFO_INITFUNC ) THUMB( ret r12 ) -ENDPROC(secondary_startup) - -ENTRY(__secondary_switched) +1: bl __after_proc_init ldr sp, [r7, #8] @ set up the stack pointer mov fp, #0 b secondary_start_kernel -ENDPROC(__secondary_switched) +ENDPROC(secondary_startup) .type __secondary_data, %object __secondary_data: .long secondary_data - .long __secondary_switched #endif /* CONFIG_SMP */ /* @@ -164,7 +158,7 @@ __after_proc_init: #endif mcr p15, 0, r0, c1, c0, 0 @ write control reg #endif /* CONFIG_CPU_CP15 */ - ret r13 + ret lr ENDPROC(__after_proc_init) .ltorg