aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2016-01-14 15:20:47 -0500
committerTony Lindgren <tony@atomide.com>2016-01-22 11:26:08 -0500
commiteeaf9646aca89d097861caa24d9818434e48810e (patch)
treec6df115725bc70de73955adfa226904b9b2904fa
parentd9db59103305eb5ec2a86369f32063e9921b6ac5 (diff)
ARM: OMAP2+: Fix l2dis_3630 for rodata
We don't want to write to .text section. Let's move l2dis_3630 to .data and access it via a pointer. For calculating the offset, let's optimize out the add and do it in ldr/str as suggested by Nicolas Pitre <nicolas.pitre@linaro.org>. Cc: Kees Cook <keescook@chromium.org> Cc: Laura Abbott <labbott@redhat.com> Cc: Nishanth Menon <nm@ti.com> Cc: Richard Woodruff <r-woodruff2@ti.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Tero Kristo <t-kristo@ti.com> Cc: stable@vger.kernel.org # v4.0+ Acked-by: Nicolas Pitre <nico@linaro.org> Cc: stable@vger.kernel.org # v4.0+ Fixes: 1e6b48116a95 ("ARM: mm: allow non-text sections to be non-executable") Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S17
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 787cfda7a9b3..5659d96b78d5 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -86,8 +86,9 @@ ENTRY(enable_omap3630_toggle_l2_on_restore)
86 stmfd sp!, {lr} @ save registers on stack 86 stmfd sp!, {lr} @ save registers on stack
87 /* Setup so that we will disable and enable l2 */ 87 /* Setup so that we will disable and enable l2 */
88 mov r1, #0x1 88 mov r1, #0x1
89 adrl r2, l2dis_3630 @ may be too distant for plain adr 89 adrl r3, l2dis_3630_offset @ may be too distant for plain adr
90 str r1, [r2] 90 ldr r2, [r3] @ value for offset
91 str r1, [r2, r3] @ write to l2dis_3630
91 ldmfd sp!, {pc} @ restore regs and return 92 ldmfd sp!, {pc} @ restore regs and return
92ENDPROC(enable_omap3630_toggle_l2_on_restore) 93ENDPROC(enable_omap3630_toggle_l2_on_restore)
93 94
@@ -415,7 +416,9 @@ ENTRY(omap3_restore)
415 cmp r2, #0x0 @ Check if target power state was OFF or RET 416 cmp r2, #0x0 @ Check if target power state was OFF or RET
416 bne logic_l1_restore 417 bne logic_l1_restore
417 418
418 ldr r0, l2dis_3630 419 adr r1, l2dis_3630_offset @ address for offset
420 ldr r0, [r1] @ value for offset
421 ldr r0, [r1, r0] @ value at l2dis_3630
419 cmp r0, #0x1 @ should we disable L2 on 3630? 422 cmp r0, #0x1 @ should we disable L2 on 3630?
420 bne skipl2dis 423 bne skipl2dis
421 mrc p15, 0, r0, c1, c0, 1 424 mrc p15, 0, r0, c1, c0, 1
@@ -484,7 +487,9 @@ l2_inv_gp:
484 mov r12, #0x2 487 mov r12, #0x2
485 smc #0 @ Call SMI monitor (smieq) 488 smc #0 @ Call SMI monitor (smieq)
486logic_l1_restore: 489logic_l1_restore:
487 ldr r1, l2dis_3630 490 adr r0, l2dis_3630_offset @ adress for offset
491 ldr r1, [r0] @ value for offset
492 ldr r1, [r0, r1] @ value at l2dis_3630
488 cmp r1, #0x1 @ Test if L2 re-enable needed on 3630 493 cmp r1, #0x1 @ Test if L2 re-enable needed on 3630
489 bne skipl2reen 494 bne skipl2reen
490 mrc p15, 0, r1, c1, c0, 1 495 mrc p15, 0, r1, c1, c0, 1
@@ -513,6 +518,10 @@ control_stat:
513 .word CONTROL_STAT 518 .word CONTROL_STAT
514control_mem_rta: 519control_mem_rta:
515 .word CONTROL_MEM_RTA_CTRL 520 .word CONTROL_MEM_RTA_CTRL
521l2dis_3630_offset:
522 .long l2dis_3630 - .
523
524 .data
516l2dis_3630: 525l2dis_3630:
517 .word 0 526 .word 0
518 527