Re: [PATCH stable/4.0.y] ARM: 8325/1: exynos: move resume code to .text section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15 June 2015 at 01:13, Ben Hutchings <ben@xxxxxxxxxxxxxxx> wrote:
> On Tue, 2015-06-02 at 19:42 -0700, Kevin Hilman wrote:
>> From: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
>>
>> This code calls cpu_resume() using a straight branch (b), so
>> now that we have moved cpu_resume() back to .text, this should
>> be moved there as well. Any direct references to symbols that will
>> remain in the .data section are replaced with explicit PC-relative
>> references.
>
> I don't get it.  cpu_resume() is still in the .data section in 4.0.
> This appears to depend on:
>
> commit d0776aff9a38b1390cc06ffc2c4dcf6ece7c05b9
> Author: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
> Date:   Wed Mar 25 07:39:21 2015 +0100
>
>     ARM: 8324/1: move cpu_resume() to .text section
>

You are right. So this patch results in the Exynos resume function to
call cpu_resume() in .data from the .text section. This turns out to
work fine for normal configs (exynos_defconfig, multi_v7_defconfig)
built for ARM since the distance is < 16 MB, and -apparently- fixes an
issue Kevin spotted with the Thumb build on top of that. Whether
cpu_resume() may now be out of Thumb range (8 MB) in some configs is
irrelevant since the Thumb build was broken in the first place.

-- 
Ard.



>> Acked-by: Nicolas Pitre <nico@xxxxxxxxxx>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
>> Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
>> (cherry picked from commit 12833bacf5d904c2dac0c3f52b2ebde5f2c5a2bc)
>> Cc: <stable@xxxxxxxxxxxxxxx> # v4.0+
>> Signed-off-by: Kevin Hilman <khilman@xxxxxxxxxx>
>> ---
>> This fixes compile errors on stable/linux-4.0.y when building for ARM
>> using multi_v7_defconfig + CONFIG_THUMB2_KERNEL=y:
>>
>> ../arch/arm/mach-exynos/sleep.S:72: Error: invalid immediate for address calculation (value = 0x00000004)
>> ../arch/arm/mach-exynos/sleep.S:74: Error: invalid immediate for address calculation (value = 0x00000004)
>>
>>  arch/arm/mach-exynos/sleep.S | 31 ++++++++++++++++---------------
>>  1 file changed, 16 insertions(+), 15 deletions(-)
>>
>> diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S
>> index 31d25834b9c4..cf950790fbdc 100644
>> --- a/arch/arm/mach-exynos/sleep.S
>> +++ b/arch/arm/mach-exynos/sleep.S
>> @@ -23,14 +23,7 @@
>>  #define CPU_MASK     0xff0ffff0
>>  #define CPU_CORTEX_A9        0x410fc090
>>
>> -     /*
>> -      * The following code is located into the .data section. This is to
>> -      * allow l2x0_regs_phys to be accessed with a relative load while we
>> -      * can't rely on any MMU translation. We could have put l2x0_regs_phys
>> -      * in the .text section as well, but some setups might insist on it to
>> -      * be truly read-only. (Reference from: arch/arm/kernel/sleep.S)
>> -      */
>> -     .data
>> +     .text
>>       .align
>>
>>       /*
>> @@ -69,10 +62,12 @@ ENTRY(exynos_cpu_resume_ns)
>>       cmp     r0, r1
>>       bne     skip_cp15
>>
>> -     adr     r0, cp15_save_power
>> +     adr     r0, _cp15_save_power
>>       ldr     r1, [r0]
>> -     adr     r0, cp15_save_diag
>> +     ldr     r1, [r0, r1]
>> +     adr     r0, _cp15_save_diag
>>       ldr     r2, [r0]
>> +     ldr     r2, [r0, r2]
>>       mov     r0, #SMC_CMD_C15RESUME
>>       dsb
>>       smc     #0
>> @@ -118,14 +113,20 @@ skip_l2x0:
>>  skip_cp15:
>>       b       cpu_resume
>>  ENDPROC(exynos_cpu_resume_ns)
>> +
>> +     .align
>> +_cp15_save_power:
>> +     .long   cp15_save_power - .
>> +_cp15_save_diag:
>> +     .long   cp15_save_diag - .
>> +#ifdef CONFIG_CACHE_L2X0
>> +1:   .long   l2x0_saved_regs - .
>> +#endif /* CONFIG_CACHE_L2X0 */
>> +
>> +     .data
>>       .globl cp15_save_diag
>>  cp15_save_diag:
>>       .long   0       @ cp15 diagnostic
>>       .globl cp15_save_power
>>  cp15_save_power:
>>       .long   0       @ cp15 power control
>> -
>> -#ifdef CONFIG_CACHE_L2X0
>> -     .align
>> -1:   .long   l2x0_saved_regs - .
>> -#endif /* CONFIG_CACHE_L2X0 */
>
> --
> Ben Hutchings
> Never put off till tomorrow what you can avoid all together.
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]