From: Michael Tretter <m.tretter@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Cc: Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH 8/9] ARM: rockchip: pass device tree to TF-A
Date: Mon, 26 May 2025 16:38:14 +0200 [thread overview]
Message-ID: <20250526-rk3588-optee-v1-8-5004995cbd03@pengutronix.de> (raw)
In-Reply-To: <20250526-rk3588-optee-v1-0-5004995cbd03@pengutronix.de>
The upstream OP-TEE expects a device tree to be able to initialize the
dynamic shared memory. Therefore, barebox should pass a device tree that
contains memory nodes through the TF-A to OP-TEE.
Unfortunately, the downstream TF-A fails to start if barebox passes its
device tree and it is not possible to detect if the loaded TF-A is able
to handle the device tree. Add a config option to pass the device tree
if it is possible.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
arch/arm/mach-rockchip/Kconfig | 13 +++++++++++++
arch/arm/mach-rockchip/atf.c | 15 ++++-----------
pbl/Kconfig | 1 +
3 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 98dfd11c182b9fee6e3c958653ad4fa8a7d98d84..257c13bcf4846e805a7803105c71edeff92c534d 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -141,6 +141,19 @@ config ARCH_ROCKCHIP_ATF
useful for debugging early startup, but for all other cases,
say y here.
+config ARCH_ROCKCHIP_ATF_PASS_FDT
+ bool "Pass device tree to TF-A"
+ depends on ARCH_ROCKCHIP_ATF
+ help
+ Enable this option if you are using an upstream OP-TEE that uses the
+ device tree to initialize dynamic shared memory, which is passed
+ through the upstream TF-A.
+
+ Disable the option if you are using a downstream TF-A since it
+ doesn't always cope with device trees. Supposedly this happens if the
+ device tree is too large, for example if CONFIG_OF_OVERLAY_LIVE is
+ enabled.
+
config ARCH_ROCKCHIP_OPTEE
bool "Build rockchip OP-TEE binary into barebox"
depends on ARCH_ROCKCHIP_ATF
diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
index cfa6df043b34c0f36919048237c7ecf33dfe0724..12cf13717b6972c2eafc5a044ae8d0b4de029c32 100644
--- a/arch/arm/mach-rockchip/atf.c
+++ b/arch/arm/mach-rockchip/atf.c
@@ -186,18 +186,11 @@ void __noreturn rk3588_barebox_entry(void *fdt)
rk3588_lowlevel_init();
rockchip_store_bootrom_iram(IOMEM(RK3588_IRAM_BASE));
- /*
- * The downstream TF-A doesn't cope with our device tree when
- * CONFIG_OF_OVERLAY_LIVE is enabled, supposedly because it is
- * too big for some reason. Otherwise it doesn't have any visible
- * effect if we pass a device tree or not, except that the TF-A
- * fills in the ethernet MAC address into the device tree.
- * The upstream TF-A doesn't use the device tree at all.
- *
- * Pass NULL for now until we have a good reason to pass a real
- * device tree.
- */
+#ifdef CONFIG_ARCH_ROCKCHIP_ATF_PASS_FDT
+ rk3588_atf_load_bl31(fdt);
+#else
rk3588_atf_load_bl31(NULL);
+#endif
/* not reached when CONFIG_ARCH_ROCKCHIP_ATF */
}
diff --git a/pbl/Kconfig b/pbl/Kconfig
index 489b2001a855d62e11a2159311332b0e67f3a754..3dfc7de3e80da12a6313e84175275070274b9a5d 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -63,6 +63,7 @@ config PBL_CLOCKSOURCE
config PBL_FDT_MIN_SIZE
hex
default 0x0
+ default 0x60000 if ARCH_ROCKCHIP_ATF_PASS_FDT
prompt "Minimum size of the FDT blob"
help
The TF-A or OP-TEE may modify the FDT or add nodes to the FDT. This
--
2.39.5
next prev parent reply other threads:[~2025-05-26 14:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-26 14:38 [PATCH 0/9] ARM: rockchip: fix dynamic shared memory in OP-TEE Michael Tretter
2025-05-26 14:38 ` [PATCH 1/9] ARM: rockchip: fix formatting Michael Tretter
2025-05-26 17:30 ` Marco Felsch
2025-05-26 14:38 ` [PATCH 2/9] ARM: rockchip: dmc: use RK3588_INT_REG_START for rk3588 Michael Tretter
2025-05-26 17:29 ` Marco Felsch
2025-05-26 14:38 ` [PATCH 3/9] lib: fdt: add fdt_addresses Michael Tretter
2025-05-26 17:29 ` Marco Felsch
2025-05-26 14:38 ` [PATCH 4/9] PBL: fdt: refactor helper for reading nr of cells Michael Tretter
2025-05-26 17:30 ` Marco Felsch
2025-05-26 14:38 ` [PATCH 5/9] PBL: fdt: make minimum fdt size configurable Michael Tretter
2025-05-27 6:41 ` Sascha Hauer
2025-05-27 8:48 ` Michael Tretter
2025-05-27 18:45 ` Sascha Hauer
2025-05-28 8:24 ` Michael Tretter
2025-05-26 14:38 ` [PATCH 6/9] PBL: fdt: add fdt_fixup_mem to fixup memory nodes Michael Tretter
2025-05-27 6:22 ` Sascha Hauer
2025-05-27 8:34 ` Michael Tretter
2025-05-27 18:51 ` Sascha Hauer
2025-05-26 14:38 ` [PATCH 7/9] ARM: rockchip: dmc: add rk3588_ram_sizes to get full ram size Michael Tretter
2025-05-26 16:33 ` Marco Felsch
2025-05-27 6:25 ` Sascha Hauer
2025-05-27 8:39 ` Michael Tretter
2025-05-27 9:06 ` Marco Felsch
2025-05-26 14:38 ` Michael Tretter [this message]
2025-05-26 16:37 ` [PATCH 8/9] ARM: rockchip: pass device tree to TF-A Marco Felsch
2025-05-27 8:03 ` Michael Tretter
2025-05-26 14:38 ` [PATCH 9/9] ARM: rockchip: fixup memory in device tree for TF-A Michael Tretter
2025-05-26 17:25 ` Marco Felsch
2025-05-27 8:16 ` Michael Tretter
2025-05-27 9:40 ` Marco Felsch
2025-05-27 10:19 ` Michael Tretter
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=20250526-rk3588-optee-v1-8-5004995cbd03@pengutronix.de \
--to=m.tretter@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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