From 1634cae89d0e62853f6addbbaef8557893ee5613 Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Tue, 22 May 2018 10:09:10 +0100 Subject: context_mgmt: Make cm_init_context_common public This function can be currently accessed through the wrappers cm_init_context_by_index() and cm_init_my_context(). However, they only work on contexts that are associated to a CPU. By making this function public, it is possible to set up a context that isn't associated to any CPU. For consistency, it has been renamed to cm_setup_context(). Change-Id: Ib2146105abc8137bab08745a8adb30ca2c4cedf4 Signed-off-by: Antonio Nino Diaz --- include/lib/el3_runtime/context_mgmt.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/lib/el3_runtime/context_mgmt.h b/include/lib/el3_runtime/context_mgmt.h index eb7a95345..e3f7726a8 100644 --- a/include/lib/el3_runtime/context_mgmt.h +++ b/include/lib/el3_runtime/context_mgmt.h @@ -7,11 +7,11 @@ #ifndef __CM_H__ #define __CM_H__ -#ifndef AARCH32 #include #include +#include +#include #include -#endif /******************************************************************************* * Forward declarations @@ -32,6 +32,7 @@ void cm_set_context(void *context, uint32_t security_state); void cm_init_my_context(const struct entry_point_info *ep); void cm_init_context_by_index(unsigned int cpu_idx, const struct entry_point_info *ep); +void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep); void cm_prepare_el3_exit(uint32_t security_state); #ifndef AARCH32 -- cgit v1.2.3 From 22282bb68a319a88f2fc0e6c98c13c42a4e0120b Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Wed, 23 May 2018 11:40:46 +0100 Subject: SPM: Move all SP-related info to SP context struct Move all information related to a Secure Partition to the struct secure_partition_context_t. This requires an in-depth refactor because most of the previous code of SPM relied on global information. Change-Id: I0a23e93817dcc191ce1d7506b8bc671d376123c4 Signed-off-by: Antonio Nino Diaz --- include/services/secure_partition.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/services/secure_partition.h b/include/services/secure_partition.h index f68f711be..f1fdb733f 100644 --- a/include/services/secure_partition.h +++ b/include/services/secure_partition.h @@ -55,8 +55,4 @@ typedef struct secure_partition_boot_info { secure_partition_mp_info_t *mp_info; } secure_partition_boot_info_t; -/* Setup function for secure partitions context. */ - -void secure_partition_setup(void); - #endif /* __SECURE_PARTITION_H__ */ -- cgit v1.2.3 From e829a3796fb2e66a68b60a22ebce6dca05c80a71 Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Thu, 24 May 2018 09:14:58 +0100 Subject: plat/arm: SPM: Force BL31 to DRAM when SPM is used BL31 is running out of space, and the use-case of SPM doesn't require it to be in SRAM. To prevent BL31 from running out of space in the future, move BL31 to DRAM if SPM is enabled. Secure Partition Manager design document updated to reflect the changes. Increased the size of the stack of BL31 for builds with SPM. The translation tables used by SPM in Arm platforms have been moved back to the 'xlat_tables' region instead of 'arm_el3_tzc_dram'. Everything is in DRAM now, so it doesn't make sense to treat them in a different way. Change-Id: Ia6136c8e108b8da9edd90e9d72763dada5e5e5dc Signed-off-by: Antonio Nino Diaz --- include/plat/arm/board/common/board_arm_def.h | 10 ++++++++-- include/plat/arm/common/arm_spm_def.h | 6 ------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/plat/arm/board/common/board_arm_def.h b/include/plat/arm/board/common/board_arm_def.h index 845f14037..e9e1731a0 100644 --- a/include/plat/arm/board/common/board_arm_def.h +++ b/include/plat/arm/board/common/board_arm_def.h @@ -30,7 +30,9 @@ #elif defined(IMAGE_BL2U) # define PLATFORM_STACK_SIZE 0x200 #elif defined(IMAGE_BL31) -#ifdef PLAT_XLAT_TABLES_DYNAMIC +#if ENABLE_SPM +# define PLATFORM_STACK_SIZE 0x500 +#elif PLAT_XLAT_TABLES_DYNAMIC # define PLATFORM_STACK_SIZE 0x800 #else # define PLATFORM_STACK_SIZE 0x400 @@ -94,7 +96,11 @@ * PLAT_ARM_MAX_BL31_SIZE is calculated using the current BL31 debug size plus a * little space for growth. */ -#define PLAT_ARM_MAX_BL31_SIZE 0x20000 +#if ENABLE_SPM +# define PLAT_ARM_MAX_BL31_SIZE 0x40000 +#else +# define PLAT_ARM_MAX_BL31_SIZE 0x20000 +#endif #ifdef AARCH32 /* diff --git a/include/plat/arm/common/arm_spm_def.h b/include/plat/arm/common/arm_spm_def.h index 3f5c958d5..83277a6c5 100644 --- a/include/plat/arm/common/arm_spm_def.h +++ b/include/plat/arm/common/arm_spm_def.h @@ -98,12 +98,6 @@ /* Total number of memory regions with distinct properties */ #define ARM_SP_IMAGE_NUM_MEM_REGIONS 6 -/* - * Name of the section to put the translation tables used by the S-EL1/S-EL0 - * context of a Secure Partition. - */ -#define PLAT_SP_IMAGE_XLAT_SECTION_NAME "arm_el3_tzc_dram" - /* Cookies passed to the Secure Partition at boot. Not used by ARM platforms. */ #define PLAT_SPM_COOKIE_0 ULL(0) #define PLAT_SPM_COOKIE_1 ULL(0) -- cgit v1.2.3