From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: "Tom Rini" <trini@konsulko.com>, "Simon Glass" <sjg@chromium.org>,
"Albert Aribaud" <albert.u.boot@aribaud.net>,
"Andre Przywara" <andre.przywara@arm.com>,
"Andrejs Cainikovs" <andrejs.cainikovs@toradex.com>,
"Andrew Davis" <afd@ti.com>,
"Caleb Connolly" <caleb.connolly@linaro.org>,
"Csókás Bence" <csokas.bence@prolan.hu>,
"Devarsh Thakkar" <devarsht@ti.com>,
"Gary Bisson" <bisson.gary@gmail.com>,
"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Kever Yang" <kever.yang@rock-chips.com>,
"Lukas Funke" <lukas.funke@weidmueller.com>,
"Manoj Sai" <abbaraju.manojsai@amarulasolutions.com>,
"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
"Marek Vasut" <marex@denx.de>,
"Mathieu Othacehe" <m.othacehe@gmail.com>,
"Mattijs Korpershoek" <mkorpershoek@baylibre.com>,
"Michal Simek" <michal.simek@amd.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Nishanth Menon" <nm@ti.com>,
"Paul Kocialkowski" <contact@paulk.fr>,
"Peng Fan" <peng.fan@nxp.com>,
"Peter Robinson" <pbrobinson@gmail.com>,
"Quentin Schulz" <quentin.schulz@cherry.de>,
"Rayagonda Kokatanur" <rayagonda.kokatanur@broadcom.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Robert Marko" <robert.marko@sartura.hr>,
"Sam Edwards" <CFSworks@gmail.com>,
"Sam Protsenko" <semen.protsenko@linaro.org>,
"Samuel Holland" <samuel@sholland.org>,
"Sean Anderson" <seanga2@gmail.com>,
"Sughosh Ganu" <sughosh.ganu@linaro.org>,
"Sumit Garg" <sumit.garg@linaro.org>,
"Suniel Mahesh" <sunil@amarulasolutions.com>,
"Tuomas Tynkkynen" <tuomas.tynkkynen@iki.fi>,
"Venkatesh Yadav Abbarapu" <venkatesh.abbarapu@amd.com>,
qemu-devel@nongnu.org
Subject: [PATCH 00/19] spl: Support a relocating jump between phases (VBE part F)
Date: Wed, 25 Sep 2024 14:55:26 +0200 [thread overview]
Message-ID: <20240925125622.197915-1-sjg@chromium.org> (raw)
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
--
2.43.0
next reply other threads:[~2024-09-25 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 12:55 Simon Glass [this message]
2024-09-25 12:55 ` [PATCH 15/19] arm: qemu: Allow SPL and TPL Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240925125622.197915-1-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=CFSworks@gmail.com \
--cc=abbaraju.manojsai@amarulasolutions.com \
--cc=afd@ti.com \
--cc=albert.u.boot@aribaud.net \
--cc=andre.przywara@arm.com \
--cc=andrejs.cainikovs@toradex.com \
--cc=bisson.gary@gmail.com \
--cc=caleb.connolly@linaro.org \
--cc=contact@paulk.fr \
--cc=csokas.bence@prolan.hu \
--cc=devarsht@ti.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kever.yang@rock-chips.com \
--cc=lukas.funke@weidmueller.com \
--cc=m.othacehe@gmail.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=marex@denx.de \
--cc=michal.simek@amd.com \
--cc=mkorpershoek@baylibre.com \
--cc=neil.armstrong@linaro.org \
--cc=nm@ti.com \
--cc=pbrobinson@gmail.com \
--cc=peng.fan@nxp.com \
--cc=qemu-devel@nongnu.org \
--cc=quentin.schulz@cherry.de \
--cc=rayagonda.kokatanur@broadcom.com \
--cc=richard.henderson@linaro.org \
--cc=robert.marko@sartura.hr \
--cc=samuel@sholland.org \
--cc=seanga2@gmail.com \
--cc=semen.protsenko@linaro.org \
--cc=sughosh.ganu@linaro.org \
--cc=sumit.garg@linaro.org \
--cc=sunil@amarulasolutions.com \
--cc=trini@konsulko.com \
--cc=tuomas.tynkkynen@iki.fi \
--cc=u-boot@lists.denx.de \
--cc=venkatesh.abbarapu@amd.com \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).