All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/27] Make LMB memory map global and persistent
@ 2024-08-26 11:59 Sughosh Ganu
  2024-08-26 11:59 ` [PATCH v4 01/27] alist: add a helper to check if the list is full Sughosh Ganu
                   ` (27 more replies)
  0 siblings, 28 replies; 49+ messages in thread
From: Sughosh Ganu @ 2024-08-26 11:59 UTC (permalink / raw)
  To: u-boot
  Cc: Simon Glass, Tom Rini, Ilias Apalodimas, Heinrich Schuchardt,
	Marek Vasut, Mark Kettenis, Michal Simek, Patrick DELAUNAY,
	Patrice CHOTARD, Marek Behún


This is a follow-up from an earlier RFC series [1] for making the LMB
and EFI memory allocations work together. This is a non-rfc version
with only the LMB part of the patches, for making the LMB memory map
global and persistent.

This is part one of a set of patches which aim to have the LMB and EFI
memory allocations work together. This requires making the LMB memory
map global and persistent, instead of having local, caller specific
maps. This is being done keeping in mind the usage of LMB memory by
platforms where the same memory region can be used to load multiple
different images. What is not allowed is to overwrite memory that has
been allocated by the other module, currently the EFI memory
module. This is being achieved by introducing a new flag,
LMB_NOOVERWRITE, which represents memory which cannot be re-requested
once allocated.

The data structures (alloced lists) required for maintaining the LMB
map are initialised during board init. The LMB module is enabled by
default for the main U-Boot image, while it needs to be enabled for
SPL. This version also uses a stack implementation, as suggested by
Simon Glass to temporarily store the lmb structure instance which is
used during normal operation when running lmb tests. This does away
with the need to run the lmb tests separately.

The tests have been tweaked where needed because of these changes.

The second part of the patches, to be sent subsequently, would work on
having the EFI allocations work with the LMB API's.

[1] - https://lore.kernel.org/u-boot/20240704073544.670249-1-sughosh.ganu@linaro.org/T/#t


Notes:

1) These patches are on next, as the alist patches have been
   applied to that branch.
2) I have tested the boot on the ST DK2 board, but it would be good to
   get a T-b/R-b from the ST maintainers.
3) It will be good to test these changes on a PowerPC platform
   (ideally an 85xx, as I do not have one).


Changes since V3:
* Fix checkpatch warnings of spaces between function name and
  open parantheses.
* s/uint64_t/u64 as suggested by checkpatch.
* Remove unneccessary parantheses in lmb.c as suggested by checkpatch.
* Fix alignment in test/cmd/bdinfo.c as suggested by checkpatch.
* Do away with multiple assignments in lmb_resize_regions() as
  suggested by checkpatch.
* Fix the alignment in arch_lmb_reserve_generic() as suggested by
  checkpatch.
* Removed the additional blank line in arch/powerpc/lib/misc.c as
  suggested by checkpatch.
* Added spaces in the CFG_SYS_LINUX_LOWMEM_MAX_SIZE value as suggested
  by checkpatch.
* Added a missing blank line in arch/powerpc/lib/misc.c as suggested
  by checkpatch.
* s/16384/SZ_16K in lmb_reserve_uboot_region().
* Fix the corresponding comment for the above change.
* Fixed the alignment in lmb_reserve_uboot_region() as suggested by
  checkpatch.
* s/uint32_t/u32 in optee_get_reserved_memory() as suggested by
  checkpatch.
* Put the tertiary expression in the puts() function call as suggested
  by Simon Glass.
* s/uin64_t/u64 in lmb_print_region_flags() as suggested by checkpatch.


