diff --git a/docs/components/secure-partition-manager-design.rst b/docs/components/secure-partition-manager-design.rst index de0792d..5c75baf 100644 --- a/docs/components/secure-partition-manager-design.rst +++ b/docs/components/secure-partition-manager-design.rst @@ -160,7 +160,7 @@ Partition. - ``plat_get_secure_partition_boot_info()`` returns a - ``secure_partition_boot_info_t`` struct that is populated by the platform + ``spm_mm_boot_info_t`` struct that is populated by the platform with information about the memory map of the Secure Partition. For an example of all the changes in context, you may refer to commit diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index eeae621..9efb2fd 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -22,7 +22,7 @@ struct bl_load_info; struct bl_params; struct mmap_region; -struct secure_partition_boot_info; +struct spm_mm_boot_info; struct sp_res_desc; /******************************************************************************* @@ -267,7 +267,7 @@ * Secure Partitions functions ******************************************************************************/ const struct mmap_region *plat_get_secure_partition_mmap(void *cookie); -const struct secure_partition_boot_info *plat_get_secure_partition_boot_info( +const struct spm_mm_boot_info *plat_get_secure_partition_boot_info( void *cookie); int plat_spm_sp_rd_load(struct sp_res_desc *rd, const void *ptr, size_t size); int plat_spm_sp_get_next_address(void **sp_base, size_t *sp_size, diff --git a/include/services/secure_partition.h b/include/services/secure_partition.h deleted file mode 100644 index 0510f80..0000000 --- a/include/services/secure_partition.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef SECURE_PARTITION_H -#define SECURE_PARTITION_H - -#if SPM_MM - -#include - -#include - -/* - * Flags used by the secure_partition_mp_info structure to describe the - * characteristics of a cpu. Only a single flag is defined at the moment to - * indicate the primary cpu. - */ -#define MP_INFO_FLAG_PRIMARY_CPU U(0x00000001) - -/* - * This structure is used to provide information required to initialise a S-EL0 - * partition. - */ -typedef struct secure_partition_mp_info { - uint64_t mpidr; - uint32_t linear_id; - uint32_t flags; -} secure_partition_mp_info_t; - -typedef struct secure_partition_boot_info { - param_header_t h; - uint64_t sp_mem_base; - uint64_t sp_mem_limit; - uint64_t sp_image_base; - uint64_t sp_stack_base; - uint64_t sp_heap_base; - uint64_t sp_ns_comm_buf_base; - uint64_t sp_shared_buf_base; - uint64_t sp_image_size; - uint64_t sp_pcpu_stack_size; - uint64_t sp_heap_size; - uint64_t sp_ns_comm_buf_size; - uint64_t sp_shared_buf_size; - uint32_t num_sp_mem_regions; - uint32_t num_cpus; - secure_partition_mp_info_t *mp_info; -} secure_partition_boot_info_t; - -#endif /* SPM_MM */ - -#endif /* SECURE_PARTITION_H */ diff --git a/include/services/spm_mm_partition.h b/include/services/spm_mm_partition.h new file mode 100644 index 0000000..ad5ceef --- /dev/null +++ b/include/services/spm_mm_partition.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef SPM_MM_PARTITION_H +#define SPM_MM_PARTITION_H + +#include + +#include + +/* + * Flags used by the spm_mm_mp_info structure to describe the + * characteristics of a cpu. Only a single flag is defined at the moment to + * indicate the primary cpu. + */ +#define MP_INFO_FLAG_PRIMARY_CPU U(0x00000001) + +/* + * This structure is used to provide information required to initialise a S-EL0 + * partition. + */ +typedef struct spm_mm_mp_info { + uint64_t mpidr; + uint32_t linear_id; + uint32_t flags; +} spm_mm_mp_info_t; + +typedef struct spm_mm_boot_info { + param_header_t h; + uint64_t sp_mem_base; + uint64_t sp_mem_limit; + uint64_t sp_image_base; + uint64_t sp_stack_base; + uint64_t sp_heap_base; + uint64_t sp_ns_comm_buf_base; + uint64_t sp_shared_buf_base; + uint64_t sp_image_size; + uint64_t sp_pcpu_stack_size; + uint64_t sp_heap_size; + uint64_t sp_ns_comm_buf_size; + uint64_t sp_shared_buf_size; + uint32_t num_sp_mem_regions; + uint32_t num_cpus; + spm_mm_mp_info_t *mp_info; +} spm_mm_boot_info_t; + +#endif /* SPM_MM_PARTITION_H */ diff --git a/plat/arm/board/fvp/fvp_common.c b/plat/arm/board/fvp/fvp_common.c index 0b1b321..c36cd6f 100644 --- a/plat/arm/board/fvp/fvp_common.c +++ b/plat/arm/board/fvp/fvp_common.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include "fvp_private.h" @@ -189,7 +189,7 @@ * Boot information passed to a secure partition during initialisation. Linear * indices in MP information will be filled at runtime. */ -static secure_partition_mp_info_t sp_mp_info[] = { +static spm_mm_mp_info_t sp_mp_info[] = { [0] = {0x80000000, 0}, [1] = {0x80000001, 0}, [2] = {0x80000002, 0}, @@ -200,10 +200,10 @@ [7] = {0x80000103, 0}, }; -const secure_partition_boot_info_t plat_arm_secure_partition_boot_info = { +const spm_mm_boot_info_t plat_arm_secure_partition_boot_info = { .h.type = PARAM_SP_IMAGE_BOOT_INFO, .h.version = VERSION_1, - .h.size = sizeof(secure_partition_boot_info_t), + .h.size = sizeof(spm_mm_boot_info_t), .h.attr = 0, .sp_mem_base = ARM_SP_IMAGE_BASE, .sp_mem_limit = ARM_SP_IMAGE_LIMIT, @@ -227,7 +227,7 @@ return plat_arm_secure_partition_mmap; } -const struct secure_partition_boot_info *plat_get_secure_partition_boot_info( +const struct spm_mm_boot_info *plat_get_secure_partition_boot_info( void *cookie) { return &plat_arm_secure_partition_boot_info; diff --git a/plat/arm/common/arm_common.c b/plat/arm/common/arm_common.c index bc0cf9a..03d842a 100644 --- a/plat/arm/common/arm_common.c +++ b/plat/arm/common/arm_common.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include /* Weak definitions may be overridden in specific ARM standard platform */ #pragma weak plat_get_ns_image_entrypoint diff --git a/plat/arm/css/sgi/sgi_plat.c b/plat/arm/css/sgi/sgi_plat.c index ef13cdc..b611eaf 100644 --- a/plat/arm/css/sgi/sgi_plat.c +++ b/plat/arm/css/sgi/sgi_plat.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #define SGI_MAP_FLASH0_RO MAP_REGION_FLAT(V2M_FLASH0_BASE,\ V2M_FLASH0_SIZE, \ @@ -87,7 +87,7 @@ * Boot information passed to a secure partition during initialisation. Linear * indices in MP information will be filled at runtime. */ -static secure_partition_mp_info_t sp_mp_info[] = { +static spm_mm_mp_info_t sp_mp_info[] = { [0] = {0x81000000, 0}, [1] = {0x81000100, 0}, [2] = {0x81000200, 0}, @@ -98,10 +98,10 @@ [7] = {0x81010300, 0}, }; -const secure_partition_boot_info_t plat_arm_secure_partition_boot_info = { +const spm_mm_boot_info_t plat_arm_secure_partition_boot_info = { .h.type = PARAM_SP_IMAGE_BOOT_INFO, .h.version = VERSION_1, - .h.size = sizeof(secure_partition_boot_info_t), + .h.size = sizeof(spm_mm_boot_info_t), .h.attr = 0, .sp_mem_base = ARM_SP_IMAGE_BASE, .sp_mem_limit = ARM_SP_IMAGE_LIMIT, @@ -125,7 +125,7 @@ return plat_arm_secure_partition_mmap; } -const struct secure_partition_boot_info *plat_get_secure_partition_boot_info( +const struct spm_mm_boot_info *plat_get_secure_partition_boot_info( void *cookie) { return &plat_arm_secure_partition_boot_info; diff --git a/plat/socionext/synquacer/sq_spm.c b/plat/socionext/synquacer/sq_spm.c index 01cce17..7bea111 100644 --- a/plat/socionext/synquacer/sq_spm.c +++ b/plat/socionext/synquacer/sq_spm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -10,7 +10,7 @@ #include #include -#include +#include static const mmap_region_t plat_arm_secure_partition_mmap[] = { PLAT_SQ_FLASH_MMAP, @@ -27,7 +27,7 @@ * Boot information passed to a secure partition during initialisation. Linear * indices in MP information will be filled at runtime. */ -static secure_partition_mp_info_t sp_mp_info[] = { +static spm_mm_mp_info_t sp_mp_info[] = { {0x80000000, 0}, {0x80000001, 0}, {0x80000100, 0}, {0x80000101, 0}, {0x80000200, 0}, {0x80000201, 0}, {0x80000300, 0}, {0x80000301, 0}, {0x80000400, 0}, {0x80000401, 0}, {0x80000500, 0}, {0x80000501, 0}, @@ -36,10 +36,10 @@ {0x80000a00, 0}, {0x80000a01, 0}, {0x80000b00, 0}, {0x80000b01, 0}, }; -const secure_partition_boot_info_t plat_arm_secure_partition_boot_info = { +const spm_mm_boot_info_t plat_arm_secure_partition_boot_info = { .h.type = PARAM_SP_IMAGE_BOOT_INFO, .h.version = VERSION_1, - .h.size = sizeof(secure_partition_boot_info_t), + .h.size = sizeof(spm_mm_boot_info_t), .h.attr = 0, .sp_mem_base = BL32_BASE, .sp_mem_limit = BL32_LIMIT, @@ -63,7 +63,7 @@ return plat_arm_secure_partition_mmap; } -const struct secure_partition_boot_info *plat_get_secure_partition_boot_info( +const struct spm_mm_boot_info *plat_get_secure_partition_boot_info( void *cookie) { return &plat_arm_secure_partition_boot_info; diff --git a/services/std_svc/spm_mm/spm_main.c b/services/std_svc/spm_mm/spm_main.c index 706b69d..b2f93a6 100644 --- a/services/std_svc/spm_mm/spm_main.c +++ b/services/std_svc/spm_mm/spm_main.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include diff --git a/services/std_svc/spm_mm/spm_setup.c b/services/std_svc/spm_mm/spm_setup.c index aae6cd5..7d03eb5 100644 --- a/services/std_svc/spm_mm/spm_setup.c +++ b/services/std_svc/spm_mm/spm_setup.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include "spm_private.h" #include "spm_shim_private.h" @@ -192,22 +192,22 @@ void *shared_buf_ptr = (void *) PLAT_SPM_BUF_BASE; /* Copy the boot information into the shared buffer with the SP. */ - assert((uintptr_t)shared_buf_ptr + sizeof(secure_partition_boot_info_t) + assert((uintptr_t)shared_buf_ptr + sizeof(spm_mm_boot_info_t) <= (PLAT_SPM_BUF_BASE + PLAT_SPM_BUF_SIZE)); assert(PLAT_SPM_BUF_BASE <= (UINTPTR_MAX - PLAT_SPM_BUF_SIZE + 1)); - const secure_partition_boot_info_t *sp_boot_info = + const spm_mm_boot_info_t *sp_boot_info = plat_get_secure_partition_boot_info(NULL); assert(sp_boot_info != NULL); memcpy((void *) shared_buf_ptr, (const void *) sp_boot_info, - sizeof(secure_partition_boot_info_t)); + sizeof(spm_mm_boot_info_t)); /* Pointer to the MP information from the platform port. */ - secure_partition_mp_info_t *sp_mp_info = - ((secure_partition_boot_info_t *) shared_buf_ptr)->mp_info; + spm_mm_mp_info_t *sp_mp_info = + ((spm_mm_boot_info_t *) shared_buf_ptr)->mp_info; assert(sp_mp_info != NULL); @@ -215,15 +215,15 @@ * Point the shared buffer MP information pointer to where the info will * be populated, just after the boot info. */ - ((secure_partition_boot_info_t *) shared_buf_ptr)->mp_info = - (secure_partition_mp_info_t *) ((uintptr_t)shared_buf_ptr - + sizeof(secure_partition_boot_info_t)); + ((spm_mm_boot_info_t *) shared_buf_ptr)->mp_info = + (spm_mm_mp_info_t *) ((uintptr_t)shared_buf_ptr + + sizeof(spm_mm_boot_info_t)); /* * Update the shared buffer pointer to where the MP information for the * payload will be populated */ - shared_buf_ptr = ((secure_partition_boot_info_t *) shared_buf_ptr)->mp_info; + shared_buf_ptr = ((spm_mm_boot_info_t *) shared_buf_ptr)->mp_info; /* * Copy the cpu information into the shared buffer area after the boot @@ -242,7 +242,7 @@ * Calculate the linear indices of cores in boot information for the * secure partition and flag the primary CPU */ - sp_mp_info = (secure_partition_mp_info_t *) shared_buf_ptr; + sp_mp_info = (spm_mm_mp_info_t *) shared_buf_ptr; for (unsigned int index = 0; index < sp_boot_info->num_cpus; index++) { u_register_t mpidr = sp_mp_info[index].mpidr; diff --git a/services/std_svc/spm_mm/spm_xlat.c b/services/std_svc/spm_mm/spm_xlat.c index f54168e..a2df1af 100644 --- a/services/std_svc/spm_mm/spm_xlat.c +++ b/services/std_svc/spm_mm/spm_xlat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include "spm_private.h"