mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: rockchip: tfa: pass NULL fdt when there is none
@ 2026-06-09 12:40 Sascha Hauer
  2026-06-09 12:51 ` Michael Tretter
  2026-06-11 10:10 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-06-09 12:40 UTC (permalink / raw)
  To: Barebox List; +Cc: Michael Tretter

We pass an address to the TF-A even when there is none. The FDT could be
absent when either CONFIG_ARCH_ROCKCHIP_ATF_PASS_FDT is disabled or
copying it to the scratch area fails. Instead of passing an invalid FDT
in this case, explicitly pass a NULL pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-rockchip/atf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
index 74b8cdc2f4..0b4566f8ae 100644
--- a/arch/arm/mach-rockchip/atf.c
+++ b/arch/arm/mach-rockchip/atf.c
@@ -271,6 +271,8 @@ void __noreturn rk3588_barebox_entry(void *fdt)
 	rk_scratch = (void *)arm_mem_scratch(memend);
 
 	if (current_el() == 3) {
+		void *fdt_bl31 = NULL;
+
 		rk3588_lowlevel_init();
 		rockchip_store_bootrom_iram(IOMEM(RK3588_IRAM_BASE));
 		ROCKCHIP_GET_ADDRESSES(RK3588, rk3588_bl31_bin, rk3588_bl32_bin);
@@ -281,9 +283,11 @@ void __noreturn rk3588_barebox_entry(void *fdt)
 			ret = rockchip_create_optee_fdt(rk_scratch->fdt, sizeof(rk_scratch->fdt));
 			if (ret)
 				pr_warn("Failed to create OP-TEE Device tree\n");
+			else
+				fdt_bl31 = rk_scratch->fdt;
 		}
 
-		rockchip_atf_load_bl31(rk_scratch->fdt);
+		rockchip_atf_load_bl31(fdt_bl31);
 		/* not reached when CONFIG_ARCH_ROCKCHIP_ATF */
 	}
 
-- 
2.47.3




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: rockchip: tfa: pass NULL fdt when there is none
  2026-06-09 12:40 [PATCH] ARM: rockchip: tfa: pass NULL fdt when there is none Sascha Hauer
@ 2026-06-09 12:51 ` Michael Tretter
  2026-06-11 10:10 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tretter @ 2026-06-09 12:51 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Barebox List

On Tue, 09 Jun 2026 14:40:49 +0200, Sascha Hauer wrote:
> We pass an address to the TF-A even when there is none. The FDT could be
> absent when either CONFIG_ARCH_ROCKCHIP_ATF_PASS_FDT is disabled or
> copying it to the scratch area fails. Instead of passing an invalid FDT
> in this case, explicitly pass a NULL pointer.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Tested-by: Michael Tretter <m.tretter@pengutronix.de>

> ---
>  arch/arm/mach-rockchip/atf.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
> index 74b8cdc2f4..0b4566f8ae 100644
> --- a/arch/arm/mach-rockchip/atf.c
> +++ b/arch/arm/mach-rockchip/atf.c
> @@ -271,6 +271,8 @@ void __noreturn rk3588_barebox_entry(void *fdt)
>  	rk_scratch = (void *)arm_mem_scratch(memend);
>  
>  	if (current_el() == 3) {
> +		void *fdt_bl31 = NULL;
> +
>  		rk3588_lowlevel_init();
>  		rockchip_store_bootrom_iram(IOMEM(RK3588_IRAM_BASE));
>  		ROCKCHIP_GET_ADDRESSES(RK3588, rk3588_bl31_bin, rk3588_bl32_bin);
> @@ -281,9 +283,11 @@ void __noreturn rk3588_barebox_entry(void *fdt)
>  			ret = rockchip_create_optee_fdt(rk_scratch->fdt, sizeof(rk_scratch->fdt));
>  			if (ret)
>  				pr_warn("Failed to create OP-TEE Device tree\n");
> +			else
> +				fdt_bl31 = rk_scratch->fdt;
>  		}
>  
> -		rockchip_atf_load_bl31(rk_scratch->fdt);
> +		rockchip_atf_load_bl31(fdt_bl31);
>  		/* not reached when CONFIG_ARCH_ROCKCHIP_ATF */
>  	}
>  
> -- 
> 2.47.3
> 
> 

-- 
Pengutronix e.K.                           | Michael Tretter             |
Steuerwalder Str. 21                       | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: rockchip: tfa: pass NULL fdt when there is none
  2026-06-09 12:40 [PATCH] ARM: rockchip: tfa: pass NULL fdt when there is none Sascha Hauer
  2026-06-09 12:51 ` Michael Tretter
@ 2026-06-11 10:10 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-06-11 10:10 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer; +Cc: Michael Tretter


On Tue, 09 Jun 2026 14:40:49 +0200, Sascha Hauer wrote:
> We pass an address to the TF-A even when there is none. The FDT could be
> absent when either CONFIG_ARCH_ROCKCHIP_ATF_PASS_FDT is disabled or
> copying it to the scratch area fails. Instead of passing an invalid FDT
> in this case, explicitly pass a NULL pointer.
> 
> 

Applied, thanks!

[1/1] ARM: rockchip: tfa: pass NULL fdt when there is none
      https://git.pengutronix.de/cgit/barebox/commit/?id=9d178f370b25 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-11 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-09 12:40 [PATCH] ARM: rockchip: tfa: pass NULL fdt when there is none Sascha Hauer
2026-06-09 12:51 ` Michael Tretter
2026-06-11 10:10 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox