mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/9] ARM: rockchip: fix dynamic shared memory in OP-TEE
@ 2025-05-26 14:38 Michael Tretter
  2025-05-26 14:38 ` [PATCH 1/9] ARM: rockchip: fix formatting Michael Tretter
                   ` (8 more replies)
  0 siblings, 9 replies; 31+ messages in thread
From: Michael Tretter @ 2025-05-26 14:38 UTC (permalink / raw)
  To: BAREBOX; +Cc: Michael Tretter

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>




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

end of thread, other threads:[~2025-05-28  8:28 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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

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