[PATCH 07/18] common: add OPTEE_SHM_SIZE to configure optee shared memory

Marco Felsch m.felsch at pengutronix.de
Thu Jan 11 03:48:30 PST 2024


An size of 4M seems quite large and upstream OP-TEE code mostly uses 2M
for all i.MX platforms. However keep the 4M as default but make it
configurable for integrators which want to use the autom. OF fixup
logic.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 arch/arm/mach-imx/imx8m.c | 2 +-
 common/Kconfig            | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
index c7c799c64bc4..90dc12ca18cc 100644
--- a/arch/arm/mach-imx/imx8m.c
+++ b/arch/arm/mach-imx/imx8m.c
@@ -68,7 +68,7 @@ static int imx8m_init(const char *cputypestr)
 	if (IS_ENABLED(CONFIG_PBL_OPTEE) && tzc380_is_enabled() &&
 	    !of_find_node_by_path_from(NULL, "/firmware/optee")) {
 		static struct of_optee_fixup_data optee_fixup_data = {
-			.shm_size = SZ_4M,
+			.shm_size = CONFIG_OPTEE_SHM_SIZE,
 			.method = "smc",
 		};
 
diff --git a/common/Kconfig b/common/Kconfig
index 1de76651fddf..5b5da6224752 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1136,6 +1136,15 @@ config OPTEE_SIZE
 	  Can be smaller than the actual size used by OP-TEE, this is used to prevent
 	  barebox from allocating memory in this area.
 
+config OPTEE_SHM_SIZE
+	hex
+	default 0x400000
+	prompt "OP-TEE Shared Memory Size"
+	depends on HAVE_OPTEE
+	help
+	  Size to reserve in main memory for OP-TEE shared memory communication.
+	  Can be used for fixing up the OP-TEE OF node.
+
 config BOOTM_OPTEE
 	bool
 	prompt "support booting OP-TEE"
-- 
2.39.2




More information about the barebox mailing list