[PATCH] riscv: cpu: set gp before board_init_f_init_reserve

Nikita Shubin nikita.shubin at maquefel.me
Fri May 20 13:41:17 CEST 2022


From: Nikita Shubin <n.shubin at yadro.com>

Restore global pointer before board_init_f_init_reserve call,
as "a0" can be set in harts_early_init call and we end up with
invalid global pointer.

Signed-off-by: Nikita Shubin <n.shubin at yadro.com>
---
 arch/riscv/cpu/start.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S
index 76850ec9be..623de57551 100644
--- a/arch/riscv/cpu/start.S
+++ b/arch/riscv/cpu/start.S
@@ -142,6 +142,7 @@ call_harts_early_init:
 	bnez	tp, secondary_hart_loop
 #endif
 
+	mv      a0, s0
 	jal	board_init_f_init_reserve
 
 	SREG	s1, GD_FIRMWARE_FDT_ADDR(gp)
-- 
2.35.1



More information about the U-Boot mailing list