[PATCH master] ARM: rockchip: hide CONFIG_ARCH_ROCKCHIP_ATF_FDT_SIZE behind ATF_PASS_FDT
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Jun 18 08:16:58 PDT 2026
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 at mntre.com>
Fixes: 8dfab4e2aafa ("ARM: rockchip: pass device tree to TF-A")
Signed-off-by: Ahmad Fatoum <a.fatoum at 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
More information about the barebox
mailing list