From 2a579540a6fc2780035a8c759ca645564dfb2ddc Mon Sep 17 00:00:00 2001 From: John Tsichritzis Date: Wed, 22 Aug 2018 12:55:41 +0100 Subject: [PATCH] Support shared Mbed TLS heap for SGM Change-Id: Ibbfedb6601feff51dfb82c1d94850716c5a36d24 Signed-off-by: John Tsichritzis --- plat/arm/css/sgm/fdts/sgm_tb_fw_config.dts | 11 +++++++++++ plat/arm/css/sgm/sgm_mmap_config.c | 3 +++ plat/arm/css/sgm/sgm_plat_config.c | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/plat/arm/css/sgm/fdts/sgm_tb_fw_config.dts b/plat/arm/css/sgm/fdts/sgm_tb_fw_config.dts index 95025493b..d48101842 100644 --- a/plat/arm/css/sgm/fdts/sgm_tb_fw_config.dts +++ b/plat/arm/css/sgm/fdts/sgm_tb_fw_config.dts @@ -12,5 +12,16 @@ compatible = "arm,tb_fw"; hw_config_addr = <0x0 0x83000000>; hw_config_max_size = <0x01000000>; + /* + * The following two entries are placeholders for Mbed TLS + * heap information. The default values don't matter since + * they will be overwritten by BL1. + * In case of having shared Mbed TLS heap between BL1 and BL2, + * BL1 will populate these two properties with the respective + * info about the shared heap. This info will be available for + * BL2 in order to locate and re-use the heap. + */ + mbedtls_heap_addr = <0x0 0x0>; + mbedtls_heap_size = <0x0>; }; }; diff --git a/plat/arm/css/sgm/sgm_mmap_config.c b/plat/arm/css/sgm/sgm_mmap_config.c index 009ee6403..8a4a8ab03 100644 --- a/plat/arm/css/sgm/sgm_mmap_config.c +++ b/plat/arm/css/sgm/sgm_mmap_config.c @@ -42,6 +42,9 @@ const mmap_region_t plat_arm_mmap[] = { ARM_MAP_TSP_SEC_MEM, #ifdef SPD_opteed ARM_OPTEE_PAGEABLE_LOAD_MEM, +#endif +#if TRUSTED_BOARD_BOOT && LOAD_IMAGE_V2 && !BL2_AT_EL3 + ARM_MAP_BL1_RW, #endif {0} }; diff --git a/plat/arm/css/sgm/sgm_plat_config.c b/plat/arm/css/sgm/sgm_plat_config.c index 809edf68e..97b16a8f8 100644 --- a/plat/arm/css/sgm/sgm_plat_config.c +++ b/plat/arm/css/sgm/sgm_plat_config.c @@ -67,3 +67,13 @@ css_plat_config_t *get_plat_config(void) assert(css_plat_info != NULL); return css_plat_info; } + +#if TRUSTED_BOARD_BOOT && LOAD_IMAGE_V2 +int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size) +{ + assert(heap_addr != NULL); + assert(heap_size != NULL); + + return arm_get_mbedtls_heap(heap_addr, heap_size); +} +#endif