[PATCH 1/4] common/spl: fit: Avoid directly loading images to load_addr
Jonas Karlman
jonas at kwiboo.se
Thu Dec 11 13:27:01 CET 2025
Hi Alexey,
On 12/10/2025 9:10 PM, Alexey Charkov wrote:
> Load images unconditionally to a known-safe location (which is
> CONFIG_SYS_LOAD_ADDR) to be later relocated to its desired load address.
>
> Some storage devices may be unable to directly load each of the images
> listed in a FIT to their desired load addresses, as is the case with
> e.g. booting from UFS storage on Rockchip RK3576, where part of the
> ATF should end up in SRAM but the UFS controller cannot directly write
> there.
>
> Furthermore, the code down the line does a memmove or image decompression
> from the original src_ptr, anyway, so there shouldn't be any performance
> implications from this change.
If I am not mistaken the memmove will try to move the src_ptr into
load_addr and as long as they are same this is a no-op, so I am
expecting this will have performance implications.
I suggest we instead try to configure the rk3576 firewall to allow the
UFS controller to access SRAM (SYSMEM) similar to how this is allowed on
e.g. rk3588. Please see U-Boot rk3576.c and rk3588.c, and also TF-A
plat/rockchip/rk3576/drivers/secure/firewall.c.
For other Rockchip SoCs we have also used non-DMA mode or a bounce
buffer to work around similar issue in the drivers.
On a final note I would not fully trust the SYS_LOAD_ADDR addr on
Rockchip platform, to my knowledge this is not really used for anything
and because of this have not fully been considered when other static
load addresses have been picked, so this could introduce some unintended
overlaps.
Regards,
Jonas
>
> Signed-off-by: Alexey Charkov <alchark at gmail.com>
> ---
> common/spl/spl_fit.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index a588d13eb402..f10c0ca7d281 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -291,11 +291,7 @@ static int load_simple_fit(struct spl_load_info *info, ulong fit_offset,
> return 0;
> }
>
> - if (spl_decompression_enabled() &&
> - (image_comp == IH_COMP_GZIP || image_comp == IH_COMP_LZMA))
> - src_ptr = map_sysmem(ALIGN(CONFIG_SYS_LOAD_ADDR, ARCH_DMA_MINALIGN), len);
> - else
> - src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len);
> + src_ptr = map_sysmem(ALIGN(CONFIG_SYS_LOAD_ADDR, ARCH_DMA_MINALIGN), len);
> length = len;
>
> overhead = get_aligned_image_overhead(info, offset);
>
More information about the U-Boot
mailing list