Sughosh Ganu (27):
  alist: add a helper to check if the list is full
  lmb: remove the unused lmb_is_reserved() function
  lmb: staticize __lmb_alloc_base()
  lmb: use the BIT macro for lmb flags
  lmb: make LMB memory map persistent and global
  lmb: allow for resizing lmb regions
  lmb: remove config symbols used for lmb region count
  lmb: config: add lmb config symbols for SPL
  lmb: allow lmb module to be used in SPL
  lmb: introduce a function to add memory to the lmb memory map
  lmb: reserve common areas during board init
  lmb: remove the lmb_init_and_reserve() function
  lmb: remove lmb_init_and_reserve_range() function
  lmb: bootm: remove superfluous lmb stub functions
  lmb: init: initialise the lmb data structures during board init
  ppc: lmb: move arch specific lmb reservations to arch_misc_init()
  lmb: do away with arch_lmb_reserve()
  lmb: remove the unused board_lmb_reserve() function
  sandbox: move the TCG event log to the start of ram memory
  spl: call spl_board_init() at the end of the spl init sequence
  spl: sandbox: initialise the ram banksize in spl
  sandbox: spl: enable lmb config for SPL
  sandbox: iommu: remove lmb allocation in the driver
  zynq: lmb: do not add to lmb map before relocation
  stm32mp: allow calling optee_get_reserved_memory() from U-Boot
  stm32mp: compute ram_top based on the optee base address
  lmb: add logic to print lmb flag strings

 arch/arc/lib/cache.c                         |  14 -
 arch/arm/lib/stack.c                         |  14 -
 arch/arm/mach-apple/board.c                  |  17 +-
 arch/arm/mach-snapdragon/board.c             |  17 +-
 arch/arm/mach-stm32mp/dram_init.c            |  33 +-
 arch/arm/mach-stm32mp/include/mach/stm32mp.h |  11 +
 arch/arm/mach-stm32mp/stm32mp1/cpu.c         |   7 +-
 arch/arm/mach-stm32mp/stm32mp1/spl.c         |  17 +-
 arch/m68k/lib/bootm.c                        |  20 +-
 arch/microblaze/lib/bootm.c                  |  14 -
 arch/mips/lib/bootm.c                        |  22 +-
 arch/nios2/lib/bootm.c                       |  13 -
 arch/powerpc/cpu/mpc85xx/cpu_init.c          |  16 -
 arch/powerpc/cpu/mpc85xx/mp.c                |   4 +-
 arch/powerpc/include/asm/mp.h                |   4 +-
 arch/powerpc/lib/Makefile                    |   1 +
 arch/powerpc/lib/bootm.c                     |  55 +-
 arch/powerpc/lib/misc.c                      |  62 ++
 arch/riscv/lib/bootm.c                       |  13 -
 arch/sandbox/cpu/spl.c                       |  13 +-
 arch/sandbox/dts/test.dts                    |   2 +-
 arch/sandbox/include/asm/test.h              |   4 +
 arch/sh/lib/bootm.c                          |  13 -
 arch/x86/lib/bootm.c                         |  18 -
 arch/xtensa/lib/bootm.c                      |  13 -
 board/xilinx/common/board.c                  |  33 -
 boot/bootm.c                                 |  38 +-
 boot/bootm_os.c                              |   5 +-
 boot/image-board.c                           |  36 +-
 boot/image-fdt.c                             |  35 +-
 cmd/bdinfo.c                                 |   5 +-
 cmd/booti.c                                  |   2 +-
 cmd/bootz.c                                  |   2 +-
 cmd/elf.c                                    |   2 +-
 cmd/load.c                                   |   7 +-
 common/board_r.c                             |  10 +
 common/spl/spl.c                             |   9 +-
 configs/a3y17lte_defconfig                   |   1 -
 configs/a5y17lte_defconfig                   |   1 -
 configs/a7y17lte_defconfig                   |   1 -
 configs/apple_m1_defconfig                   |   1 -
 configs/mt7981_emmc_rfb_defconfig            |   1 -
 configs/mt7981_rfb_defconfig                 |   1 -
 configs/mt7981_sd_rfb_defconfig              |   1 -
 configs/mt7986_rfb_defconfig                 |   1 -
 configs/mt7986a_bpir3_emmc_defconfig         |   1 -
 configs/mt7986a_bpir3_sd_defconfig           |   1 -
 configs/mt7988_rfb_defconfig                 |   1 -
 configs/mt7988_sd_rfb_defconfig              |   1 -
 configs/qcom_defconfig                       |   1 -
 configs/sandbox_noinst_defconfig             |   1 +
 configs/sandbox_spl_defconfig                |   3 +-
 configs/stm32mp13_defconfig                  |   3 -
 configs/stm32mp15_basic_defconfig            |   3 -
 configs/stm32mp15_defconfig                  |   3 -
 configs/stm32mp15_trusted_defconfig          |   3 -
 configs/stm32mp25_defconfig                  |   3 -
 configs/th1520_lpi4a_defconfig               |   1 -
 doc/arch/sandbox/sandbox.rst                 |   5 +-
 drivers/iommu/apple_dart.c                   |   8 +-
 drivers/iommu/sandbox_iommu.c                |  35 +-
 fs/fs.c                                      |  10 +-
 include/alist.h                              |  11 +
 include/image.h                              |  28 +-
 include/lmb.h                                | 129 ++--
 lib/Kconfig                                  |  45 +-
 lib/Makefile                                 |   2 +-
 lib/efi_loader/efi_dt_fixup.c                |   2 +-
 lib/efi_loader/efi_helper.c                  |   2 +-
 lib/lmb.c                                    | 693 ++++++++++++-------
 net/tftp.c                                   |  39 +-
 net/wget.c                                   |   9 +-
 test/cmd/bdinfo.c                            |  41 +-
 test/lib/lmb.c                               | 542 +++++++--------
 74 files changed, 1044 insertions(+), 1191 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/include/mach/stm32mp.h
 create mode 100644 arch/powerpc/lib/misc.c

