diff options
author | Manish Pandey <manish.pandey2@arm.com> | 2023-10-30 17:26:04 +0100 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2023-10-30 17:26:04 +0100 |
commit | 11336fb44d6f420440f04a7992defd397a4736f4 (patch) | |
tree | d82071b1a32d177b6c9a0ba3ff71bf659f47ee00 | |
parent | 48b92c604fab1ecb13931b20e77282ae2bbbc827 (diff) | |
parent | f0c813b7e850568094d4d5d4c693c71d2a88d28b (diff) |
Merge changes from topic "gr/build_refactor" into integration
* changes:
build(refactor): avoid ifdef comparison
refactor(build): avoid using values for comparison
refactor(build): reorder arch features handling
build(n1sdp): add ARM_ARCH_MAJOR.ARM_ARCH_MINOR
refactor(build): reorder platform Makefile evaluation
-rw-r--r-- | Makefile | 119 | ||||
-rw-r--r-- | make_helpers/arch_features.mk | 157 | ||||
-rw-r--r-- | plat/arm/board/fvp/platform.mk | 4 | ||||
-rw-r--r-- | plat/arm/board/n1sdp/platform.mk | 6 |
4 files changed, 198 insertions, 88 deletions
@@ -448,6 +448,96 @@ INCLUDES += -Iinclude \ include common/backtrace/backtrace.mk ################################################################################ +# Generic definitions +################################################################################ +include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk + +ifeq (${BUILD_BASE},) + BUILD_BASE := ./build +endif +BUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} + +SPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) + +# Platforms providing their own TBB makefile may override this value +INCLUDE_TBBR_MK := 1 + +################################################################################ +# Include SPD Makefile if one has been specified +################################################################################ + +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 + endif + + ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) + DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG + endif + + ifeq ($(TS_SP_FW_CONFIG),1) + DTC_CPPFLAGS += -DTS_SP_FW_CONFIG + endif + + ifneq ($(ARM_BL2_SP_LIST_DTS),) + DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) + endif + + ifneq ($(SP_LAYOUT_FILE),) + BL2_ENABLE_SP_LOAD := 1 + endif + else + # All other SPDs in spd directory + SPD_DIR := spd + endif #(SPD) + + # We expect to locate an spd.mk under the specified SPD directory + SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) + + ifeq (${SPD_MAKE},) + $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) + endif + $(info Including ${SPD_MAKE}) + include ${SPD_MAKE} + + # If there's BL32 companion for the chosen SPD, we expect that the SPD's + # Makefile would set NEED_BL32 to "yes". In this case, the build system + # supports two mutually exclusive options: + # * BL32 is built from source: then BL32_SOURCES must contain the list + # of source files to build BL32 + # * BL32 is a prebuilt binary: then BL32 must point to the image file + # that will be included in the FIP + # If both BL32_SOURCES and BL32 are defined, the binary takes precedence + # 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 + +################################################################################ # Process BRANCH_PROTECTION value and set # Pointer Authentication and Branch Target Identification flags ################################################################################ @@ -491,6 +581,18 @@ ifeq (${ENABLE_PAUTH}, 1) BL_COMMON_SOURCES += lib/extensions/pauth/pauth_helpers.S endif +################################################################################ +# Include the platform specific Makefile after the SPD Makefile (the platform +# makefile may use all previous definitions in this file) +################################################################################ +include ${PLAT_MAKEFILE_FULL} + +################################################################################ +# Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from +# platform. +################################################################################ +include ${MAKE_HELPERS_DIRECTORY}arch_features.mk + #################################################### # Enable required options for Memory Stack Tagging. #################################################### @@ -521,6 +623,9 @@ endif #(SUPPORT_STACK_MEMTAG) ################################################################################ # FEAT_RME ifeq (${ENABLE_RME},1) + # RME doesn't support BRBE + ENABLE_BRBE_FOR_NS := 0 + # RME doesn't support PIE ifneq (${ENABLE_PIE},0) $(error ENABLE_RME does not support PIE) @@ -670,12 +775,14 @@ include services/std_svc/rmmd/rmmd.mk $(warning "RME is an experimental feature") endif -################################################################################ -# Include the platform specific Makefile after the SPD Makefile (the platform -# makefile may use all previous definitions in this file) -################################################################################ - -include ${PLAT_MAKEFILE_FULL} +ifeq (${CTX_INCLUDE_EL2_REGS}, 1) + ifeq (${SPD},none) + ifeq (${ENABLE_RME},0) + $(error CTX_INCLUDE_EL2_REGS is available only when SPD \ + or RME is enabled) + endif + endif +endif ################################################################################ # Platform specific Makefile might provide us ARCH_MAJOR/MINOR use that to come diff --git a/make_helpers/arch_features.mk b/make_helpers/arch_features.mk index c92b4a57f..f957f0ddb 100644 --- a/make_helpers/arch_features.mk +++ b/make_helpers/arch_features.mk @@ -8,12 +8,64 @@ # and enables them based on the configured architecture version. # This file follows the following format: -# - By default disable any mandatory features. -# - Then Enable mandatory feature if applicable to an Arch Version. +# - Enable mandatory feature if applicable to an Arch Version. +# - By default disable any mandatory features if they have not been defined yet. # - Disable or enable any optional feature this would be enabled/disabled if needed by platform. # ################################################################################ +# Enable Mandatory features based on Arch versions. +################################################################################ +# + +# Enable the features which are mandatory from ARCH version 8.1 and upwards. +ifeq "8.1" "$(word 1, $(sort 8.1 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" +ENABLE_FEAT_PAN := 1 +ENABLE_FEAT_VHE := 1 +endif + +# Enable the features which are mandatory from ARCH version 8.2 and upwards. +ifeq "8.2" "$(word 1, $(sort 8.2 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" +ENABLE_FEAT_RAS := 1 +endif + +# Enable the features which are mandatory from ARCH version 8.4 and upwards. +ifeq "8.4" "$(word 1, $(sort 8.4 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" +ENABLE_FEAT_SEL2 := 1 +ENABLE_TRF_FOR_NS := 1 +ENABLE_FEAT_DIT := 1 +endif + +# Enable the features which are mandatory from ARCH version 8.5 and upwards. +ifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" +ENABLE_FEAT_RNG := 1 +ENABLE_FEAT_SB := 1 + +# Enable Memory tagging, Branch Target Identification for aarch64 only. +ifeq ($(ARCH), aarch64) + mem_tag_arch_support := yes +endif #(ARCH=aarch64) + +endif + +# Enable the features which are mandatory from ARCH version 8.6 and upwards. +ifeq "8.6" "$(word 1, $(sort 8.6 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" +ENABLE_FEAT_ECV := 1 +ENABLE_FEAT_FGT := 1 +endif + +# Enable the features which are mandatory from ARCH version 8.7 and upwards. +ifeq "8.7" "$(word 1, $(sort 8.7 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" +ENABLE_FEAT_HCX := 1 +endif + +# Enable the features which are mandatory from ARCH version 8.9 and upwards. +ifeq "8.9" "$(word 1, $(sort 8.9 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" +ENABLE_FEAT_TCR2 := 1 +endif + +# +################################################################################ # Set mandatory features by default to zero. ################################################################################ # @@ -23,17 +75,17 @@ #---- # Flag to enable access to Privileged Access Never bit of PSTATE. -ENABLE_FEAT_PAN := 0 +ENABLE_FEAT_PAN ?= 0 # Flag to enable Virtualization Host Extensions. -ENABLE_FEAT_VHE := 0 +ENABLE_FEAT_VHE ?= 0 #---- # 8.2 #---- # Enable RAS Support. -ENABLE_FEAT_RAS := 0 +ENABLE_FEAT_RAS ?= 0 #---- # 8.3 @@ -41,118 +93,67 @@ ENABLE_FEAT_RAS := 0 # Flag to enable Pointer Authentication. Internal flag not meant for # direct setting. Use BRANCH_PROTECTION to enable PAUTH. -ENABLE_PAUTH := 0 +ENABLE_PAUTH ?= 0 # Include pointer authentication (ARMv8.3-PAuth) registers in cpu context. This # must be set to 1 if the platform wants to use this feature in the Secure # world. It is not necessary for use in the Non-secure world. -CTX_INCLUDE_PAUTH_REGS := 0 +CTX_INCLUDE_PAUTH_REGS ?= 0 + #---- # 8.4 #---- # Flag to enable Secure EL-2 feature. -ENABLE_FEAT_SEL2 := 0 +ENABLE_FEAT_SEL2 ?= 0 # By default, disable trace filter control register access to lower non-secure # exception levels, i.e. NS-EL2, or NS-EL1 if NS-EL2 is implemented, but # trace filter control register access is unused if FEAT_TRF is implemented. -ENABLE_TRF_FOR_NS := 0 +ENABLE_TRF_FOR_NS ?= 0 # Flag to enable Data Independent Timing instructions. -ENABLE_FEAT_DIT := 0 +ENABLE_FEAT_DIT ?= 0 #---- # 8.5 #---- -# Flag to enable access to the Random Number Generator registers. -ENABLE_FEAT_RNG := 0 - -# Flag to enable Speculation Barrier Instruction. -ENABLE_FEAT_SB := 0 - # Flag to enable Branch Target Identification. # Internal flag not meant for direct setting. # Use BRANCH_PROTECTION to enable BTI. -ENABLE_BTI := 0 +ENABLE_BTI ?= 0 + +# Flag to enable access to the Random Number Generator registers. +ENABLE_FEAT_RNG ?= 0 + +# Flag to enable Speculation Barrier Instruction. +ENABLE_FEAT_SB ?= 0 #---- # 8.6 #---- # Flag to enable access to the CNTPOFF_EL2 register. -ENABLE_FEAT_ECV := 0 +ENABLE_FEAT_ECV ?= 0 # Flag to enable access to the HDFGRTR_EL2 register. -ENABLE_FEAT_FGT := 0 +ENABLE_FEAT_FGT ?= 0 #---- # 8.7 #---- # Flag to enable access to the HCRX_EL2 register by setting SCR_EL3.HXEn. -ENABLE_FEAT_HCX := 0 +ENABLE_FEAT_HCX ?= 0 #---- # 8.9 #---- # Flag to enable access to TCR2 (FEAT_TCR2). -ENABLE_FEAT_TCR2 := 0 - -# -################################################################################ -# Enable Mandatory features based on Arch versions. -################################################################################ -# - -# Enable the features which are mandatory from ARCH version 8.1 and upwards. -ifeq "8.1" "$(word 1, $(sort 8.1 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" -ENABLE_FEAT_PAN := 1 -ENABLE_FEAT_VHE := 1 -endif - -# Enable the features which are mandatory from ARCH version 8.2 and upwards. -ifeq "8.2" "$(word 1, $(sort 8.2 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" -ENABLE_FEAT_RAS := 1 -endif - -# Enable the features which are mandatory from ARCH version 8.4 and upwards. -ifeq "8.4" "$(word 1, $(sort 8.4 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" -ENABLE_FEAT_SEL2 := 1 -ENABLE_TRF_FOR_NS := 1 -ENABLE_FEAT_DIT := 1 -endif - -# Enable the features which are mandatory from ARCH version 8.5 and upwards. -ifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" -ENABLE_FEAT_RNG := 1 -ENABLE_FEAT_SB := 1 - -# Enable Memory tagging, Branch Target Identification for aarch64 only. -ifeq ($(ARCH), aarch64) - mem_tag_arch_support := yes -endif #(ARCH=aarch64) - -endif - -# Enable the features which are mandatory from ARCH version 8.6 and upwards. -ifeq "8.6" "$(word 1, $(sort 8.6 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" -ENABLE_FEAT_ECV := 1 -ENABLE_FEAT_FGT := 1 -endif - -# Enable the features which are mandatory from ARCH version 8.7 and upwards. -ifeq "8.7" "$(word 1, $(sort 8.7 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" -ENABLE_FEAT_HCX := 1 -endif - -# Enable the features which are mandatory from ARCH version 8.9 and upwards. -ifeq "8.9" "$(word 1, $(sort 8.9 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" -ENABLE_FEAT_TCR2 := 1 -endif +ENABLE_FEAT_TCR2 ?= 0 # ################################################################################ @@ -184,7 +185,7 @@ ENABLE_SYS_REG_TRACE_FOR_NS ?= 0 ifeq (${ARCH},aarch64) ENABLE_SPE_FOR_NS ?= 2 else ifeq (${ARCH},aarch32) - ifdef ENABLE_SPE_FOR_NS + ifneq ($(or $(ENABLE_SPE_FOR_NS),0),0) $(error ENABLE_SPE_FOR_NS is not supported for AArch32) else ENABLE_SPE_FOR_NS := 0 @@ -196,7 +197,7 @@ ifeq (${ARCH},aarch64) ENABLE_SVE_FOR_NS ?= 2 # SVE is only supported on AArch64 so disable it on AArch32. else ifeq (${ARCH},aarch32) - ifdef ENABLE_SVE_FOR_NS + ifneq ($(or $(ENABLE_SVE_FOR_NS),0),0) $(error ENABLE_SVE_FOR_NS is not supported for AArch32) else ENABLE_SVE_FOR_NS := 0 @@ -302,10 +303,10 @@ ENABLE_SVE_FOR_SWD ?= 0 ifeq (${ARCH},aarch64) ENABLE_TRBE_FOR_NS ?= 0 else ifeq (${ARCH},aarch32) - ifdef ENABLE_TRBE_FOR_NS - $(error ENABLE_TRBE_FOR_NS is not supported for AArch32) + ifneq ($(or $(ENABLE_TRBE_FOR_NS),0),0) + $(error ENABLE_TRBE_FOR_NS is not supported for AArch32) else - ENABLE_TRBE_FOR_NS := 0 + ENABLE_TRBE_FOR_NS := 0 endif endif diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk index d70eb49e8..902a5df16 100644 --- a/plat/arm/board/fvp/platform.mk +++ b/plat/arm/board/fvp/platform.mk @@ -72,9 +72,7 @@ endif # enable unconditionally for all builds ifeq (${ARCH}, aarch64) -ifeq (${ENABLE_RME},0) - ENABLE_BRBE_FOR_NS := 2 -endif + ENABLE_BRBE_FOR_NS := 2 ENABLE_TRBE_FOR_NS := 2 endif ENABLE_SYS_REG_TRACE_FOR_NS := 2 diff --git a/plat/arm/board/n1sdp/platform.mk b/plat/arm/board/n1sdp/platform.mk index bd6261454..f937ee709 100644 --- a/plat/arm/board/n1sdp/platform.mk +++ b/plat/arm/board/n1sdp/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018-2022, Arm Limited. All rights reserved. +# Copyright (c) 2018-2023, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -14,6 +14,10 @@ PLAT_INCLUDES := -I${N1SDP_BASE}/include N1SDP_CPU_SOURCES := lib/cpus/aarch64/neoverse_n1.S +# Neoverse N1 cores support Armv8.2 extensions +ARM_ARCH_MAJOR := 8 +ARM_ARCH_MINOR := 2 + # GIC-600 configuration GICV3_SUPPORT_GIC600 := 1 GICV3_IMPL_GIC600_MULTICHIP := 1 |