mbox series

[0/8] MIPS: Unify low-level debugging functionalities

Message ID 20231029-mips_debug_ll-v1-0-d7a491e8c278@flygoat.com (mailing list archive)
Headers show
Series MIPS: Unify low-level debugging functionalities | expand

Message

Jiaxun Yang Oct. 29, 2023, 2:53 a.m. UTC
Hi all,

This is a attempt to bring all low-level debugging print functions
together and provide a arm-like low-level debugging interface and
a further function to debug early exceptions.

The plan is to elimiate platform specific early_printk and
cps-vec-ns16550 by debug_ll and earlycon.

cps-vec-ns16550 is leave unchanged for now due to pending patch[1].

Hope you'll find them handy :-)

Happy hacking!

Thanks
Jiaxun

[1]: https://lore.kernel.org/linux-mips/20231027221106.405666-6-jiaxun.yang@flygoat.com/

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
Jiaxun Yang (8):
      MIPS: asm: Move strings to .rodata.str section
      MIPS: debug: Implement low-level debugging functions
      MIPS: debug: Hook up DEBUG_LL with early printk
      MIPS: debug: Provide an early exception vector for low-level debugging
      MIPS: debug_ll: Add Kconfig symbols for some 8250 uarts
      MIPS: debug_ll: Implement support for Alchemy uarts
      MIPS: debug_ll: Implement support for AR933X uarts
      MIPS: zboot: Convert to use debug_ll facilities

 arch/mips/Kconfig                        |  12 +-
 arch/mips/Kconfig.debug                  | 212 +++++++++++++++++++++++++++----
 arch/mips/boot/compressed/Makefile       |   9 +-
 arch/mips/boot/compressed/dbg.c          |  37 ------
 arch/mips/boot/compressed/debug-vec.S    |   3 +
 arch/mips/boot/compressed/debug.S        |   3 +
 arch/mips/boot/compressed/decompress.c   |   6 +-
 arch/mips/boot/compressed/head.S         |   6 +
 arch/mips/boot/compressed/uart-16550.c   |  47 -------
 arch/mips/boot/compressed/uart-alchemy.c |   7 -
 arch/mips/boot/compressed/uart-ath79.c   |   2 -
 arch/mips/boot/compressed/uart-prom.c    |   7 -
 arch/mips/include/asm/asm.h              |   2 +-
 arch/mips/include/debug/8250.S           |  60 +++++++++
 arch/mips/include/debug/alchemy.S        |  46 +++++++
 arch/mips/include/debug/ar933x.S         |  41 ++++++
 arch/mips/include/debug/uhi.S            |  48 +++++++
 arch/mips/kernel/Makefile                |   3 +
 arch/mips/kernel/debug-vec.S             | 194 ++++++++++++++++++++++++++++
 arch/mips/kernel/debug.S                 | 130 +++++++++++++++++++
 arch/mips/kernel/early_printk.c          |  19 +++
 arch/mips/kernel/head.S                  |   4 +
 22 files changed, 750 insertions(+), 148 deletions(-)
---
base-commit: 66f1e1ea3548378ff6387b1ce0b40955d54e86aa
change-id: 20231028-mips_debug_ll-ef9cce16767b

Best regards,

Comments

Jiaxun Yang Dec. 1, 2023, 11:58 a.m. UTC | #1
在2023年10月29日十月 上午2:53,Jiaxun Yang写道:
> Hi all,

Hi Thomas,

A gentle ping on this series :-)

I've got too much patch floating out there.

Thanks
- Jiaxun

>
> This is a attempt to bring all low-level debugging print functions
> together and provide a arm-like low-level debugging interface and
> a further function to debug early exceptions.
>
> The plan is to elimiate platform specific early_printk and
> cps-vec-ns16550 by debug_ll and earlycon.
>
> cps-vec-ns16550 is leave unchanged for now due to pending patch[1].
>
> Hope you'll find them handy :-)
>
> Happy hacking!
>
> Thanks
> Jiaxun
>
> [1]: 
> https://lore.kernel.org/linux-mips/20231027221106.405666-6-jiaxun.yang@flygoat.com/
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> Jiaxun Yang (8):
>       MIPS: asm: Move strings to .rodata.str section
>       MIPS: debug: Implement low-level debugging functions
>       MIPS: debug: Hook up DEBUG_LL with early printk
>       MIPS: debug: Provide an early exception vector for low-level debugging
>       MIPS: debug_ll: Add Kconfig symbols for some 8250 uarts
>       MIPS: debug_ll: Implement support for Alchemy uarts
>       MIPS: debug_ll: Implement support for AR933X uarts
>       MIPS: zboot: Convert to use debug_ll facilities
>
>  arch/mips/Kconfig                        |  12 +-
>  arch/mips/Kconfig.debug                  | 212 +++++++++++++++++++++++++++----
>  arch/mips/boot/compressed/Makefile       |   9 +-
>  arch/mips/boot/compressed/dbg.c          |  37 ------
>  arch/mips/boot/compressed/debug-vec.S    |   3 +
>  arch/mips/boot/compressed/debug.S        |   3 +
>  arch/mips/boot/compressed/decompress.c   |   6 +-
>  arch/mips/boot/compressed/head.S         |   6 +
>  arch/mips/boot/compressed/uart-16550.c   |  47 -------
>  arch/mips/boot/compressed/uart-alchemy.c |   7 -
>  arch/mips/boot/compressed/uart-ath79.c   |   2 -
>  arch/mips/boot/compressed/uart-prom.c    |   7 -
>  arch/mips/include/asm/asm.h              |   2 +-
>  arch/mips/include/debug/8250.S           |  60 +++++++++
>  arch/mips/include/debug/alchemy.S        |  46 +++++++
>  arch/mips/include/debug/ar933x.S         |  41 ++++++
>  arch/mips/include/debug/uhi.S            |  48 +++++++
>  arch/mips/kernel/Makefile                |   3 +
>  arch/mips/kernel/debug-vec.S             | 194 ++++++++++++++++++++++++++++
>  arch/mips/kernel/debug.S                 | 130 +++++++++++++++++++
>  arch/mips/kernel/early_printk.c          |  19 +++
>  arch/mips/kernel/head.S                  |   4 +
>  22 files changed, 750 insertions(+), 148 deletions(-)
> ---
> base-commit: 66f1e1ea3548378ff6387b1ce0b40955d54e86aa
> change-id: 20231028-mips_debug_ll-ef9cce16767b
>
> Best regards,
> -- 
> Jiaxun Yang <jiaxun.yang@flygoat.com>
Thomas Bogendoerfer Dec. 20, 2023, 9:18 p.m. UTC | #2
On Sun, Oct 29, 2023 at 02:53:01AM +0000, Jiaxun Yang wrote:
> The plan is to elimiate platform specific early_printk and
> cps-vec-ns16550 by debug_ll and earlycon.

https://xkcd.com/927/ ?

sorry I don't think that just another new function is good approach.
Doing this will end up with another method for early debugging and
all other will stay.

Thomas.
Jiaxun Yang Dec. 21, 2023, 1:40 a.m. UTC | #3
在2023年12月20日十二月 下午9:18,Thomas Bogendoerfer写道:
> On Sun, Oct 29, 2023 at 02:53:01AM +0000, Jiaxun Yang wrote:
>> The plan is to elimiate platform specific early_printk and
>> cps-vec-ns16550 by debug_ll and earlycon.
>
> https://xkcd.com/927/ ?
>
> sorry I don't think that just another new function is good approach.
> Doing this will end up with another method for early debugging and
> all other will stay.
All others will go (one of two already gone).

The thing is, I tried to get cps-vec-16550 and zboot work with UHI
semihosting, and soon find out that they are doing exactly the same
thing. So I tried to unify them.

I miss the good old day on Arm system that I can use handy debug_ll
functions for every low level debugging purpose, thus I just copied the
whole design.

There won't be any new debugging functions, zboot one already merged
into debug_ll in this series, cps-vec-ns16550 will be merged as well,
I've got patches prepared locally but depending on my XKPHYS changes.

We have extra functionality to debug early exception as well, that will
certainly make bring-up process easier.

Thanks.
>
> Thomas.
>
> -- 
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]
Jiaxun Yang Dec. 21, 2023, 2:21 a.m. UTC | #4
在2023年12月20日十二月 下午9:18,Thomas Bogendoerfer写道:
> On Sun, Oct 29, 2023 at 02:53:01AM +0000, Jiaxun Yang wrote:
>> The plan is to elimiate platform specific early_printk and
>> cps-vec-ns16550 by debug_ll and earlycon.
>
> https://xkcd.com/927/ ?
>
> sorry I don't think that just another new function is good approach.
> Doing this will end up with another method for early debugging and
> all other will stay.

To summarize how are we going to handle low-level debugging after this series:
1. You are lucky enough that the problem happens after console system initialized
   and you have stack working: go earlycon, or on very few old platforms with platform
   early_printk
2. You are debugging zboot: debug_ll
3. You are debugging SMP bootstrap code like cps-vec: debug_ll
4. Your kernel crashed at the middle of no where before trap_init: debug_ll

Thanks
>
> Thomas.
>
> -- 
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]