-- 
2.34.1



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

end of thread, other threads:[~2024-10-29  6:46 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26 11:59 [PATCH v4 00/27] Make LMB memory map global and persistent Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 01/27] alist: add a helper to check if the list is full Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 02/27] lmb: remove the unused lmb_is_reserved() function Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 03/27] lmb: staticize __lmb_alloc_base() Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 04/27] lmb: use the BIT macro for lmb flags Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 05/27] lmb: make LMB memory map persistent and global Sughosh Ganu
2024-09-16  6:04   ` Vaishnav Achath
2024-09-16  6:32     ` Sughosh Ganu
     [not found]   ` <65996987-dda0-4396-8624-1fbe1307facf@ti.com>
2024-09-16  6:29     ` Sughosh Ganu
2024-09-16  8:38       ` Vaishnav Achath
2024-09-16  9:16         ` Sughosh Ganu
2024-09-16 16:48           ` Vaishnav Achath
2024-09-16 18:11             ` Sughosh Ganu
2024-09-16  9:29         ` Sughosh Ganu
2024-10-28 21:20   ` Janne Grunau
2024-10-28 23:11     ` Tom Rini
2024-10-29  3:49     ` Sughosh Ganu
2024-10-29  4:32       ` Sughosh Ganu
2024-10-29  6:45         ` Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 06/27] lmb: allow for resizing lmb regions Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 07/27] lmb: remove config symbols used for lmb region count Sughosh Ganu
2024-08-27  6:24   ` Ilias Apalodimas
2024-08-26 11:59 ` [PATCH v4 08/27] lmb: config: add lmb config symbols for SPL Sughosh Ganu
2024-08-27  6:24   ` Ilias Apalodimas
2024-08-26 11:59 ` [PATCH v4 09/27] lmb: allow lmb module to be used in SPL Sughosh Ganu
2024-08-27  6:25   ` Ilias Apalodimas
2024-08-26 11:59 ` [PATCH v4 10/27] lmb: introduce a function to add memory to the lmb memory map Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 11/27] lmb: reserve common areas during board init Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 12/27] lmb: remove the lmb_init_and_reserve() function Sughosh Ganu
2024-08-27  6:26   ` Ilias Apalodimas
2024-08-26 11:59 ` [PATCH v4 13/27] lmb: remove lmb_init_and_reserve_range() function Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 14/27] lmb: bootm: remove superfluous lmb stub functions Sughosh Ganu
2024-08-27  6:27   ` Ilias Apalodimas
2024-08-26 11:59 ` [PATCH v4 15/27] lmb: init: initialise the lmb data structures during board init Sughosh Ganu
2024-08-27  6:27   ` Ilias Apalodimas
2024-08-26 11:59 ` [PATCH v4 16/27] ppc: lmb: move arch specific lmb reservations to arch_misc_init() Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 17/27] lmb: do away with arch_lmb_reserve() Sughosh Ganu
2024-08-27  6:34   ` Ilias Apalodimas
2024-08-26 11:59 ` [PATCH v4 18/27] lmb: remove the unused board_lmb_reserve() function Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 19/27] sandbox: move the TCG event log to the start of ram memory Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 20/27] spl: call spl_board_init() at the end of the spl init sequence Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 21/27] spl: sandbox: initialise the ram banksize in spl Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 22/27] sandbox: spl: enable lmb config for SPL Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 23/27] sandbox: iommu: remove lmb allocation in the driver Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 24/27] zynq: lmb: do not add to lmb map before relocation Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 25/27] stm32mp: allow calling optee_get_reserved_memory() from U-Boot Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 26/27] stm32mp: compute ram_top based on the optee base address Sughosh Ganu
2024-08-26 11:59 ` [PATCH v4 27/27] lmb: add logic to print lmb flag strings Sughosh Ganu
2024-09-04  0:20 ` [PATCH v4 00/27] Make LMB memory map global and persistent Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.