[PATCH v2 0/5] Static initcalls
Jerome Forissier
jerome.forissier at linaro.org
Fri Jan 3 09:47:58 CET 2025
Hi Tom,
On 1/1/25 18:55, Tom Rini wrote:
> On Wed, Dec 18, 2024 at 04:53:53PM +0100, Jerome Forissier wrote:
>
>> This series replaces the dynamic initcalls (with function pointers) with
>> static calls, and gets rid of initcall_run_list(), init_sequence_f,
>> init_sequence_f_r and init_sequence_r. This makes the code simpler and the
>> binary slighlty smaller: -2507 bytes/-0.23 % with LTO enabled and -1232
>> bytes/-0.11 % with LTO disabled (xilinx_zynqmp_kria_defconfig).
>>
>> Execution time doesn't seem to change noticeably. There is no impact on
>> the SPL.
>
> This leads to run-time failures on SH:
> https://source.denx.de/u-boot/u-boot/-/jobs/986701
>
Fixed as follows:
diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
index 53b1c147c2e..2daf54e7c33 100644
--- a/arch/sh/lib/board.c
+++ b/arch/sh/lib/board.c
@@ -19,18 +19,13 @@ int dram_init(void)
void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr)
{
- void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r;
-
- if (new_gd->reloc_off) {
+ if (new_gd->reloc_off)
memcpy((void *)new_gd->relocaddr,
(void *)(new_gd->relocaddr - new_gd->reloc_off),
new_gd->mon_len);
- reloc_board_init_r += new_gd->reloc_off;
- }
-
__asm__ __volatile__("mov.l %0, r15\n" : : "m" (new_gd->start_addr_sp));
while (1)
- reloc_board_init_r(new_gd, 0x0);
+ board_init_r(new_gd, 0x0);
}
...which kind of makes sense to me but I must say I don't fully grasp what
is happening with this relocation step.
If this is indeed the right fix I will fold it into "board_init_r(): use
static calls" which is the commit that breaks the test.
Thanks,
--
Jerome
More information about the U-Boot
mailing list