From a0effb91897ff41871cbe2366a54c6e2339246d8 Mon Sep 17 00:00:00 2001 From: Govindraj Raja Date: Thu, 20 Feb 2025 17:15:39 -0600 Subject: [PATCH 1/2] fix(build): handle invalid spd build options Currently the top level Makefile checks any invalid SPD build flags before parsing platform makefile thus any invalid combination enabled in platform makefile will go unnoticed. Move handling of all invalid SPD build option checks after platform level makefile is parsed. Change-Id: Ib3b384ca99403ebaf34f6ce662c93480827e2136 Signed-off-by: Govindraj Raja --- Makefile | 67 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index a3aad1207..413ce46be 100644 --- a/Makefile +++ b/Makefile @@ -433,28 +433,12 @@ INCLUDE_TBBR_MK := 1 ################################################################################ ifneq (${SPD},none) - ifeq (${ARCH},aarch32) - $(error "Error: SPD is incompatible with AArch32.") - endif - - ifdef EL3_PAYLOAD_BASE - $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") - $(warning "The SPD and its BL32 companion will be present but \ - ignored.") - endif - ifeq (${SPD},spmd) # SPMD is located in std_svc directory SPD_DIR := std_svc ifeq ($(SPMD_SPM_AT_SEL2),1) CTX_INCLUDE_EL2_REGS := 1 - ifeq ($(SPMC_AT_EL3),1) - $(error SPM cannot be enabled in both S-EL2 and EL3.) - endif - ifeq ($(CTX_INCLUDE_SVE_REGS),1) - $(error SVE context management not needed with Hafnium SPMC.) - endif endif ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) @@ -476,12 +460,6 @@ ifneq (${SPD},none) ifneq ($(SP_LAYOUT_FILE),) BL2_ENABLE_SP_LOAD := 1 endif - - ifeq ($(SPMC_AT_EL3_SEL0_SP),1) - ifneq ($(SPMC_AT_EL3),1) - $(error SEL0 SP cannot be enabled without SPMC at EL3) - endif - endif else # All other SPDs in spd directory SPD_DIR := spd @@ -507,15 +485,6 @@ ifneq (${SPD},none) # over the sources. endif #(SPD=none) -ifeq (${ENABLE_SPMD_LP}, 1) -ifneq (${SPD},spmd) - $(error Error: ENABLE_SPMD_LP requires SPD=spmd.) -endif -ifeq ($(SPMC_AT_EL3),1) - $(error SPMC at EL3 not supported when enabling SPMD Logical partitions.) -endif -endif - ################################################################################ # Include the platform specific Makefile after the SPD Makefile (the platform # makefile may use all previous definitions in this file) @@ -774,6 +743,42 @@ endif # Check incompatible options and dependencies ################################################################################ +# Handle all invalid build configurations with SPMD usage. +ifeq (${ENABLE_SPMD_LP}, 1) +ifneq (${SPD},spmd) + $(error Error: ENABLE_SPMD_LP requires SPD=spmd.) +endif +ifeq ($(SPMC_AT_EL3),1) + $(error SPMC at EL3 not supported when enabling SPMD Logical partitions.) +endif +endif + +ifneq (${SPD},none) +ifeq (${ARCH},aarch32) + $(error "Error: SPD is incompatible with AArch32.") +endif +ifdef EL3_PAYLOAD_BASE + $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") + $(warning "The SPD and its BL32 companion will be present but ignored.") +endif +ifeq (${SPD},spmd) +ifeq ($(SPMD_SPM_AT_SEL2),1) + ifeq ($(SPMC_AT_EL3),1) + $(error SPM cannot be enabled in both S-EL2 and EL3.) + endif + ifeq ($(CTX_INCLUDE_SVE_REGS),1) + $(error SVE context management not needed with Hafnium SPMC.) + endif +endif + +ifeq ($(SPMC_AT_EL3_SEL0_SP),1) + ifneq ($(SPMC_AT_EL3),1) + $(error SEL0 SP cannot be enabled without SPMC at EL3) + endif +endif +endif #(SPD=spmd) +endif #(SPD!=none) + # USE_DEBUGFS experimental feature recommended only in debug builds ifeq (${USE_DEBUGFS},1) ifeq (${DEBUG},1) From fe488c3796e01187fb6cffdd27a1bee1a33e0931 Mon Sep 17 00:00:00 2001 From: Govindraj Raja Date: Thu, 20 Feb 2025 17:19:46 -0600 Subject: [PATCH 2/2] fix(rdv3): handle invalid build combination `CTX_INCLUDE_SVE_REGS` should not be enabled when building with SPD=spmd and SPMD_SPM_AT_SEL2=1 both been used. Unfortunately a check at top level makefile ignored this, now its been fixed at top level makefile. Ensure correct combination are handled, otherwise it will lead to build failures. Change-Id: Ib84fc0096c92d9b3d56366c0e1d77b6d83098221 Signed-off-by: Govindraj Raja --- .../board/neoverse_rd/platform/rdv3/platform.mk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plat/arm/board/neoverse_rd/platform/rdv3/platform.mk b/plat/arm/board/neoverse_rd/platform/rdv3/platform.mk index 245d930e7..1ddd0e40a 100644 --- a/plat/arm/board/neoverse_rd/platform/rdv3/platform.mk +++ b/plat/arm/board/neoverse_rd/platform/rdv3/platform.mk @@ -144,7 +144,7 @@ FDT_SOURCES += ${RDV3_BASE}/fdts/${PLAT}_fw_config.dts \ ${RDV3_BASE}/fdts/${PLAT}_nt_fw_config.dts ifeq (${SPMD_SPM_AT_SEL2}, 1) -BL32_CONFIG_DTS := ${RDV3_BASE}/fdts/${PLAT}_spmc_sp_manifest.dts +BL32_CONFIG_DTS := ${RDV3_BASE}/fdts/${PLAT}_spmc_sp_manifest.dts FDT_SOURCES += ${BL32_CONFIG_DTS} TOS_FW_CONFIG := ${BUILD_PLAT}/fdts/$(notdir $(basename ${BL32_CONFIG_DTS})).dtb endif @@ -169,4 +169,14 @@ override ENABLE_FEAT_MTE2 := 2 # FEAT_SVE related flags override SVE_VECTOR_LEN := 128 -override CTX_INCLUDE_SVE_REGS := 1 + +override CTX_INCLUDE_SVE_REGS := 1 + +# Enabling CTX_INCLUDE_SVE_REGS along with SPMD_SPM_AT_SEL2=1 is a invalid +# combination and will lead to build failure, use them only when SPMD_SPM_AT_SEL2=0 +# In this combination its SPMC responsbility to save SVE regs. +ifeq (${SPD},spmd) +ifeq (${SPMD_SPM_AT_SEL2},1) +override CTX_INCLUDE_SVE_REGS := 0 +endif +endif