mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] ARM: rockchip: hide CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE behind ATF_PASS_FDT
@ 2026-06-18 15:16 Ahmad Fatoum
  2026-06-22  6:21 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-06-18 15:16 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, Lucie L. Hartmann

If a user had configured barebox before the addition of
CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE, updating barebox to a newer version
would set the variable to its default of 0.

If they then enable CONFIG_ARCH_ROCKCHIP_ATF_PASS_FDT, the default were
not be reapplied thus ending up with
CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE=0, which is guaranteed to fail.

In older barebox versions, this had a chance of hanging during BL31
setup, because an uninitialized FDT pointer was passed to TF-A.

This is fixed now, but still the default settings for
CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE are likely to confuse users interested
in passing along the FDT.

Improve the situation a bit by hiding CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE
behind CONFIG_ARCH_ROCKCHIP_ATF_PASS_FDT and having only a single default.

This is not the neatest solution, because now users will likely get a
build error, because CONFIG_SCRATCH_SIZE will need to be increased in
accordance, but at least it's a build-time failure rather than runtime..

Reported-by: Lucie L. Hartmann <lucie@mntre.com>
Fixes: 8dfab4e2aafa ("ARM: rockchip: pass device tree to TF-A")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-rockchip/Kconfig  | 7 +++----
 include/mach/rockchip/bootrom.h | 8 +++++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 454499834081..3fd4498c64c1 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -187,10 +187,9 @@ config ARCH_ROCKCHIP_ATF_PASS_FDT
 	  enabled.
 
 config ARCH_ROCKCHIP_ATF_FDT_SIZE
-	hex
-	default 0x0
-	default 0x60000 if ARCH_ROCKCHIP_ATF_PASS_FDT
-	prompt "Reserved size for the FDT blob passed to the TF-A"
+	hex "Reserved size for the FDT blob passed to the TF-A"
+	depends on ARCH_ROCKCHIP_ATF_PASS_FDT
+	default 0x60000
 	help
 	  Set this size to CFG_DTB_MAX_SIZE in the OP-TEE configuration. OP-TEE
 	  may modify the passed device tree and increase it's size. This
diff --git a/include/mach/rockchip/bootrom.h b/include/mach/rockchip/bootrom.h
index fc63e793783b..3caa66cded74 100644
--- a/include/mach/rockchip/bootrom.h
+++ b/include/mach/rockchip/bootrom.h
@@ -10,11 +10,17 @@
 #include <tee/optee.h>
 #include <pbl.h>
 
+#ifdef CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE
+#define ROCKCHIP_ATF_FDT_SIZE CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE
+#else
+#define ROCKCHIP_ATF_FDT_SIZE 0
+#endif
+
 struct rockchip_scratch_space {
 	u32 iram[16];
 	struct optee_header optee_hdr;
 	/* FDT needs an 8 byte alignment */
-	u8 fdt[CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE] __aligned(8);
+	u8 fdt[ROCKCHIP_ATF_FDT_SIZE] __aligned(8);
 };
 static_assert(sizeof(struct rockchip_scratch_space) <= CONFIG_SCRATCH_SIZE);
 
-- 
2.47.3




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

* Re: [PATCH master] ARM: rockchip: hide CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE behind ATF_PASS_FDT
  2026-06-18 15:16 [PATCH master] ARM: rockchip: hide CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE behind ATF_PASS_FDT Ahmad Fatoum
@ 2026-06-22  6:21 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-06-22  6:21 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum; +Cc: Lucie L. Hartmann


On Thu, 18 Jun 2026 17:16:58 +0200, Ahmad Fatoum wrote:
> If a user had configured barebox before the addition of
> CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE, updating barebox to a newer version
> would set the variable to its default of 0.
> 
> If they then enable CONFIG_ARCH_ROCKCHIP_ATF_PASS_FDT, the default were
> not be reapplied thus ending up with
> CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE=0, which is guaranteed to fail.
> 
> [...]

Applied, thanks!

[1/1] ARM: rockchip: hide CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE behind ATF_PASS_FDT
      https://git.pengutronix.de/cgit/barebox/commit/?id=da91ab6cb505 (link may not be stable)

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




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

end of thread, other threads:[~2026-06-22  6:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-18 15:16 [PATCH master] ARM: rockchip: hide CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE behind ATF_PASS_FDT Ahmad Fatoum
2026-06-22  6:21 ` Sascha Hauer

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