[PATCH v6 2/3] common: board: make initcalls static
Tom Rini
trini at konsulko.com
Tue Jun 3 18:10:14 CEST 2025
On Tue, Jun 03, 2025 at 09:22:01AM -0600, Simon Glass wrote:
> Hi Jerome,
>
> On Fri, 4 Apr 2025 at 07:50, Jerome Forissier
> <jerome.forissier at linaro.org> wrote:
> >
> > Change board_init_f(), board_init_f_r() and board_init_r() to make
> > static calls instead of iterating over the init_sequence_f,
> > init_sequence_f_r and init_sequence_r arrays, respectively. This makes
> > the code a simpler (and even more so when initcall_run_list() is
> > later removed) and it reduces the binary size as well. Tested with
> > xilinx_zynqmp_kria_defconfig; bloat-o-meter results:
> >
> > - With LTO
> > add/remove: 106/196 grow/shrink: 10/28 up/down: 31548/-33829 (-2281)
> > Total: Before=1070471, After=1068190, chg -0.21%
> > - Without LTO
> > add/remove: 0/54 grow/shrink: 3/0 up/down: 2322/-2832 (-510)
> > Total: Before=1121723, After=1121213, chg -0.05%
> >
> > Execution time does not change in a noticeable way.
> >
> > Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
> > ---
> > arch/sh/lib/board.c | 9 +-
> > common/board_f.c | 223 ++++++++++++++++----------------
> > common/board_r.c | 247 ++++++++++++++++++------------------
> > include/initcall.h | 27 ++++
> > test/py/tests/test_trace.py | 8 +-
> > 5 files changed, 273 insertions(+), 241 deletions(-)
> >
> [..]
> > diff --git a/common/board_f.c b/common/board_f.c
> > index baf98fb8ec8..a1bb8a01be5 100644
> > --- a/common/board_f.c
> > +++ b/common/board_f.c
> [..]
> > @@ -1049,8 +1056,8 @@ void board_init_f(ulong boot_flags)
> > /*
> > * For now this code is only used on x86.
> > *
> > - * init_sequence_f_r is the list of init functions which are run when
> > - * U-Boot is executing from Flash with a semi-limited 'C' environment.
> > + * Run init functions which are run when U-Boot is executing from Flash with a
> > + * semi-limited 'C' environment.
> > * The following limitations must be considered when implementing an
> > * '_f_r' function:
> > * - 'static' variables are read-only
> > @@ -1063,18 +1070,16 @@ void board_init_f(ulong boot_flags)
> > * NOTE: At present only x86 uses this route, but it is intended that
> > * all archs will move to this when generic relocation is implemented.
> > */
> > -static const init_fnc_t init_sequence_f_r[] = {
> > -#if !CONFIG_IS_ENABLED(X86_64)
> > - init_cache_f_r,
> > +static void initcall_run_f_r(void)
> > +{
> > +#if CONFIG_IS_ENABLED(X86_64)
>
> This is reversing the condition, which breaks link and coral in my lab.
>
> > + INITCALL(init_cache_f_r);
The most helpful thing to do here would be to post a patch correcting
the logic and providing a Fixes tag, thanks.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250603/da48b716/attachment.sig>
More information about the U-Boot
mailing list