From: Michael Tretter <m.tretter@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Cc: Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH 0/9] ARM: rockchip: fix dynamic shared memory in OP-TEE
Date: Mon, 26 May 2025 16:38:06 +0200 [thread overview]
Message-ID: <20250526-rk3588-optee-v1-0-5004995cbd03@pengutronix.de> (raw)
On rk3588, OP-TEE uses the device tree to detect the available SDRAM
that should be used for dynamic shared memory. Since the amount of SDRAM
is detected during boot, the rk3588 device tree doesn't contain memory
nodes. Therefore, barebox has to detect the memory and add memory nodes
the device tree in the PBL before passing the device tree to the TF-A,
which passes it on to OP-TEE.
Adding nodes to the fdt increases the size of the fdt. As OP-TEE also
modifies and extends the passed device tree, the fdt grows even further
in OP-TEE. Therefore, there must be some extra reserved space in the
fdt. OP-TEE has CFG_DTB_MAX_SIZE as limit, which is the minimum amount
of space that must be reserved by barebox. The PBL_FDT_MIN_SIZE option
allows to configure this size as minimum.
I thought about adding disabled memory nodes to the dts and
enabling/fixing the existing nodes instead of adding new nodes. Finding
and fixing the correct existing node turned out to be more complex than
adding a new node. As we have to reserve some space in the fdt for
OP-TEE anyway, adding new nodes looks like the better solution.
The downstream TF-A may crash if barebox passes a device tree to it.
barebox cannot detect, if the loaded TF-A is downstream or upstream.
Therefore, add a config item to enable passing the device tree.
Patches 1 and 2 are some cleanup as preparation for actual changes.
Patches 3 to 6 extend the libfdt integration with helpers to modify and
add memory dt nodes.
Patches 7 to 9 add the rockchip specific code to read the memory size
from the DRAM controller, add memory dt nodes to the fdt, and pass the
fdt to the TF-A and OP-TEE.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
Michael Tretter (9):
ARM: rockchip: fix formatting
ARM: rockchip: dmc: use RK3588_INT_REG_START for rk3588
lib: fdt: add fdt_addresses
PBL: fdt: refactor helper for reading nr of cells
PBL: fdt: make minimum fdt size configurable
PBL: fdt: add fdt_fixup_mem to fixup memory nodes
ARM: rockchip: dmc: add rk3588_ram_sizes to get full ram size
ARM: rockchip: pass device tree to TF-A
ARM: rockchip: fixup memory in device tree for TF-A
arch/arm/mach-rockchip/Kconfig | 13 +++++++
arch/arm/mach-rockchip/atf.c | 62 ++++++++++++++++++------------
arch/arm/mach-rockchip/dmc.c | 37 ++++++++++++++++--
include/mach/rockchip/dmc.h | 2 +
include/pbl.h | 1 +
lib/Makefile | 2 +-
lib/fdt_addresses.c | 4 ++
pbl/Kconfig | 12 ++++++
pbl/fdt.c | 86 +++++++++++++++++++++++++++++++++++++-----
scripts/Makefile.lib | 2 +
10 files changed, 184 insertions(+), 37 deletions(-)
---
base-commit: fb35d7a2fe800260ca1ce2e189731e48ccefcf7b
change-id: 20250515-rk3588-optee-08cc33320963
Best regards,
--
Michael Tretter <m.tretter@pengutronix.de>
next 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 Michael Tretter [this message]
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 ` [PATCH 8/9] ARM: rockchip: pass device tree to TF-A Michael Tretter
2025-05-26 16:37 ` 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-0-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