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@xxxxxxxxxxxxxx> --- arch/arm/mach-imx/imx8m.c | 3 ++- common/Kconfig | 9 +++++++++ include/asm-generic/memory_layout.h | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c index c7c799c64bc4..ca50eec63622 100644 --- a/arch/arm/mach-imx/imx8m.c +++ b/arch/arm/mach-imx/imx8m.c @@ -8,6 +8,7 @@ #include <pm_domain.h> #include <asm/syscounter.h> #include <asm/system.h> +#include <asm-generic/memory_layout.h> #include <mach/imx/generic.h> #include <mach/imx/revision.h> #include <mach/imx/imx8mq.h> @@ -68,7 +69,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 = OPTEE_SHM_SIZE, .method = "smc", }; diff --git a/common/Kconfig b/common/Kconfig index c38cfaed0e9f..ddca1e913b18 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1140,6 +1140,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" diff --git a/include/asm-generic/memory_layout.h b/include/asm-generic/memory_layout.h index 7593e18da151..6af1db8113f2 100644 --- a/include/asm-generic/memory_layout.h +++ b/include/asm-generic/memory_layout.h @@ -19,6 +19,12 @@ #define OPTEE_SIZE 0 #endif +#ifdef CONFIG_OPTEE_SHM_SIZE +#define OPTEE_SHM_SIZE CONFIG_OPTEE_SHM_SIZE +#else +#define OPTEE_SHM_SIZE 0 +#endif + #define HEAD_TEXT_BASE MALLOC_BASE #define MALLOC_SIZE CONFIG_MALLOC_SIZE #define STACK_SIZE CONFIG_STACK_SIZE -- 2.39.2