From 2329e22b8bec6fdbb1b5531f3d29569519782a63 Mon Sep 17 00:00:00 2001 From: Harrison Mutai Date: Wed, 28 Aug 2024 13:27:19 +0000 Subject: [PATCH] feat(handoff): make tl generation flexible Make the process of compiling a TL from DT source flexible. Provide a top level recipe to make it easier for developers to build a transfer list. Clean up integration of TLC into the build system. Change-Id: I4466e27a457dfd5bf709dc3a360a2b63bf6030ce Signed-off-by: Harrison Mutai --- Makefile | 7 ++++++- plat/arm/board/fvp/include/platform_def.h | 4 ++++ plat/arm/board/fvp/platform.mk | 5 +++-- plat/arm/common/arm_bl31_setup.c | 3 +-- plat/arm/common/arm_common.mk | 14 -------------- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index e15702245..47bbeca97 100644 --- a/Makefile +++ b/Makefile @@ -1496,7 +1496,7 @@ endif #(SPD) # Build targets ################################################################################ -.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool +.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp tl fwu_fip certtool dtbs memmap doc enctool .SUFFIXES: all: msg_start @@ -1742,6 +1742,11 @@ else ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} endif +tl: ${BUILD_PLAT}/tl.bin +${BUILD_PLAT}/tl.bin: ${HW_CONFIG} + $(q)poetry -q install + $(q)poetry run tlc create --fdt $< -s ${FW_HANDOFF_SIZE} $@ + doc: $(s)echo " BUILD DOCUMENTATION" $(q)${MAKE} --no-print-directory -C ${DOCS_PATH} html diff --git a/plat/arm/board/fvp/include/platform_def.h b/plat/arm/board/fvp/include/platform_def.h index a900a9b4a..e0c9725ce 100644 --- a/plat/arm/board/fvp/include/platform_def.h +++ b/plat/arm/board/fvp/include/platform_def.h @@ -149,6 +149,10 @@ #define PLAT_ARM_EL3_FW_HANDOFF_BASE ARM_BL_RAM_BASE #define PLAT_ARM_EL3_FW_HANDOFF_LIMIT PLAT_ARM_EL3_FW_HANDOFF_BASE + PLAT_ARM_FW_HANDOFF_SIZE +#if RESET_TO_BL31 +#define PLAT_ARM_TRANSFER_LIST_DTB_OFFSET FW_NS_HANDOFF_BASE + TRANSFER_LIST_DTB_OFFSET +#endif + #else #define PLAT_ARM_FW_HANDOFF_SIZE U(0) #endif diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk index bbd914107..feae8029f 100644 --- a/plat/arm/board/fvp/platform.mk +++ b/plat/arm/board/fvp/platform.mk @@ -392,9 +392,10 @@ include lib/transfer_list/transfer_list.mk ifeq ($(RESET_TO_BL31), 1) HW_CONFIG := ${FVP_HW_CONFIG} -FW_HANDOFF_SIZE := 20000 +FW_HANDOFF_SIZE := 20000 -$(eval $(call add_define,ARM_PRELOADED_DTB_OFFSET)) +TRANSFER_LIST_DTB_OFFSET := 0x20 +$(eval $(call add_define,TRANSFER_LIST_DTB_OFFSET)) endif endif diff --git a/plat/arm/common/arm_bl31_setup.c b/plat/arm/common/arm_bl31_setup.c index e91746b9c..65023bf53 100644 --- a/plat/arm/common/arm_bl31_setup.c +++ b/plat/arm/common/arm_bl31_setup.c @@ -147,8 +147,7 @@ void __init arm_bl31_early_platform_setup(u_register_t arg0, u_register_t arg1, 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.arg0 = PLAT_ARM_TRANSFER_LIST_DTB_OFFSET; bl33_image_ep_info.args.arg1 = TRANSFER_LIST_HANDOFF_X1_VALUE(REGISTER_CONVENTION_VERSION); bl33_image_ep_info.args.arg3 = FW_NS_HANDOFF_BASE; diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index 859791dc1..0c9b94389 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -469,20 +469,6 @@ ifeq (${RECLAIM_INIT_CODE}, 1) 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 - ifneq ($(COTDTPATH),) cot-dt-defines = IMAGE_BL2 $(BL2_DEFINES) $(PLAT_BL_COMMON_DEFINES) cot-dt-include-dirs = $(BL2_INCLUDE_DIRS) $(PLAT_BL_COMMON_INCLUDE_DIRS)