U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/35] global_data: Reduce size of struct global_data
@ 2024-07-24 15:08 Simon Glass
  2024-07-24 15:08 ` [PATCH 01/35] global_data: Move pci_clk to m68k and powerpc Simon Glass
                   ` (36 more replies)
  0 siblings, 37 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Simon Glass, Aaron Williams, Algapally Santosh Sagar,
	Anatolij Gustschin, Andrew Davis, Aradhya Bhatia, Bin Meng,
	Dan Carpenter, Devarsh Thakkar, Enrico Leto, Fabio Estevam,
	Heinrich Schuchardt, Huan Wang, Ilko Iliev, Ion Agorria,
	Joao Marcos Costa, Jonas Karlman, Kever Yang, MD Danish Anwar,
	Mario Six, Matthias Schiffer, Michal Simek, NXP i.MX U-Boot Team,
	Nishanth Menon, Patrice Chotard, Peng Fan, Peter Robinson,
	Philipp Tomsich, Quentin Schulz, Sean Anderson, Shiji Yang,
	Stefan Bosch, Stefano Babic, Svyatoslav Ryhel,
	This contributor prefers not to receive mails, Troy Kisky,
	Venkatesh Yadav Abbarapu, Wasim Khan

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


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                              |  59 ++-
 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}             |  16 +-
 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, 373 insertions(+), 330 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-29 15:03 UTC | newest]

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

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