All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] serial: move sbi_dbcn_available to .data section
@ 2024-02-26 16:32 Heinrich Schuchardt
  2024-02-26 17:58 ` Aurelien Jarno
  2024-03-07  8:39 ` Conor Dooley
  0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2024-02-26 16:32 UTC (permalink / raw)
  To: Tom Rini; +Cc: Rick Chen, Leo Yu-Chi Liang, u-boot, Heinrich Schuchardt

U-Boot SPL loads the device-tree directly behind main U-Boot overlapping
the .bss section. reserve_fdt() is called in board_init_f() to relocate the
device-tree to a safe location.

Debug UARTs are enabled before board_init_f(). With sbi_dbcn_available in
the .bss section the device-tree is corrupted when _debug_uart_init() is
called in the SBI serial driver. Move the variable to the .data section.

Link: https://bugs.launchpad.net/ubuntu/+source/u-boot/+bug/2054091
Fixes: dfe08374943c ("risc-v: implement DBCN based debug console")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 drivers/serial/serial_sbi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/serial_sbi.c b/drivers/serial/serial_sbi.c
index a51a96c1ef0..f3ecfccab43 100644
--- a/drivers/serial/serial_sbi.c
+++ b/drivers/serial/serial_sbi.c
@@ -17,7 +17,7 @@ static inline void _debug_uart_putc(int c)
 
 #else
 
-static int sbi_dbcn_available;
+static int sbi_dbcn_available __section(".data");
 
 static inline void _debug_uart_init(void)
 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] serial: move sbi_dbcn_available to .data section
  2024-02-26 16:32 [PATCH 1/1] serial: move sbi_dbcn_available to .data section Heinrich Schuchardt
@ 2024-02-26 17:58 ` Aurelien Jarno
  2024-03-07  8:39 ` Conor Dooley
  1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2024-02-26 17:58 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Tom Rini, Rick Chen, Leo Yu-Chi Liang, u-boot

On 2024-02-26 17:32, Heinrich Schuchardt wrote:
> U-Boot SPL loads the device-tree directly behind main U-Boot overlapping
> the .bss section. reserve_fdt() is called in board_init_f() to relocate the
> device-tree to a safe location.
> 
> Debug UARTs are enabled before board_init_f(). With sbi_dbcn_available in
> the .bss section the device-tree is corrupted when _debug_uart_init() is
> called in the SBI serial driver. Move the variable to the .data section.
> 
> Link: https://bugs.launchpad.net/ubuntu/+source/u-boot/+bug/2054091
> Fixes: dfe08374943c ("risc-v: implement DBCN based debug console")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  drivers/serial/serial_sbi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/serial/serial_sbi.c b/drivers/serial/serial_sbi.c
> index a51a96c1ef0..f3ecfccab43 100644
> --- a/drivers/serial/serial_sbi.c
> +++ b/drivers/serial/serial_sbi.c
> @@ -17,7 +17,7 @@ static inline void _debug_uart_putc(int c)
>  
>  #else
>  
> -static int sbi_dbcn_available;
> +static int sbi_dbcn_available __section(".data");
>  
>  static inline void _debug_uart_init(void)
>  {

Tested-by: Aurelien Jarno <aurelien@aurel32.net>


-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] serial: move sbi_dbcn_available to .data section
  2024-02-26 16:32 [PATCH 1/1] serial: move sbi_dbcn_available to .data section Heinrich Schuchardt
  2024-02-26 17:58 ` Aurelien Jarno
@ 2024-03-07  8:39 ` Conor Dooley
  1 sibling, 0 replies; 3+ messages in thread
From: Conor Dooley @ 2024-03-07  8:39 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Tom Rini, Rick Chen, Leo Yu-Chi Liang, u-boot

[-- Attachment #1: Type: text/plain, Size: 963 bytes --]

On Mon, Feb 26, 2024 at 05:32:26PM +0100, Heinrich Schuchardt wrote:
> U-Boot SPL loads the device-tree directly behind main U-Boot overlapping
> the .bss section. reserve_fdt() is called in board_init_f() to relocate the
> device-tree to a safe location.
> 
> Debug UARTs are enabled before board_init_f(). With sbi_dbcn_available in
> the .bss section the device-tree is corrupted when _debug_uart_init() is
> called in the SBI serial driver. Move the variable to the .data section.
> 
> Link: https://bugs.launchpad.net/ubuntu/+source/u-boot/+bug/2054091
> Fixes: dfe08374943c ("risc-v: implement DBCN based debug console")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

This also appears to fix the inconsistent boot issues that I've been
seeing since I reported:
https://lore.kernel.org/u-boot/20240122-finicky-ancient-797ba048f927@spud/

Tested-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-07  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-26 16:32 [PATCH 1/1] serial: move sbi_dbcn_available to .data section Heinrich Schuchardt
2024-02-26 17:58 ` Aurelien Jarno
2024-03-07  8:39 ` Conor Dooley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.