Skip to content

spl: Support a relocating jump between phases (VBE part F)

Simon Glass qemu-devel u-boot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19spl: Reduce the size of the bl_len fieldinclude/spl.h+1 -13 replies
2/19spl: Provide a way of indicating the phase to loadinclude/spl.h+23 -00 replies
3/19spl: Avoid including hash algorithms which are not wantedlib/Makefile+3 -30 replies
4/19spl: Provide a way to mark code needed for relocationinclude/asm-generic/sections.h+16 -02 replies
5/19lib: Mark crc8 as relocation codelib/crc8.c+3 -20 replies
6/19lib: Mark lz4 as relocation codelib/lz4.c lib/lz4_wrapper.c+16 -131 reply
7/19lib: Mark memcpy() and memmove() as relocation codelib/string.c+3 -20 replies
8/19spl: Add a type for the jumper functioncommon/spl/spl.c include/spl.h+4 -20 replies
9/19spl: Add support for a relocating jump to the next phaseMAINTAINERS common/spl/Kconfig common/spl/Kconfig.tpl +5 more+279 -00 replies
10/19spl: Plumb in the relocating loadercommon/spl/spl.c+12 -00 replies
11/19spl: Support jumping to VPL from TPLcommon/spl/spl.c+16 -63 replies
12/19spl: Record the correct name of the next phasecommon/spl/spl.c+1 -10 replies
13/19spl: Show how to fill in the size of the next imagecommon/spl/spl.c+1 -00 replies
14/19spl: Add debugging in spl_set_header_raw_uboot()common/spl/spl.c+5 -00 replies
15/19arm: qemu: Allow SPL and TPLarch/arm/Kconfig+2 -00 replies
16/19arm: Add a new qemu_arm64_tpl boardarch/arm/dts/qemu-arm64.dts arch/arm/mach-qemu/Kconfig board/emulation/qemu-arm/Kconfig +5 more+166 -10 replies
17/19arm: Provide an rcode section in ARMv8 link scriptarch/arm/cpu/armv8/u-boot-spl.lds+8 -00 replies
18/19arm: qemu_arm64_tpl: Enable the relocating loaderarch/arm/dts/qemu-arm64.dts board/emulation/qemu-arm/xpl.c configs/qemu_arm64_tpl_defconfig +1 more+38 -20 replies
19/19CI: Add new test for reloc loader.azure-pipelines.yml .gitlab-ci.yml+9 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 00/19] spl: Support a relocating jump between phases (VBE part F)

This series includes a way to deal with multiple XPL phases being built to run from the same region of SRAM. This is useful because it may not be possible to fit all the different phases in different parts of the SRAM. Also it is a pain to have to build them with different values for CONFIG_TEXT_BASE such that they can be loaded at different addresses.

The mechanism is to copy some relocation code to the top of memory, then load the next phase below that. Finally, the first phase jumps to the relocation code, which copies or decompresses the next phase, overwriting the first phase in the process. Finally, the relocation code jumps to the start of the next phase.

In this way the maximum amount of space can be used, particular if the next phase is compressed.

For this to work, some code in U-Boot must be placed in a 'rcode' (relocation code) section. This ensures it can be copied as a block, thus reducing the amount of the first-stage code which needs to survive the relocation process.

For now there is a qemu-arm64 test for this feature, which ensures that the basic mechanism is sound. Further work will likely expand this test to include VPL and LZ4-compression, which so far have only been used on real hardware.

Overall, without SPL_RELOC_LOADER enabled, this series provides a very small code-size benefit due to it dropping some unneeded symbols.

Simon Glass (19):
spl: Reduce the size of the bl_len field
spl: Provide a way of indicating the phase to load
spl: Avoid including hash algorithms which are not wanted
spl: Provide a way to mark code needed for relocation
lib: Mark crc8 as relocation code
lib: Mark lz4 as relocation code
lib: Mark memcpy() and memmove() as relocation code
spl: Add a type for the jumper function
spl: Add support for a relocating jump to the next phase
spl: Plumb in the relocating loader
spl: Support jumping to VPL from TPL
spl: Record the correct name of the next phase
spl: Show how to fill in the size of the next image
spl: Add debugging in spl_set_header_raw_uboot()
arm: qemu: Allow SPL and TPL
arm: Add a new qemu_arm64_tpl board
arm: Provide an rcode section in ARMv8 link script
arm: qemu_arm64_tpl: Enable the relocating loader
CI: Add new test for reloc loader

 .azure-pipelines.yml                  |   3 +
 .gitlab-ci.yml                        |   6 +
 MAINTAINERS                           |   6 +
 arch/arm/Kconfig                      |   2 +
 arch/arm/cpu/armv8/u-boot-spl.lds     |   8 ++
 arch/arm/dts/qemu-arm64.dts           |  17 +++
 arch/arm/mach-qemu/Kconfig            |  20 +++
 board/emulation/qemu-arm/Kconfig      |   2 +-
 board/emulation/qemu-arm/MAINTAINERS  |   5 +
 board/emulation/qemu-arm/Makefile     |   1 +
 board/emulation/qemu-arm/qemu-arm.env |   4 +
 board/emulation/qemu-arm/xpl.c        |  50 +++++++
 common/spl/Kconfig                    |   9 ++
 common/spl/Kconfig.tpl                |   9 ++
 common/spl/Kconfig.vpl                |   8 ++
 common/spl/Makefile                   |   1 +
 common/spl/spl.c                      |  45 +++++--
 common/spl/spl_reloc.c                | 182 ++++++++++++++++++++++++++
 configs/qemu_arm64_tpl_defconfig      |  83 ++++++++++++
 doc/develop/spl.rst                   |  35 +++++
 include/asm-generic/sections.h        |  16 +++
 include/spl.h                         |  57 +++++++-
 lib/Makefile                          |   6 +-
 lib/crc8.c                            |   5 +-
 lib/lz4.c                             |  27 ++--
 lib/lz4_wrapper.c                     |   2 +-
 lib/string.c                          |   5 +-
 test/py/tests/test_reloc.py           |  21 +++
 28 files changed, 604 insertions(+), 31 deletions(-)
 create mode 100644 board/emulation/qemu-arm/xpl.c
 create mode 100644 common/spl/spl_reloc.c
 create mode 100644 configs/qemu_arm64_tpl_defconfig
 create mode 100644 test/py/tests/test_reloc.py
Signature · 1 line
2.43.0