feat(hikey960): add SP manifest for SPMC_AT_EL3

The purpose of this patch is to show silicon partners how to upgrade
existing TF-A port to include a manifest that is required with FF-A.

The manifest values are consumed by TF-A SPMC_AT_EL3 and by the TEE.

Change-Id: Ied81187d6b1cfb72ad2e9020dfc19ad73d80186f
Signed-off-by: Cedric Chan <cedric.chan@trustonic.com>
Signed-off-by: vallau01 <valentin.laurent@trustonic.com>
Signed-off-by: Lukas Hanel <lukas.hanel@trustonic.com>
This commit is contained in:
Lukas Hanel 2022-03-01 14:18:22 +01:00
parent e0eea337b3
commit 6971642d23
6 changed files with 69 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -138,6 +138,22 @@ static bl_mem_params_node_t bl2_mem_params_descs[] = {
#endif
.next_handoff_image_id = INVALID_IMAGE_ID,
},
#ifdef SPD_spmd
/* Fill TOS_FW_CONFIG related information */
{
.image_id = TOS_FW_CONFIG_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
VERSION_2, image_info_t, 0),
.image_info.image_base = DDR_SEC_CONFIG_BASE,
.image_info.image_max_size = DDR_SEC_CONFIG_SIZE,
.next_handoff_image_id = INVALID_IMAGE_ID,
},
#endif
# endif /* BL32_BASE */
/* Fill BL33 related information */

View file

@ -21,8 +21,9 @@
#define HIKEY960_DRAM_ID 1
/*
* DDR for TEE (80MB from 0x3E00000-0x42FFFFFF) is divided into several
* DDR for TEE (80MB from 0x3E00000-0x43000FFF) is divided into several
* regions:
* - SPMC manifest (4KB at the top) used by SPMC_AT_EL3 and the TEE
* - Secure DDR (default is the top 64MB) used by OP-TEE
* - Non-secure DDR used by OP-TEE (shared memory and padding) (4MB)
* - Secure DDR (4MB aligned on 4MB) for OP-TEE's "Secure Data Path" feature
@ -30,6 +31,8 @@
*/
#define DDR_SEC_SIZE 0x04000000 /* reserve 64MB secure memory */
#define DDR_SEC_BASE 0x3F000000
#define DDR_SEC_CONFIG_SIZE 0x00001000 /* SPMC_AT_EL3: SPMC manifest */
#define DDR_SEC_CONFIG_BASE 0x43000000
#define DDR_SDP_SIZE 0x00400000
#define DDR_SDP_BASE (DDR_SEC_BASE - 0x400000 /* align */ - \

View file

@ -1,9 +1,10 @@
/*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
#include <common/bl_common.h>
#include <common/desc_image_load.h>
#include <plat/common/platform.h>
@ -25,10 +26,30 @@ bl_load_info_t *plat_get_bl_image_load_info(void)
return get_bl_load_info_from_mem_params_desc();
}
/*******************************************************************************
* ARM helper function to return the list of executable images. Since the default
* descriptors are allocated within BL2 RW memory, this prevents BL31/BL32
* overlay of BL2 memory. Hence this function also copies the descriptors to a
* pre-allocated memory indicated by ARM_BL2_MEM_DESC_BASE.
******************************************************************************/
struct bl_params *hikey960_get_next_bl_params(void)
{
bl_params_t *next_bl_params;
next_bl_params = get_next_bl_params_from_mem_params_desc();
assert(next_bl_params != NULL);
populate_next_bl_params_config(next_bl_params);
return next_bl_params;
}
/*******************************************************************************
* This function returns the list of executable images.
******************************************************************************/
bl_params_t *plat_get_next_bl_params(void)
{
return get_next_bl_params_from_mem_params_desc();
return hikey960_get_next_bl_params();
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -78,6 +78,12 @@ static const io_uuid_spec_t bl32_extra2_uuid_spec = {
.uuid = UUID_SECURE_PAYLOAD_BL32_EXTRA2,
};
#ifdef SPD_spmd
static const io_uuid_spec_t bl32_tos_fw_spec = {
.uuid = UUID_TOS_FW_CONFIG,
};
#endif
static const io_uuid_spec_t bl33_uuid_spec = {
.uuid = UUID_NON_TRUSTED_FIRMWARE_BL33,
};
@ -151,6 +157,15 @@ static const struct plat_io_policy policies[] = {
(uintptr_t)&bl32_extra2_uuid_spec,
check_fip
},
#ifdef SPD_spmd
[TOS_FW_CONFIG_ID] = {
&fip_dev_handle,
(uintptr_t)&bl32_tos_fw_spec,
check_fip
},
#endif
[BL33_IMAGE_ID] = {
&fip_dev_handle,
(uintptr_t)&bl33_uuid_spec,

View file

@ -122,7 +122,7 @@
#endif
#if defined(IMAGE_BL2) || defined(IMAGE_BL31)
#define MAX_XLAT_TABLES 4
#define MAX_XLAT_TABLES 5
#endif
#define MAX_MMAP_REGIONS 16

View file

@ -161,3 +161,11 @@ ERRATA_A53_843419 := 1
ERRATA_A53_855873 := 1
FIP_ALIGN := 512
# SPM dispatcher
ifeq (${SPD},spmd)
ifeq ($(PLAT_SP_MANIFEST_DTS),)
$(error "Error: A SP manifest is required for the SPMC.")
endif
FDT_SOURCES += ${PLAT_SP_MANIFEST_DTS}
endif