mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
	"Lucie L. Hartmann" <lucie@mntre.com>
Subject: [PATCH master] ARM: rockchip: hide CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE behind ATF_PASS_FDT
Date: Thu, 18 Jun 2026 17:16:58 +0200	[thread overview]
Message-ID: <20260618151700.671088-1-a.fatoum@pengutronix.de> (raw)

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




                 reply	other threads:[~2026-06-18 15:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260618151700.671088-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=lucie@mntre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox