Hi Simon,

On 2025-05-25 12:48, Simon Glass wrote:
> Where the bloblist is located in internal memory and TF-A's BL31 blob
> removes access to this memory, the best option seems to be to relocate
> the bloblist just before running TF-A.
> 
> Do this at the end of SPL.
> 
> Signed-off-by: Simon Glass <[email protected]>
> Suggested-by: Raymond Mao <[email protected]>
> ---
> 
> (no changes since v3)
> 
> Changes in v3:
> - Add the BLOBLIST_RELOC condition as well
> 
> Changes in v2:
> - Move this logic into board-specific code
> 
>  arch/arm/mach-rockchip/spl.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
> index 305373a161c..a919246c4aa 100644
> --- a/arch/arm/mach-rockchip/spl.c
> +++ b/arch/arm/mach-rockchip/spl.c
> @@ -3,6 +3,7 @@
>   * (C) Copyright 2019 Rockchip Electronics Co., Ltd
>   */
>  
> +#include <bloblist.h>
>  #include <cpu_func.h>
>  #include <debug_uart.h>
>  #include <dm.h>
> @@ -133,6 +134,20 @@ void board_init_f(ulong dummy)
>  
>  void spl_board_prepare_for_boot(void)
>  {
> +     /*
> +      * On RK3399, TF-A is executed after SPL and before U-Boot. It removes
> +      * our access to the IRAM. So move the bloblist to RAM.

Please rephrase this as TF-A is executed after SPL and before U-Boot
proper for all Rockchip AArch64 not just RK3399. Also please reference
SRAM instead of IRAM, as SRAM is what is referenced in Rockchip docs.

> +      */
> +     if (xpl_phase() == PHASE_SPL && IS_ENABLED(CONFIG_VPL) &&

It does not make sense to make this VPL only, as relocation of bloblist
could possible be used without VPL?

Regards,
Jonas

> +         CONFIG_IS_ENABLED(BLOBLIST_RELOC)) {
> +             ulong addr = CONFIG_IF_ENABLED_INT(BLOBLIST_RELOC,
> +                                                BLOBLIST_RELOC_ADDR);
> +
> +             log_debug("Relocating bloblist %p to %lx\n", gd_bloblist(),
> +                       addr);
> +             bloblist_reloc(map_sysmem(addr, 0), bloblist_get_total_size());
> +     }
> +
>       if (!IS_ENABLED(CONFIG_ARM64) || CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
>               return;
>  

Reply via email to