feat(arm): add fw handoff support for RESET_TO_BL31

Change-Id: I78f3c5606f0221bb5fc613a973a7d3fe187db35b
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
This commit is contained in:
Harrison Mutai 2024-05-02 12:40:20 +00:00
parent 6ac31f3e76
commit 1a0ebff784
4 changed files with 46 additions and 6 deletions

View file

@ -210,7 +210,7 @@ const mmap_region_t plat_arm_mmap[] = {
#ifdef MAP_FW_NS_HANDOFF
MAP_FW_NS_HANDOFF,
#endif
#ifdef MAP_EL3_FW_HANDOFF
#if defined(MAP_EL3_FW_HANDOFF) && !RESET_TO_BL31
MAP_EL3_FW_HANDOFF,
#endif
{ 0 }

View file

@ -323,10 +323,6 @@ else
BL31_SOURCES += drivers/delay_timer/generic_delay_timer.c
endif
ifeq (${TRANSFER_LIST}, 1)
include lib/transfer_list/transfer_list.mk
endif
# Add the FDT_SOURCES and options for Dynamic Config (only for Unix env)
ifdef UNIX_MK
FVP_TB_FW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb
@ -386,6 +382,17 @@ $(eval $(call TOOL_ADD_PAYLOAD,${FVP_TB_FW_CONFIG},--tb-fw-config,${FVP_TB_FW_CO
$(eval $(call TOOL_ADD_PAYLOAD,${FVP_HW_CONFIG},--hw-config,${FVP_HW_CONFIG}))
endif
ifeq (${TRANSFER_LIST}, 1)
include lib/transfer_list/transfer_list.mk
ifeq ($(RESET_TO_BL31), 1)
HW_CONFIG := ${FVP_HW_CONFIG}
FW_HANDOFF_SIZE := 20000
$(eval $(call add_define,ARM_PRELOADED_DTB_OFFSET))
endif
endif
# Enable dynamic mitigation support by default
DYNAMIC_WORKAROUND_CVE_2018_3639 := 1

View file

@ -128,6 +128,24 @@ struct entry_point_info *bl31_plat_get_next_image_ep_info(uint32_t type)
void __init arm_bl31_early_platform_setup(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
#if RESET_TO_BL31
/* Populate entry point information for BL33 */
SET_PARAM_HEAD(&bl33_image_ep_info, PARAM_EP, VERSION_1, 0);
/*
* Tell BL31 where the non-trusted software image
* is located and the entry state information
*/
bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
bl33_image_ep_info.spsr = arm_get_spsr_for_bl33_entry();
SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
bl33_image_ep_info.args.arg0 =
FW_NS_HANDOFF_BASE + ARM_PRELOADED_DTB_OFFSET;
bl33_image_ep_info.args.arg1 = TRANSFER_LIST_SIGNATURE |
REGISTER_CONVENTION_VERSION_MASK;
bl33_image_ep_info.args.arg3 = FW_NS_HANDOFF_BASE;
#else
struct transfer_list_entry *te = NULL;
struct entry_point_info *ep;
@ -160,6 +178,7 @@ void __init arm_bl31_early_platform_setup(u_register_t arg0, u_register_t arg1,
}
}
}
#endif /* RESET_TO_BL31 */
}
#else
void __init arm_bl31_early_platform_setup(void *from_bl2, uintptr_t soc_fw_config,
@ -501,7 +520,7 @@ void __init bl31_plat_arch_setup(void)
arm_bl31_plat_arch_setup();
#if TRANSFER_LIST && !RESET_TO_BL2
#if TRANSFER_LIST && !(RESET_TO_BL2 || RESET_TO_BL31)
te = transfer_list_find(secure_tl, TL_TAG_FDT);
assert(te != NULL);

View file

@ -458,3 +458,17 @@ ifeq (${RECLAIM_INIT_CODE}, 1)
$(error To reclaim init code xlat tables v2 must be used)
endif
endif
TRANSFER_LIST_BIN := ${BUILD_PLAT}/tl.bin
.PHONY: tl
tl: ${HW_CONFIG}
@echo " TLC ${TRANSFER_LIST_BIN}"
$(Q)${PYTHON} -m tools.tlc.tlc create --fdt ${HW_CONFIG} -s ${FW_HANDOFF_SIZE} ${TRANSFER_LIST_BIN}
$(Q)$(eval ARM_PRELOADED_DTB_OFFSET := `tlc info --fdt-offset ${TRANSFER_LIST_BIN}`)
ifeq (${TRANSFER_LIST}, 1)
ifeq (${RESET_TO_BL31}, 1)
bl31: tl
endif
endif