Skip to content

Static initcalls

Jerome Forissier u-boot 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 14 repliesIn review
  2. v2 posting 2/23 patches 9 repliesSuperseded
  3. v42 patches 4 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v35 patches2 repliesSuperseded
v2 posting 1/25 patches11 repliesSuperseded
v15 patches7 repliesSuperseded

Changes in v6 from the cover letter

- Rebase on next branch

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3arm: asm/system.h: mrc and mcr need .arm if __thumb2__ is not setarch/arm/include/asm/system.h arch/arm/lib/cache.c arch/arm/mach-kirkwood/include/mach/cpu.h+25 -110 replies
2/3common: board: make initcalls staticarch/sh/lib/board.c common/board_f.c common/board_r.c +2 more+273 -2414 replies
3/3initcall: remove initcall_run_list()include/initcall.h lib/Makefile lib/initcall.c+0 -1270 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/3] Static initcalls

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: -2281 bytes/-0.21 % with LTO enabled and -510 bytes/-0.05 % with LTO disabled (xilinx_zynqmp_kria_defconfig).

Execution time doesn't seem to change noticeably. There is no impact on the SPL.

The inline assembly fixes, although they look unrelated, are triggered on some platforms with LTO enabled. For example: kirkwood_defconfig.

CI: https://source.denx.de/u-boot/custodians/u-boot-net/-/pipelines/25514

Changes in v6:
- Rebase on next branch

Changes in v5:
- Fix mistake in initcall_run_r(): CONFIG_IS_ENABLED(SYS_EARLY_PCI_INIT)
should have been !CONFIG_IS_ENABLED(...). As a result, several CI tests
were failing. (Tom R.)
- Restore fixes in test/py/tests/test_trace.py and arch/sh/lib/board.c
which had unexpectedly disappeared from v4 and caused CI errors.
- Fix CI error caused by wrong conditionals on the fix_fdt() call:
tools/buildman/buildman -o /tmp -seP powerpc
[...]
common/board_f.c:752:12: error: 'fix_fdt' defined but not used [-Werror=unused-function]
- Add "arm: asm/system.h: mrc and mcr need .arm if __thumb2__ is not set"
to fix a build error with LTO detecting mcr/mrc instructions emitted in
Thumb mode on a CPU that doesn't support it:
make sheevaplug_defconfig
make -j$(nproc) CROSS_COMPILE="ccache arm-linux-gnueabi-"
[...]
LTO u-boot
{standard input}: Assembler messages:
{standard input}:9241: Error: selected processor does not support mcr p15,1,r0,c15,c11,0' in Thumb mode {standard input}:19196: Error: selected processor does not support mrc p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19223: Error: selected processor does not support mcr p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19241: Error: selected processor does not support mrc p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19268: Error: selected processor does not support mcr p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19286: Error: selected processor does not support mrc p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19321: Error: selected processor does not support mcr p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19341: Error: selected processor does not support mrc p15,0,r3,c1,c0,0' in Thumb mode {standard input}:19372: Error: selected processor does not support `mcr p15,0,r3,c1,c0,0' in Thumb mode make[1]: *** [/tmp/ccu1wZWX.mk:11: /tmp/ccIab81n.ltrans3.ltrans.o] Error 1

Changes in v4:
- Fold all changes to board_init_*() into a single patch
- Use '#if CONFIG_IS_ENABLED(FOO) INITCALL(init_foo) #endif' instead of 'CONFIG_IS_ENABLED(FOO, (INITCALL(init_foo);));' (Caleb C., Simon G.). As a consequence, drop Michal's patch ("common: board: Simplify array with function pointers with CONFIG_IS_ENABLED").
- Rebase on next

Changes in v3:
- Use printf() rather than debug() to report initcall failures (Quentin S.)
- initcall_run_f(): replace one erroneous call to WATCHDOG_INIT() with WATCHDOG_RESET() (Ilias A.)
- Fix relocate_code() in arch/sh/lib/board.c to address CI failures with r2dplus (https://lists.denx.de/pipermail/u-boot/2025-January/576213.html)
(Tom R.)
- Add comments to initcall_run_f() and initcall_run_r() (Simon G.)

Changes in v2:
- INTICALL() and INITCALL_EVT() now call hang() immediately on error
- Fixed typo: s/intcall_run_f_r/initcall_run_f_r/

Jerome Forissier (3):
arm: asm/system.h: mrc and mcr need .arm if __thumb2__ is not set
common: board: make initcalls static
initcall: remove initcall_run_list()

 arch/arm/include/asm/system.h             |  22 +-
 arch/arm/lib/cache.c                      |   5 +-
 arch/arm/mach-kirkwood/include/mach/cpu.h |   9 +-
 arch/sh/lib/board.c                       |   9 +-
 common/board_f.c                          | 223 +++++++++----------
 common/board_r.c                          | 247 +++++++++++-----------
 include/initcall.h                        |  45 ++--
 lib/Makefile                              |   1 -
 lib/initcall.c                            | 102 ---------
 test/py/tests/test_trace.py               |   8 +-
 10 files changed, 295 insertions(+), 376 deletions(-)
 delete mode 100644 lib/initcall.c
Signature · 1 line
2.43.0