U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/35] global_data: Reduce size of struct global_data
@ 2024-08-21 16:18 Simon Glass
  2024-08-21 16:18 ` [PATCH v2 01/35] global_data: Move pci_clk to m68k and powerpc Simon Glass
                   ` (34 more replies)
  0 siblings, 35 replies; 44+ messages in thread
From: Simon Glass @ 2024-08-21 16:18 UTC (permalink / raw)
  To: u-boot; +Cc: Tom Rini, Simon Glass, Anatolij Gustschin, Bin Meng

The global data structure has grown quite a lot over the years, being
the best place to put an important pointer or something that must be
accessed before and after relocation.

This series attempts to reduce the size a little, by moving some things
out and shrinking and aligning some fields.

Some fields are needed during init but not afterwards. To deal with this
a new 'boardf' structure is created, which sits on the stack and is only
present during board_init_f(). It is possible that more fields could
move to this struct, but for now only 4 are moved.

An assumption is made that an int is 32-bits wide on all architectures,
which seems to be true, but maintainers should be able to confirm.

Mostly the code-size impact is neutral, but the patch
'Use less space for environment fields' does increase U-Boot's size by
about 30 bytes on aarch64.

For firefly-rk3399 (64-bit) the size of global reduces from 456 to 368
bytes. For SPL it reduces from 416 to 272 bytes.

There are other things which could be attempted, for example:
- Using hlist instead of list for some lists
- Checking that only necessary fields are present in SPL

Changes in v2:
- Rebase to -next

Simon Glass (35):
  global_data: Move pci_clk to m68k and powerpc
  x86: Drop use of global_data fb_base
  video: Add a function to obtain the framebuffer address
  video: mxc: Avoid setting global_data fb_base
  video: mxs: Avoid setting global_data fb_base
  arm: friendlyarm: Avoid accessing global_data fb_base
  arm: ronetix: Avoid accessing global_data fb_base
  zynqmp: Avoid setting the framebuffer address
  video: Avoid setting global_data fb_base from SPL handoff
  video: Avoid setting global_data fb_base in video setup
  global_data: Drop fb_base
  global_data: Convert have_console into a flag
  global_data: Remove pci_ram_top
  global_data: Drop global_data hose
  global_data: Drop pci_bootdelay
  global_data: Use less space for environment fields
  board_f: Add a new struct to hold pre-relocation info
  board_f: Move fdt_size to board
  board_f: Move new_bootstage to boardf
  board_f: Move new_bloblist to boardf
  global_data: Drop spl_handoff
  global_data: Collect common fields at the top
  global_data: Reduce the size of bus_clk and mem_clk
  global_data: Reduce the size of mon_len
  global_data: log: Reorder and shrink fields
  global_data: Reduce size of early-malloc vars
  global_data: Move baud_rate field lower
  global_data: Move env_addr field higher
  global_data: Put phys_addr fields near the top
  global_data: Move ulong fields together
  global_data: Move pointer members together
  global_data: Remove jump table in SPL
  global_data: Remove environment members if not used
  doc: Move generic-board documentation into rst
  doc: Add some guidelines about global data

 arch/arm/cpu/arm926ejs/mxs/spl_boot.c         |   2 +-
 arch/arm/lib/bdinfo.c                         |   2 +-
 arch/arm/mach-exynos/spl_boot.c               |   2 +-
 arch/arm/mach-k3/common.c                     |   2 +-
 arch/arm/mach-k3/r5/sysfw-loader.c            |   2 +-
 arch/arm/mach-tegra/board2.c                  |   4 -
 arch/arm/mach-tegra/cboot.c                   |   4 -
 arch/m68k/cpu/mcf5445x/cpu.c                  |   2 +-
 arch/m68k/include/asm/global_data.h           |   2 +
 arch/m68k/lib/bdinfo.c                        |   2 +-
 arch/mips/mach-ath79/ar934x/clk.c             |   4 +-
 arch/mips/mach-octeon/cpu.c                   |   2 +-
 arch/powerpc/cpu/mpc83xx/pci.c                |   4 +-
 arch/powerpc/cpu/mpc83xx/speed.c              |   2 +-
 arch/powerpc/include/asm/global_data.h        |   2 +
 arch/x86/cpu/i386/cpu.c                       |   8 -
 arch/x86/cpu/intel_common/cpu_from_spl.c      |   4 +-
 arch/x86/cpu/ivybridge/cpu.c                  |   5 -
 arch/x86/lib/fsp/fsp_graphics.c               |   1 -
 arch/x86/lib/fsp2/fsp_dram.c                  |   4 +-
 board/freescale/ls2080ardb/eth_ls2080rdb.c    |   2 +-
 board/friendlyarm/nanopi2/board.c             |   9 +-
 board/ronetix/pm9263/pm9263.c                 |   6 +-
 board/siemens/common/board_am335x.c           |   2 +-
 cmd/bdinfo.c                                  |   2 -
 cmd/sb.c                                      |   6 +-
 common/board_f.c                              |  56 ++-
 common/board_r.c                              |   2 +-
 common/console.c                              |  17 +-
 common/hwconfig.c                             |   8 +-
 common/init/handoff.c                         |  12 +
 common/malloc_simple.c                        |   7 +-
 common/spl/spl.c                              |   6 +-
 doc/develop/global_data.rst                   |  25 ++
 .../historical/generic_board.rst}             |  17 +-
 doc/develop/historical/index.rst              |  12 +
 doc/develop/index.rst                         |   8 +
 drivers/clk/mpc83xx_clk.c                     |   2 +-
 drivers/clk/rockchip/clk_rk3399.c             |   3 +-
 drivers/video/imx/mxc_ipuv3_fb.c              |   2 -
 drivers/video/mxsfb.c                         |   1 -
 drivers/video/video-uclass.c                  |  16 +-
 drivers/video/zynqmp/zynqmp_dpsub.c           |   3 +-
 include/asm-generic/global_data.h             | 349 ++++++++----------
 include/board_f.h                             |  35 ++
 include/env_default.h                         |   3 -
 include/env_internal.h                        |   1 +
 include/handoff.h                             |   7 +
 include/video.h                               |  11 +
 lib/asm-offsets.c                             |   2 +
 test/cmd/bdinfo.c                             |   3 -
 test/log/log_test.c                           |   6 +-
 52 files changed, 372 insertions(+), 329 deletions(-)
 rename doc/{README.generic-board => develop/historical/generic_board.rst} (96%)
 create mode 100644 doc/develop/historical/index.rst
 create mode 100644 include/board_f.h

