[PATCH] arm: relocate: Introduce data-only relocation mode
Tom Rini
trini at konsulko.com
Mon Mar 16 15:50:27 CET 2026
On Mon, Mar 16, 2026 at 12:54:05AM +0100, Marek Vasut wrote:
> Introduce new mode of relocation which relocates only data, not code.
> This is mainly meant to relocate data to read-write portion of the RAM,
> while the code remains in read-only portion of the RAM from which it is
> allowed to execute. This split configuration is present on various secure
> cores.
>
> The result of the relocation is U-Boot running at its original address,
> data relocated to the end of DRAM, but with added read-write area offset.
> The U-Boot binary area is not reserved from the end of the DRAM in this
> relocation mode, because U-Boot itself is not relocated.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
[snip]
> diff --git a/Kconfig b/Kconfig
> index ce25ea24a60..575ee3b574f 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -474,6 +474,23 @@ config SKIP_RELOCATE
> Skips relocation of U-Boot allowing for systems that have extremely
> limited RAM to run U-Boot.
>
> +config SKIP_RELOCATE_CODE
> + bool "Skips relocation of U-Boot code to end of RAM"
> + help
> + Skips relocation of U-Boot code to the end of RAM, but still does
> + relocate data to the end of RAM. This is mainly meant to relocate
> + data to read-write portion of the RAM, while the code remains in
> + read-only portion of the RAM from which it is allowed to execute.
> + This split configuration is present on various secure cores.
Is this really configurable, or is this determined by the SoC? This
feels like something a board should be select'ing rather than
configuring and I do worry about boards abusing this in the same of some
possibly dubious speed-up rather than the intented and valid use case.
[snip]
> diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
> index 6ee58f4edfe..b6a648708f4 100644
> --- a/arch/arm/lib/relocate.S
> +++ b/arch/arm/lib/relocate.S
> @@ -79,6 +79,15 @@ ENDPROC(relocate_vectors)
> ENTRY(relocate_code)
> relocate_base:
> adr r3, relocate_base
> +
> +#ifdef CONFIG_SKIP_RELOCATE_CODE
> + mov r4, #CONFIG_SKIP_RELOCATE_CODE_DATA_OFFSET
Spacing. But if there's no other comments and propmting the user is
correct, I can fix when applying.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260316/51f49c6b/attachment.sig>
More information about the U-Boot
mailing list