spm-mm: Refactor secure_partition.h and its contents

Before adding any new SPM-related components we should first do
some cleanup around the existing SPM-MM implementation. The aim
is to make sure that any SPM-MM components have names that clearly
indicate that they are MM-related. Otherwise, when adding new SPM
code, it could quickly become confusing as it would be unclear to
which component the code belongs.

The secure_partition.h header is a clear example of this, as the
name is generic so it could easily apply to any SPM-related code,
when it is in fact SPM-MM specific.

This patch renames the file and the two structures defined within
it, and then modifies any references in files that use the header.

Change-Id: I44bd95fab774c358178b3e81262a16da500fda26
Signed-off-by: Paul Beesley <paul.beesley@arm.com>
This commit is contained in:
Paul Beesley 2019-10-15 10:57:42 +00:00 committed by Manish Pandey
parent 538b002046
commit aeaa225cbe
10 changed files with 44 additions and 48 deletions

View File

@ -160,7 +160,7 @@ are implemented.
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

View File

@ -22,7 +22,7 @@ struct image_desc;
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 @@ int get_mbedtls_heap_helper(void **heap_addr, size_t *heap_size);
* 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,

View File

@ -4,17 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef SECURE_PARTITION_H
#define SECURE_PARTITION_H
#if SPM_MM
#ifndef SPM_MM_PARTITION_H
#define SPM_MM_PARTITION_H
#include <stdint.h>
#include <lib/utils_def.h>
/*
* Flags used by the secure_partition_mp_info structure to describe the
* 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.
*/
@ -24,13 +22,13 @@
* This structure is used to provide information required to initialise a S-EL0
* partition.
*/
typedef struct secure_partition_mp_info {
typedef struct spm_mm_mp_info {
uint64_t mpidr;
uint32_t linear_id;
uint32_t flags;
} secure_partition_mp_info_t;
} spm_mm_mp_info_t;
typedef struct secure_partition_boot_info {
typedef struct spm_mm_boot_info {
param_header_t h;
uint64_t sp_mem_base;
uint64_t sp_mem_limit;
@ -46,9 +44,7 @@ typedef struct secure_partition_boot_info {
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;
spm_mm_mp_info_t *mp_info;
} spm_mm_boot_info_t;
#endif /* SPM_MM */
#endif /* SECURE_PARTITION_H */
#endif /* SPM_MM_PARTITION_H */

View File

@ -18,7 +18,7 @@
#include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h>
#include <platform_def.h>
#include <services/secure_partition.h>
#include <services/spm_mm_partition.h>
#include "fvp_private.h"
@ -189,7 +189,7 @@ static unsigned int get_interconnect_master(void)
* 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 @@ static secure_partition_mp_info_t sp_mp_info[] = {
[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 @@ const struct mmap_region *plat_get_secure_partition_mmap(void *cookie)
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;

View File

@ -16,7 +16,7 @@
#include <lib/xlat_tables/xlat_tables_compat.h>
#include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h>
#include <services/secure_partition.h>
#include <services/spm_mm_partition.h>
/* Weak definitions may be overridden in specific ARM standard platform */
#pragma weak plat_get_ns_image_entrypoint

View File

@ -15,7 +15,7 @@
#include <plat/common/platform.h>
#include <drivers/arm/sbsa.h>
#include <sgi_base_platform_def.h>
#include <services/secure_partition.h>
#include <services/spm_mm_partition.h>
#define SGI_MAP_FLASH0_RO MAP_REGION_FLAT(V2M_FLASH0_BASE,\
V2M_FLASH0_SIZE, \
@ -87,7 +87,7 @@ ARM_CASSERT_MMAP
* 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 @@ static secure_partition_mp_info_t sp_mp_info[] = {
[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 @@ const struct mmap_region *plat_get_secure_partition_mmap(void *cookie)
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;

View File

@ -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 <bl31/ehf.h>
#include <lib/xlat_tables/xlat_tables_v2.h>
#include <services/secure_partition.h>
#include <services/spm_mm_partition.h>
static const mmap_region_t plat_arm_secure_partition_mmap[] = {
PLAT_SQ_FLASH_MMAP,
@ -27,7 +27,7 @@ static const mmap_region_t plat_arm_secure_partition_mmap[] = {
* 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 @@ static secure_partition_mp_info_t sp_mp_info[] = {
{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 @@ const struct mmap_region *plat_get_secure_partition_mmap(void *cookie)
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;

View File

@ -19,7 +19,7 @@
#include <lib/xlat_tables/xlat_tables_v2.h>
#include <plat/common/platform.h>
#include <services/mm_svc.h>
#include <services/secure_partition.h>
#include <services/spm_mm_partition.h>
#include <services/spm_svc.h>
#include <smccc_helpers.h>

View File

@ -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 <platform_def.h>
#include <plat/common/common_def.h>
#include <plat/common/platform.h>
#include <services/secure_partition.h>
#include <services/spm_mm_partition.h>
#include "spm_private.h"
#include "spm_shim_private.h"
@ -192,22 +192,22 @@ void spm_sp_setup(sp_context_t *sp_ctx)
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 @@ void spm_sp_setup(sp_context_t *sp_ctx)
* 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 @@ void spm_sp_setup(sp_context_t *sp_ctx)
* 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;

View File

@ -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 <lib/xlat_tables/xlat_tables_v2.h>
#include <platform_def.h>
#include <plat/common/platform.h>
#include <services/secure_partition.h>
#include <services/spm_mm_partition.h>
#include <services/spm_svc.h>
#include "spm_private.h"