-- 
2.34.1


^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2024-08-27 19:25 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 16:18 [PATCH v2 00/35] global_data: Reduce size of struct global_data Simon Glass
2024-08-21 16:18 ` [PATCH v2 01/35] global_data: Move pci_clk to m68k and powerpc Simon Glass
2024-08-21 16:18 ` [PATCH v2 02/35] x86: Drop use of global_data fb_base Simon Glass
2024-08-21 16:18 ` [PATCH v2 03/35] video: Add a function to obtain the framebuffer address Simon Glass
2024-08-21 16:18 ` [PATCH v2 04/35] video: mxc: Avoid setting global_data fb_base Simon Glass
2024-08-21 16:18 ` [PATCH v2 05/35] video: mxs: " Simon Glass
2024-08-21 16:18 ` [PATCH v2 06/35] arm: friendlyarm: Avoid accessing " Simon Glass
2024-08-21 16:18 ` [PATCH v2 07/35] arm: ronetix: " Simon Glass
2024-08-21 16:19 ` [PATCH v2 08/35] zynqmp: Avoid setting the framebuffer address Simon Glass
2024-08-21 16:19 ` [PATCH v2 09/35] video: Avoid setting global_data fb_base from SPL handoff Simon Glass
2024-08-21 16:19 ` [PATCH v2 10/35] video: Avoid setting global_data fb_base in video setup Simon Glass
2024-08-21 16:19 ` [PATCH v2 11/35] global_data: Drop fb_base Simon Glass
2024-08-21 16:19 ` [PATCH v2 12/35] global_data: Convert have_console into a flag Simon Glass
2024-08-21 16:19 ` [PATCH v2 13/35] global_data: Remove pci_ram_top Simon Glass
2024-08-21 16:19 ` [PATCH v2 14/35] global_data: Drop global_data hose Simon Glass
2024-08-21 16:19 ` [PATCH v2 15/35] global_data: Drop pci_bootdelay Simon Glass
2024-08-21 16:19 ` [PATCH v2 16/35] global_data: Use less space for environment fields Simon Glass
2024-08-21 16:19 ` [PATCH v2 17/35] board_f: Add a new struct to hold pre-relocation info Simon Glass
2024-08-21 16:19 ` [PATCH v2 18/35] board_f: Move fdt_size to board Simon Glass
2024-08-21 16:19 ` [PATCH v2 19/35] board_f: Move new_bootstage to boardf Simon Glass
2024-08-21 16:19 ` [PATCH v2 20/35] board_f: Move new_bloblist " Simon Glass
2024-08-21 16:19 ` [PATCH v2 21/35] global_data: Drop spl_handoff Simon Glass
2024-08-21 16:19 ` [PATCH v2 22/35] global_data: Collect common fields at the top Simon Glass
2024-08-21 16:19 ` [PATCH v2 23/35] global_data: Reduce the size of bus_clk and mem_clk Simon Glass
2024-08-21 16:19 ` [PATCH v2 24/35] global_data: Reduce the size of mon_len Simon Glass
2024-08-21 16:19 ` [PATCH v2 25/35] global_data: log: Reorder and shrink fields Simon Glass
2024-08-21 16:19 ` [PATCH v2 26/35] global_data: Reduce size of early-malloc vars Simon Glass
2024-08-23 13:34   ` Tom Rini
2024-08-23 20:30     ` Simon Glass
2024-08-23 21:07       ` Tom Rini
2024-08-23 21:44         ` Simon Glass
2024-08-23 21:49           ` Tom Rini
2024-08-23 23:30             ` Simon Glass
2024-08-26 18:33               ` Tom Rini
2024-08-27 19:25                 ` Simon Glass
2024-08-21 16:19 ` [PATCH v2 27/35] global_data: Move baud_rate field lower Simon Glass
2024-08-21 16:19 ` [PATCH v2 28/35] global_data: Move env_addr field higher Simon Glass
2024-08-21 16:19 ` [PATCH v2 29/35] global_data: Put phys_addr fields near the top Simon Glass
2024-08-21 16:19 ` [PATCH v2 30/35] global_data: Move ulong fields together Simon Glass
2024-08-21 16:19 ` [PATCH v2 31/35] global_data: Move pointer members together Simon Glass
2024-08-21 16:19 ` [PATCH v2 32/35] global_data: Remove jump table in SPL Simon Glass
2024-08-21 16:19 ` [PATCH v2 33/35] global_data: Remove environment members if not used Simon Glass
2024-08-21 16:19 ` [PATCH v2 34/35] doc: Move generic-board documentation into rst Simon Glass
2024-08-21 16:19 ` [PATCH v2 35/35] doc: Add some guidelines about global data Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox