diff mbox series

[v1] ARM: tegra: Fix misplaced tegra_uart_config in decompressor

Message ID 20201215135222.6899-1-digetx@gmail.com
State Rejected
Headers show
Series [v1] ARM: tegra: Fix misplaced tegra_uart_config in decompressor | expand

Commit Message

Dmitry Osipenko Dec. 15, 2020, 1:52 p.m. UTC
The tegra_uart_config of the DEBUG_LL code is now placed right at the
start of the .text section after commit which enabled debug output in the
decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
since tegra_uart_config data is executes as a code. Fix the misplaced
tegra_uart_config storage by embedding it into the code.

Cc: stable@vger.kernel.org
Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 27 deletions(-)

Comments

Linus Walleij Dec. 15, 2020, 2:28 p.m. UTC | #1
On Tue, Dec 15, 2020 at 2:53 PM Dmitry Osipenko <digetx@gmail.com> wrote:

> The tegra_uart_config of the DEBUG_LL code is now placed right at the
> start of the .text section after commit which enabled debug output in the
> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
> since tegra_uart_config data is executes as a code. Fix the misplaced
> tegra_uart_config storage by embedding it into the code.
>
> Cc: stable@vger.kernel.org
> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

Aha I see the problem.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Please put this into Russell's patch tracker as a fix!

Yours,
Linus Walleij
Dmitry Osipenko Dec. 15, 2020, 3:20 p.m. UTC | #2
15.12.2020 17:28, Linus Walleij пишет:
> On Tue, Dec 15, 2020 at 2:53 PM Dmitry Osipenko <digetx@gmail.com> wrote:
> 
>> The tegra_uart_config of the DEBUG_LL code is now placed right at the
>> start of the .text section after commit which enabled debug output in the
>> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
>> since tegra_uart_config data is executes as a code. Fix the misplaced
>> tegra_uart_config storage by embedding it into the code.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> 
> Aha I see the problem.
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Please put this into Russell's patch tracker as a fix!

Thanks, I sent the patch to the tracker.
Florian Fainelli Dec. 15, 2020, 4:04 p.m. UTC | #3
On 12/15/2020 5:52 AM, Dmitry Osipenko wrote:
> The tegra_uart_config of the DEBUG_LL code is now placed right at the
> start of the .text section after commit which enabled debug output in the
> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
> since tegra_uart_config data is executes as a code. Fix the misplaced
> tegra_uart_config storage by embedding it into the code.
> 
> Cc: stable@vger.kernel.org
> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
>  1 file changed, 27 insertions(+), 27 deletions(-)

Looks like arch/arm/include/debug/brcmstb.S would need the same
treatment since the implementation was copied from tegra.S.
Dmitry Osipenko Dec. 15, 2020, 4:17 p.m. UTC | #4
15.12.2020 19:04, Florian Fainelli пишет:
> 
> 
> On 12/15/2020 5:52 AM, Dmitry Osipenko wrote:
>> The tegra_uart_config of the DEBUG_LL code is now placed right at the
>> start of the .text section after commit which enabled debug output in the
>> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
>> since tegra_uart_config data is executes as a code. Fix the misplaced
>> tegra_uart_config storage by embedding it into the code.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>  arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
>>  1 file changed, 27 insertions(+), 27 deletions(-)
> 
> Looks like arch/arm/include/debug/brcmstb.S would need the same
> treatment since the implementation was copied from tegra.S.
> 

Good catch, will you be able to test the brcm and make a patch?
Florian Fainelli Dec. 15, 2020, 4:40 p.m. UTC | #5
On 12/15/2020 8:17 AM, Dmitry Osipenko wrote:
> 15.12.2020 19:04, Florian Fainelli пишет:
>>
>>
>> On 12/15/2020 5:52 AM, Dmitry Osipenko wrote:
>>> The tegra_uart_config of the DEBUG_LL code is now placed right at the
>>> start of the .text section after commit which enabled debug output in the
>>> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
>>> since tegra_uart_config data is executes as a code. Fix the misplaced
>>> tegra_uart_config storage by embedding it into the code.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>> ---
>>>  arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
>>>  1 file changed, 27 insertions(+), 27 deletions(-)
>>
>> Looks like arch/arm/include/debug/brcmstb.S would need the same
>> treatment since the implementation was copied from tegra.S.
>>
> 
> Good catch, will you be able to test the brcm and make a patch?

Yes, absolutely, building a kernel to test right now.
Dmitry Osipenko Dec. 15, 2020, 4:53 p.m. UTC | #6
15.12.2020 19:40, Florian Fainelli пишет:
> 
> 
> On 12/15/2020 8:17 AM, Dmitry Osipenko wrote:
>> 15.12.2020 19:04, Florian Fainelli пишет:
>>>
>>>
>>> On 12/15/2020 5:52 AM, Dmitry Osipenko wrote:
>>>> The tegra_uart_config of the DEBUG_LL code is now placed right at the
>>>> start of the .text section after commit which enabled debug output in the
>>>> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
>>>> since tegra_uart_config data is executes as a code. Fix the misplaced
>>>> tegra_uart_config storage by embedding it into the code.
>>>>
>>>> Cc: stable@vger.kernel.org
>>>> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
>>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>>> ---
>>>>  arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
>>>>  1 file changed, 27 insertions(+), 27 deletions(-)
>>>
>>> Looks like arch/arm/include/debug/brcmstb.S would need the same
>>> treatment since the implementation was copied from tegra.S.
>>>
>>
>> Good catch, will you be able to test the brcm and make a patch?
> 
> Yes, absolutely, building a kernel to test right now.
> 

Thank you.

BTW, I noticed that the problem is more visible on a thumb2 kernel
build, i.e. you should get a more reliable hang on boot. On a non-thumb2
kernel the hanging behaviour seems depends on a device / bootloader. I
haven't tried to figure out what exactly makes the difference, perhaps
it should be a memory layout / state.
Florian Fainelli Dec. 15, 2020, 6:22 p.m. UTC | #7
On 12/15/2020 8:53 AM, Dmitry Osipenko wrote:
> 15.12.2020 19:40, Florian Fainelli пишет:
>>
>>
>> On 12/15/2020 8:17 AM, Dmitry Osipenko wrote:
>>> 15.12.2020 19:04, Florian Fainelli пишет:
>>>>
>>>>
>>>> On 12/15/2020 5:52 AM, Dmitry Osipenko wrote:
>>>>> The tegra_uart_config of the DEBUG_LL code is now placed right at the
>>>>> start of the .text section after commit which enabled debug output in the
>>>>> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
>>>>> since tegra_uart_config data is executes as a code. Fix the misplaced
>>>>> tegra_uart_config storage by embedding it into the code.
>>>>>
>>>>> Cc: stable@vger.kernel.org
>>>>> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
>>>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>>>> ---
>>>>>  arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
>>>>>  1 file changed, 27 insertions(+), 27 deletions(-)
>>>>
>>>> Looks like arch/arm/include/debug/brcmstb.S would need the same
>>>> treatment since the implementation was copied from tegra.S.
>>>>
>>>
>>> Good catch, will you be able to test the brcm and make a patch?
>>
>> Yes, absolutely, building a kernel to test right now.
>>
> 
> Thank you.
> 
> BTW, I noticed that the problem is more visible on a thumb2 kernel
> build, i.e. you should get a more reliable hang on boot. On a non-thumb2
> kernel the hanging behaviour seems depends on a device / bootloader. I
> haven't tried to figure out what exactly makes the difference, perhaps
> it should be a memory layout / state.

To build with a CONFIG_THUMB2_KERNEL I had to fetch:

https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9018/2

to avoid a build error, too bad this missed v5.10 final but hopefully it
can make it soon.

With CONFIG_THUMB2_KERNEL=y, I am not getting the head.S output where it
prints the start/end of the compressed kernel:

C:0x420800C0-0x4321B0E0->0x4212AB00-0x432C5B20
Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.10.0-g148842c98a24
(fainelli@fainelli-desktop) (arm-linux-gcc (GCC) 8.3.0, GNU ld (GNU
Binutils) 2.32) #71 SMP Tue Dec 15 09:53:09 PST 2020

I am only getting:

Uncompressing Linux... done, booting the kernel.

Is that the same for you?

Looking at the disassembly of head.o it definitively has
brcmstb_uart_config in the .text section as the beginning just like you
mentioned in your commit message.

Disassembly of section .text:

00000000 <brcmstb_uart_config>:
   0:   00000001        andeq   r0, r0, r1
        ...
   c:   467c            mov     r4, pc
   e:   f004 4478       and.w   r4, r4, #4160749568     ; 0xf8000000
  12:   f504 4400       add.w   r4, r4, #32768  ; 0x8000
  16:   4678            mov     r0, pc
  18:   42a0            cmp     r0, r4
  1a:   bf3f            itttt   cc
  1c:   48d4            ldrcc   r0, [pc, #848]  ; (370 <LC1+0x8>)
  1e:   4478            addcc   r0, pc
  20:   4284            cmpcc   r4, r0
  22:   f044 0401       orrcc.w r4, r4, #1
  26:   bf28            it      cs
  28:   f000 f9aa       blcs    380 <cache_on>

however after applying a fix similar to yours, we do end-up with the
expected data embedded within the code and given brcmstb.S would be
subject to the same issue as tegra.S, it would not hurt.
Dmitry Osipenko Dec. 15, 2020, 6:56 p.m. UTC | #8
15.12.2020 21:22, Florian Fainelli пишет:
> 
> 
> On 12/15/2020 8:53 AM, Dmitry Osipenko wrote:
>> 15.12.2020 19:40, Florian Fainelli пишет:
>>>
>>>
>>> On 12/15/2020 8:17 AM, Dmitry Osipenko wrote:
>>>> 15.12.2020 19:04, Florian Fainelli пишет:
>>>>>
>>>>>
>>>>> On 12/15/2020 5:52 AM, Dmitry Osipenko wrote:
>>>>>> The tegra_uart_config of the DEBUG_LL code is now placed right at the
>>>>>> start of the .text section after commit which enabled debug output in the
>>>>>> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
>>>>>> since tegra_uart_config data is executes as a code. Fix the misplaced
>>>>>> tegra_uart_config storage by embedding it into the code.
>>>>>>
>>>>>> Cc: stable@vger.kernel.org
>>>>>> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
>>>>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>>>>> ---
>>>>>>  arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
>>>>>>  1 file changed, 27 insertions(+), 27 deletions(-)
>>>>>
>>>>> Looks like arch/arm/include/debug/brcmstb.S would need the same
>>>>> treatment since the implementation was copied from tegra.S.
>>>>>
>>>>
>>>> Good catch, will you be able to test the brcm and make a patch?
>>>
>>> Yes, absolutely, building a kernel to test right now.
>>>
>>
>> Thank you.
>>
>> BTW, I noticed that the problem is more visible on a thumb2 kernel
>> build, i.e. you should get a more reliable hang on boot. On a non-thumb2
>> kernel the hanging behaviour seems depends on a device / bootloader. I
>> haven't tried to figure out what exactly makes the difference, perhaps
>> it should be a memory layout / state.
> 
> To build with a CONFIG_THUMB2_KERNEL I had to fetch:
> 
> https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9018/2
> 
> to avoid a build error, too bad this missed v5.10 final but hopefully it
> can make it soon.

The VFP fix was applied to the -next very recently, it should propagate
to v5.10 eventually.

> With CONFIG_THUMB2_KERNEL=y, I am not getting the head.S output where it
> prints the start/end of the compressed kernel:
> 
> C:0x420800C0-0x4321B0E0->0x4212AB00-0x432C5B20
> Uncompressing Linux... done, booting the kernel.
> [    0.000000] Booting Linux on physical CPU 0x0
> [    0.000000] Linux version 5.10.0-g148842c98a24
> (fainelli@fainelli-desktop) (arm-linux-gcc (GCC) 8.3.0, GNU ld (GNU
> Binutils) 2.32) #71 SMP Tue Dec 15 09:53:09 PST 2020
> 
> I am only getting:
> 
> Uncompressing Linux... done, booting the kernel.
> 
> Is that the same for you?

No, start/end are printed for both THUMB2 and ARM kernels here.

> Looking at the disassembly of head.o it definitively has
> brcmstb_uart_config in the .text section as the beginning just like you
> mentioned in your commit message.
> 
> Disassembly of section .text:
> 
> 00000000 <brcmstb_uart_config>:
>    0:   00000001        andeq   r0, r0, r1
>         ...
>    c:   467c            mov     r4, pc
>    e:   f004 4478       and.w   r4, r4, #4160749568     ; 0xf8000000
>   12:   f504 4400       add.w   r4, r4, #32768  ; 0x8000
>   16:   4678            mov     r0, pc
>   18:   42a0            cmp     r0, r4
>   1a:   bf3f            itttt   cc
>   1c:   48d4            ldrcc   r0, [pc, #848]  ; (370 <LC1+0x8>)
>   1e:   4478            addcc   r0, pc
>   20:   4284            cmpcc   r4, r0
>   22:   f044 0401       orrcc.w r4, r4, #1
>   26:   bf28            it      cs
>   28:   f000 f9aa       blcs    380 <cache_on>
> 
> however after applying a fix similar to yours, we do end-up with the
> expected data embedded within the code and given brcmstb.S would be
> subject to the same issue as tegra.S, it would not hurt.
> 

Have you checked whether start/end printed after applying the fix?
Florian Fainelli Dec. 15, 2020, 7:20 p.m. UTC | #9
On 12/15/2020 10:56 AM, Dmitry Osipenko wrote:
> 15.12.2020 21:22, Florian Fainelli пишет:
>>
>>
>> On 12/15/2020 8:53 AM, Dmitry Osipenko wrote:
>>> 15.12.2020 19:40, Florian Fainelli пишет:
>>>>
>>>>
>>>> On 12/15/2020 8:17 AM, Dmitry Osipenko wrote:
>>>>> 15.12.2020 19:04, Florian Fainelli пишет:
>>>>>>
>>>>>>
>>>>>> On 12/15/2020 5:52 AM, Dmitry Osipenko wrote:
>>>>>>> The tegra_uart_config of the DEBUG_LL code is now placed right at the
>>>>>>> start of the .text section after commit which enabled debug output in the
>>>>>>> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
>>>>>>> since tegra_uart_config data is executes as a code. Fix the misplaced
>>>>>>> tegra_uart_config storage by embedding it into the code.
>>>>>>>
>>>>>>> Cc: stable@vger.kernel.org
>>>>>>> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
>>>>>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>>>>>> ---
>>>>>>>  arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
>>>>>>>  1 file changed, 27 insertions(+), 27 deletions(-)
>>>>>>
>>>>>> Looks like arch/arm/include/debug/brcmstb.S would need the same
>>>>>> treatment since the implementation was copied from tegra.S.
>>>>>>
>>>>>
>>>>> Good catch, will you be able to test the brcm and make a patch?
>>>>
>>>> Yes, absolutely, building a kernel to test right now.
>>>>
>>>
>>> Thank you.
>>>
>>> BTW, I noticed that the problem is more visible on a thumb2 kernel
>>> build, i.e. you should get a more reliable hang on boot. On a non-thumb2
>>> kernel the hanging behaviour seems depends on a device / bootloader. I
>>> haven't tried to figure out what exactly makes the difference, perhaps
>>> it should be a memory layout / state.
>>
>> To build with a CONFIG_THUMB2_KERNEL I had to fetch:
>>
>> https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9018/2
>>
>> to avoid a build error, too bad this missed v5.10 final but hopefully it
>> can make it soon.
> 
> The VFP fix was applied to the -next very recently, it should propagate
> to v5.10 eventually.
> 
>> With CONFIG_THUMB2_KERNEL=y, I am not getting the head.S output where it
>> prints the start/end of the compressed kernel:
>>
>> C:0x420800C0-0x4321B0E0->0x4212AB00-0x432C5B20
>> Uncompressing Linux... done, booting the kernel.
>> [    0.000000] Booting Linux on physical CPU 0x0
>> [    0.000000] Linux version 5.10.0-g148842c98a24
>> (fainelli@fainelli-desktop) (arm-linux-gcc (GCC) 8.3.0, GNU ld (GNU
>> Binutils) 2.32) #71 SMP Tue Dec 15 09:53:09 PST 2020
>>
>> I am only getting:
>>
>> Uncompressing Linux... done, booting the kernel.
>>
>> Is that the same for you?
> 
> No, start/end are printed for both THUMB2 and ARM kernels here.
> 
>> Looking at the disassembly of head.o it definitively has
>> brcmstb_uart_config in the .text section as the beginning just like you
>> mentioned in your commit message.
>>
>> Disassembly of section .text:
>>
>> 00000000 <brcmstb_uart_config>:
>>    0:   00000001        andeq   r0, r0, r1
>>         ...
>>    c:   467c            mov     r4, pc
>>    e:   f004 4478       and.w   r4, r4, #4160749568     ; 0xf8000000
>>   12:   f504 4400       add.w   r4, r4, #32768  ; 0x8000
>>   16:   4678            mov     r0, pc
>>   18:   42a0            cmp     r0, r4
>>   1a:   bf3f            itttt   cc
>>   1c:   48d4            ldrcc   r0, [pc, #848]  ; (370 <LC1+0x8>)
>>   1e:   4478            addcc   r0, pc
>>   20:   4284            cmpcc   r4, r0
>>   22:   f044 0401       orrcc.w r4, r4, #1
>>   26:   bf28            it      cs
>>   28:   f000 f9aa       blcs    380 <cache_on>
>>
>> however after applying a fix similar to yours, we do end-up with the
>> expected data embedded within the code and given brcmstb.S would be
>> subject to the same issue as tegra.S, it would not hurt.
>>
> 
> Have you checked whether start/end printed after applying the fix?

Yes I did, it is not printed when CONFIG_THUMB2_KERNEL=y, but it is when
CONFIG_THUMB2_KERNEL=n. I don't have a JTAG adapter on this board right
now to single step.
Dmitry Osipenko Dec. 15, 2020, 7:47 p.m. UTC | #10
15.12.2020 22:20, Florian Fainelli пишет:
> 
> 
> On 12/15/2020 10:56 AM, Dmitry Osipenko wrote:
>> 15.12.2020 21:22, Florian Fainelli пишет:
>>>
>>>
>>> On 12/15/2020 8:53 AM, Dmitry Osipenko wrote:
>>>> 15.12.2020 19:40, Florian Fainelli пишет:
>>>>>
>>>>>
>>>>> On 12/15/2020 8:17 AM, Dmitry Osipenko wrote:
>>>>>> 15.12.2020 19:04, Florian Fainelli пишет:
>>>>>>>
>>>>>>>
>>>>>>> On 12/15/2020 5:52 AM, Dmitry Osipenko wrote:
>>>>>>>> The tegra_uart_config of the DEBUG_LL code is now placed right at the
>>>>>>>> start of the .text section after commit which enabled debug output in the
>>>>>>>> decompressor. Tegra devices are not booting anymore if DEBUG_LL is enabled
>>>>>>>> since tegra_uart_config data is executes as a code. Fix the misplaced
>>>>>>>> tegra_uart_config storage by embedding it into the code.
>>>>>>>>
>>>>>>>> Cc: stable@vger.kernel.org
>>>>>>>> Fixes: 2596a72d3384 ("ARM: 9009/1: uncompress: Enable debug in head.S")
>>>>>>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>>>>>>> ---
>>>>>>>>  arch/arm/include/debug/tegra.S | 54 +++++++++++++++++-----------------
>>>>>>>>  1 file changed, 27 insertions(+), 27 deletions(-)
>>>>>>>
>>>>>>> Looks like arch/arm/include/debug/brcmstb.S would need the same
>>>>>>> treatment since the implementation was copied from tegra.S.
>>>>>>>
>>>>>>
>>>>>> Good catch, will you be able to test the brcm and make a patch?
>>>>>
>>>>> Yes, absolutely, building a kernel to test right now.
>>>>>
>>>>
>>>> Thank you.
>>>>
>>>> BTW, I noticed that the problem is more visible on a thumb2 kernel
>>>> build, i.e. you should get a more reliable hang on boot. On a non-thumb2
>>>> kernel the hanging behaviour seems depends on a device / bootloader. I
>>>> haven't tried to figure out what exactly makes the difference, perhaps
>>>> it should be a memory layout / state.
>>>
>>> To build with a CONFIG_THUMB2_KERNEL I had to fetch:
>>>
>>> https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9018/2
>>>
>>> to avoid a build error, too bad this missed v5.10 final but hopefully it
>>> can make it soon.
>>
>> The VFP fix was applied to the -next very recently, it should propagate
>> to v5.10 eventually.
>>
>>> With CONFIG_THUMB2_KERNEL=y, I am not getting the head.S output where it
>>> prints the start/end of the compressed kernel:
>>>
>>> C:0x420800C0-0x4321B0E0->0x4212AB00-0x432C5B20
>>> Uncompressing Linux... done, booting the kernel.
>>> [    0.000000] Booting Linux on physical CPU 0x0
>>> [    0.000000] Linux version 5.10.0-g148842c98a24
>>> (fainelli@fainelli-desktop) (arm-linux-gcc (GCC) 8.3.0, GNU ld (GNU
>>> Binutils) 2.32) #71 SMP Tue Dec 15 09:53:09 PST 2020
>>>
>>> I am only getting:
>>>
>>> Uncompressing Linux... done, booting the kernel.
>>>
>>> Is that the same for you?
>>
>> No, start/end are printed for both THUMB2 and ARM kernels here.
>>
>>> Looking at the disassembly of head.o it definitively has
>>> brcmstb_uart_config in the .text section as the beginning just like you
>>> mentioned in your commit message.
>>>
>>> Disassembly of section .text:
>>>
>>> 00000000 <brcmstb_uart_config>:
>>>    0:   00000001        andeq   r0, r0, r1
>>>         ...
>>>    c:   467c            mov     r4, pc
>>>    e:   f004 4478       and.w   r4, r4, #4160749568     ; 0xf8000000
>>>   12:   f504 4400       add.w   r4, r4, #32768  ; 0x8000
>>>   16:   4678            mov     r0, pc
>>>   18:   42a0            cmp     r0, r4
>>>   1a:   bf3f            itttt   cc
>>>   1c:   48d4            ldrcc   r0, [pc, #848]  ; (370 <LC1+0x8>)
>>>   1e:   4478            addcc   r0, pc
>>>   20:   4284            cmpcc   r4, r0
>>>   22:   f044 0401       orrcc.w r4, r4, #1
>>>   26:   bf28            it      cs
>>>   28:   f000 f9aa       blcs    380 <cache_on>
>>>
>>> however after applying a fix similar to yours, we do end-up with the
>>> expected data embedded within the code and given brcmstb.S would be
>>> subject to the same issue as tegra.S, it would not hurt.
>>>
>>
>> Have you checked whether start/end printed after applying the fix?
> 
> Yes I did, it is not printed when CONFIG_THUMB2_KERNEL=y, but it is when
> CONFIG_THUMB2_KERNEL=n. I don't have a JTAG adapter on this board right
> now to single step.
> 

Okay, I don't know what's wrong there.

I also noticed that brcmstb doesn't check whether UART address is 0x0 in
senduart / busyuart, perhaps this needs to be fixed too.
diff mbox series

Patch

diff --git a/arch/arm/include/debug/tegra.S b/arch/arm/include/debug/tegra.S
index 98daa7f48314..7267516db0ba 100644
--- a/arch/arm/include/debug/tegra.S
+++ b/arch/arm/include/debug/tegra.S
@@ -149,7 +149,34 @@ 
 
 		.align
 99:		.word	.
+#if defined(ZIMAGE)
+		.word	. + 4
+/*
+ * Storage for the state maintained by the macro.
+ *
+ * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c.
+ * That's because this header is included from multiple files, and we only
+ * want a single copy of the data. In particular, the UART probing code above
+ * assumes it's running using physical addresses. This is true when this file
+ * is included from head.o, but not when included from debug.o. So we need
+ * to share the probe results between the two copies, rather than having
+ * to re-run the probing again later.
+ *
+ * In the decompressor, we put the storage right here, since common.c
+ * isn't included in the decompressor build. This storage data gets put in
+ * .text even though it's really data, since .data is discarded from the
+ * decompressor. Luckily, .text is writeable in the decompressor, unless
+ * CONFIG_ZBOOT_ROM. That dependency is handled in arch/arm/Kconfig.debug.
+ */
+		/* Debug UART initialization required */
+		.word 1
+		/* Debug UART physical address */
+		.word 0
+		/* Debug UART virtual address */
+		.word 0
+#else
 		.word	tegra_uart_config
+#endif
 		.ltorg
 
 		/* Load previously selected UART address */
@@ -189,30 +216,3 @@ 
 
 		.macro	waituarttxrdy,rd,rx
 		.endm
-
-/*
- * Storage for the state maintained by the macros above.
- *
- * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c.
- * That's because this header is included from multiple files, and we only
- * want a single copy of the data. In particular, the UART probing code above
- * assumes it's running using physical addresses. This is true when this file
- * is included from head.o, but not when included from debug.o. So we need
- * to share the probe results between the two copies, rather than having
- * to re-run the probing again later.
- *
- * In the decompressor, we put the symbol/storage right here, since common.c
- * isn't included in the decompressor build. This symbol gets put in .text
- * even though it's really data, since .data is discarded from the
- * decompressor. Luckily, .text is writeable in the decompressor, unless
- * CONFIG_ZBOOT_ROM. That dependency is handled in arch/arm/Kconfig.debug.
- */
-#if defined(ZIMAGE)
-tegra_uart_config:
-	/* Debug UART initialization required */
-	.word 1
-	/* Debug UART physical address */
-	.word 0
-	/* Debug UART virtual address */
-	.word 0
-#endif