From: Simon Glass <simon.glass@canonical.com> board_init_r() unconditionally calls set_gd(new_gd) for RISC-V, but the EFI application entry point passes NULL as the new_gd parameter. This zeroes the gp register (which holds the global data pointer), causing an immediate page fault when gd is next accessed. For EFI apps the global data pointer is already set correctly by efi_app.c before calling board_init_r(), so skip the set_gd() call. Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- common/board_r.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/board_r.c b/common/board_r.c index c0f1ea9f003..18258b4fa0a 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -793,7 +793,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) arch_setup_gd(new_gd); #if defined(CONFIG_RISCV) - set_gd(new_gd); + if (!IS_ENABLED(CONFIG_EFI_APP)) + set_gd(new_gd); #elif !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) gd = new_gd; #endif -- 2.43.0