diff mbox series

[3.16-stable,74/87] ARM: 8383/1: nommu: avoid deprecated source register on mov

Message ID 20170505194745.3627137-75-arnd@arndb.de
State New
Headers show
Series build warnings and errors | expand

Commit Message

Arnd Bergmann May 5, 2017, 7:47 p.m. UTC
From: Stefan Agner <stefan@agner.ch>


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 <mcoquelin.stm32@gmail.com>

Signed-off-by: Stefan Agner <stefan@agner.ch>

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 arch/arm/kernel/head-nommu.S | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

-- 
2.9.0

Comments

Arnd Bergmann May 6, 2017, 9:45 a.m. UTC | #1
On Fri, May 5, 2017 at 9:47 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> @@ -164,7 +158,11 @@ __after_proc_init:

>  #endif

>         mcr     p15, 0, r0, c1, c0, 0           @ write control reg

>  #endif /* CONFIG_CPU_CP15 */

> +<<<<<<< HEAD

>         mov     pc, r13

> +=======

> +       ret     lr

> +>>>>>>> 12ebe5ca67dc... ARM: 8383/1: nommu: avoid deprecated source register on mov

>  ENDPROC(__after_proc_init)

>         .ltorg

>


This was evidently crap, please ignore this patch.

       Arnd
Russell King (Oracle) May 6, 2017, 10:06 a.m. UTC | #2
On Sat, May 06, 2017 at 11:45:13AM +0200, Arnd Bergmann wrote:
> On Fri, May 5, 2017 at 9:47 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> 

> > @@ -164,7 +158,11 @@ __after_proc_init:

> >  #endif

> >         mcr     p15, 0, r0, c1, c0, 0           @ write control reg

> >  #endif /* CONFIG_CPU_CP15 */

> > +<<<<<<< HEAD

> >         mov     pc, r13

> > +=======

> > +       ret     lr

> > +>>>>>>> 12ebe5ca67dc... ARM: 8383/1: nommu: avoid deprecated source register on mov

> >  ENDPROC(__after_proc_init)

> >         .ltorg

> >

> 

> This was evidently crap, please ignore this patch.


Maybe a commit hook that checks the files to be committed for unresolved
conflicts may help avoid this?  Maybe something like this (untested) in
.git/hooks/pre-commit?

#!/bin/sh
if git diff-index -u HEAD | grep -nv '^\+\(<<<<<<<\|=======\|>>>>>>>\)'; then
   echo "Your files appear to contain unresolved merges, please fix," >&2
   echo "or override with git commit --no-verify" >&2
   exit 1
fi

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
Arnd Bergmann May 8, 2017, 7:53 p.m. UTC | #3
On Sat, May 6, 2017 at 12:06 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Sat, May 06, 2017 at 11:45:13AM +0200, Arnd Bergmann wrote:

>> On Fri, May 5, 2017 at 9:47 PM, Arnd Bergmann <arnd@arndb.de> wrote:

>>

>> > @@ -164,7 +158,11 @@ __after_proc_init:

>> >  #endif

>> >         mcr     p15, 0, r0, c1, c0, 0           @ write control reg

>> >  #endif /* CONFIG_CPU_CP15 */

>> > +<<<<<<< HEAD

>> >         mov     pc, r13

>> > +=======

>> > +       ret     lr

>> > +>>>>>>> 12ebe5ca67dc... ARM: 8383/1: nommu: avoid deprecated source register on mov

>> >  ENDPROC(__after_proc_init)

>> >         .ltorg

>> >

>>

>> This was evidently crap, please ignore this patch.

>

> Maybe a commit hook that checks the files to be committed for unresolved

> conflicts may help avoid this?  Maybe something like this (untested) in

> .git/hooks/pre-commit?

>

> #!/bin/sh

> if git diff-index -u HEAD | grep -nv '^\+\(<<<<<<<\|=======\|>>>>>>>\)'; then

>    echo "Your files appear to contain unresolved merges, please fix," >&2

>    echo "or override with git commit --no-verify" >&2

>    exit 1

> fi


Good idea. It was almost right, 'grep -q' (without -v) did it, and I've
added that now. Thanks,

      Arnd
diff mbox series

Patch

diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 716249cc2ee1..db0c82f4a99b 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(	mov	pc, 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(	mov	pc, 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,11 @@  __after_proc_init:
 #endif
 	mcr	p15, 0, r0, c1, c0, 0		@ write control reg
 #endif /* CONFIG_CPU_CP15 */
+<<<<<<< HEAD
 	mov	pc, r13
+=======
+	ret	lr
+>>>>>>> 12ebe5ca67dc... ARM: 8383/1: nommu: avoid deprecated source register on mov
 ENDPROC(__after_proc_init)
 	.ltorg