feat(handoff): port BL31-BL33 interface to fw handoff framework

The firmware handoff framework is a light weight mechanism for sharing
information between bootloader stages. Add support for this framework at
the handoff boundary between runtime firmware BL31 and NS software on FVP.

Change-Id: Ib02e0e4c20a39e32e06da667caf2ce5a28de1e28
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
This commit is contained in:
Harrison Mutai 2023-08-08 15:10:07 +01:00
parent 113273aac4
commit 94c90ac816
4 changed files with 42 additions and 5 deletions

View file

@ -11,6 +11,7 @@
#include <drivers/arm/sp804_delay_timer.h>
#include <lib/fconf/fconf.h>
#include <lib/fconf/fconf_dyn_cfg_getter.h>
#include <lib/transfer_list.h>
#include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h>
@ -42,6 +43,8 @@ struct bl_params *plat_get_next_bl_params(void)
struct bl_params *arm_bl_params;
const struct dyn_cfg_dtb_info_t *hw_config_info __unused;
bl_mem_params_node_t *param_node __unused;
static struct transfer_list_header *ns_tl __unused;
struct transfer_list_entry *te __unused;
arm_bl_params = arm_get_next_bl_params();
@ -81,6 +84,23 @@ struct bl_params *plat_get_next_bl_params(void)
param_node = get_bl_mem_params_node(HW_CONFIG_ID);
assert(param_node != NULL);
bl_mem_params_node_t *bl33_param_node = get_bl_mem_params_node(BL33_IMAGE_ID);
assert(bl33_param_node != NULL);
#if TRANSFER_LIST
ns_tl = transfer_list_init((void *)FW_NS_HANDOFF_BASE, FW_HANDOFF_SIZE);
assert(ns_tl != NULL);
/* Update BL33's ep info with NS HW config address */
te = transfer_list_add(ns_tl, TL_TAG_FDT, param_node->image_info.image_size,
(void *)hw_config_info->config_addr);
assert(te != NULL);
bl33_param_node->ep_info.args.arg1 = TRANSFER_LIST_SIGNATURE | REGISTER_CONVENTION_VERSION_MASK;
bl33_param_node->ep_info.args.arg2 = 0;
bl33_param_node->ep_info.args.arg3 = (uintptr_t)ns_tl;
bl33_param_node->ep_info.args.arg0 = te ? (uintptr_t)transfer_list_entry_data(te) : 0;
#else
/* Copy HW config from Secure address to NS address */
memcpy((void *)hw_config_info->secondary_config_addr,
(void *)hw_config_info->config_addr,
@ -94,11 +114,8 @@ struct bl_params *plat_get_next_bl_params(void)
flush_dcache_range(hw_config_info->secondary_config_addr,
param_node->image_info.image_size);
param_node = get_bl_mem_params_node(BL33_IMAGE_ID);
assert(param_node != NULL);
/* Update BL33's ep info with NS HW config address */
param_node->ep_info.args.arg1 = hw_config_info->secondary_config_addr;
bl33_param_node->ep_info.args.arg1 = hw_config_info->secondary_config_addr;
#endif /* TRANSFER_LIST */
#endif /* !RESET_TO_BL2 && !EL3_PAYLOAD_BASE */
return arm_bl_params;

View file

@ -71,6 +71,14 @@ arm_config_t arm_config;
DEVICE2_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#if TRANSFER_LIST
#ifdef FW_NS_HANDOFF_BASE
#define MAP_FW_NS_HANDOFF MAP_REGION_FLAT(FW_NS_HANDOFF_BASE, \
FW_HANDOFF_SIZE, \
MT_MEMORY | MT_RW | MT_NS)
#endif
#endif
/*
* Table of memory regions for various BL stages to map using the MMU.
* This doesn't include Trusted SRAM as setup_page_tables() already takes care
@ -182,6 +190,9 @@ const mmap_region_t plat_arm_mmap[] = {
#if ENABLE_RME
ARM_MAP_GPT_L1_DRAM,
ARM_MAP_EL3_RMM_SHARED_MEM,
#endif
#ifdef MAP_FW_NS_HANDOFF
MAP_FW_NS_HANDOFF,
#endif
{0}
};

View file

@ -128,6 +128,11 @@
*/
#define PLAT_ARM_NS_IMAGE_BASE (ARM_DRAM1_BASE + UL(0x8000000))
#if TRANSFER_LIST
#define FW_HANDOFF_SIZE 0x4000
#define FW_NS_HANDOFF_BASE (PLAT_ARM_NS_IMAGE_BASE - FW_HANDOFF_SIZE)
#endif
/*
* PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the
* plat_arm_mmap array defined for each BL stage.

View file

@ -359,6 +359,10 @@ FVP_TOS_FW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}_tsp_fw_config.dtb
$(eval $(call TOOL_ADD_PAYLOAD,${FVP_TOS_FW_CONFIG},--tos-fw-config,${FVP_TOS_FW_CONFIG}))
endif
ifeq (${TRANSFER_LIST}, 1)
include lib/transfer_list/transfer_list.mk
endif
ifeq (${SPD},spmd)
ifeq ($(ARM_SPMC_MANIFEST_DTS),)