mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-19 02:54:24 +00:00
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
This commit is contained in:
commit
11336fb44d
4 changed files with 217 additions and 107 deletions
119
Makefile
119
Makefile
|
@ -447,6 +447,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
|
||||
|
|
|
@ -8,100 +8,10 @@
|
|||
# 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.
|
||||
|
||||
#
|
||||
################################################################################
|
||||
# Set mandatory features by default to zero.
|
||||
################################################################################
|
||||
#
|
||||
|
||||
#----
|
||||
# 8.1
|
||||
#----
|
||||
|
||||
# Flag to enable access to Privileged Access Never bit of PSTATE.
|
||||
ENABLE_FEAT_PAN := 0
|
||||
|
||||
# Flag to enable Virtualization Host Extensions.
|
||||
ENABLE_FEAT_VHE := 0
|
||||
|
||||
#----
|
||||
# 8.2
|
||||
#----
|
||||
|
||||
# Enable RAS Support.
|
||||
ENABLE_FEAT_RAS := 0
|
||||
|
||||
#----
|
||||
# 8.3
|
||||
#----
|
||||
|
||||
# Flag to enable Pointer Authentication. Internal flag not meant for
|
||||
# direct setting. Use BRANCH_PROTECTION to enable PAUTH.
|
||||
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
|
||||
|
||||
#----
|
||||
# 8.4
|
||||
#----
|
||||
|
||||
# Flag to enable Secure EL-2 feature.
|
||||
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
|
||||
|
||||
# Flag to enable Data Independent Timing instructions.
|
||||
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
|
||||
|
||||
#----
|
||||
# 8.6
|
||||
#----
|
||||
|
||||
# Flag to enable access to the CNTPOFF_EL2 register.
|
||||
ENABLE_FEAT_ECV := 0
|
||||
|
||||
# Flag to enable access to the HDFGRTR_EL2 register.
|
||||
ENABLE_FEAT_FGT := 0
|
||||
|
||||
#----
|
||||
# 8.7
|
||||
#----
|
||||
|
||||
# Flag to enable access to the HCRX_EL2 register by setting SCR_EL3.HXEn.
|
||||
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.
|
||||
|
@ -154,6 +64,97 @@ 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.
|
||||
################################################################################
|
||||
#
|
||||
|
||||
#----
|
||||
# 8.1
|
||||
#----
|
||||
|
||||
# Flag to enable access to Privileged Access Never bit of PSTATE.
|
||||
ENABLE_FEAT_PAN ?= 0
|
||||
|
||||
# Flag to enable Virtualization Host Extensions.
|
||||
ENABLE_FEAT_VHE ?= 0
|
||||
|
||||
#----
|
||||
# 8.2
|
||||
#----
|
||||
|
||||
# Enable RAS Support.
|
||||
ENABLE_FEAT_RAS ?= 0
|
||||
|
||||
#----
|
||||
# 8.3
|
||||
#----
|
||||
|
||||
# Flag to enable Pointer Authentication. Internal flag not meant for
|
||||
# direct setting. Use BRANCH_PROTECTION to enable PAUTH.
|
||||
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
|
||||
|
||||
|
||||
#----
|
||||
# 8.4
|
||||
#----
|
||||
|
||||
# Flag to enable Secure EL-2 feature.
|
||||
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
|
||||
|
||||
# Flag to enable Data Independent Timing instructions.
|
||||
ENABLE_FEAT_DIT ?= 0
|
||||
|
||||
#----
|
||||
# 8.5
|
||||
#----
|
||||
|
||||
# Flag to enable Branch Target Identification.
|
||||
# Internal flag not meant for direct setting.
|
||||
# Use BRANCH_PROTECTION to enable BTI.
|
||||
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
|
||||
|
||||
# Flag to enable access to the HDFGRTR_EL2 register.
|
||||
ENABLE_FEAT_FGT ?= 0
|
||||
|
||||
#----
|
||||
# 8.7
|
||||
#----
|
||||
|
||||
# Flag to enable access to the HCRX_EL2 register by setting SCR_EL3.HXEn.
|
||||
ENABLE_FEAT_HCX ?= 0
|
||||
|
||||
#----
|
||||
# 8.9
|
||||
#----
|
||||
|
||||
# Flag to enable access to TCR2 (FEAT_TCR2).
|
||||
ENABLE_FEAT_TCR2 ?= 0
|
||||
|
||||
#
|
||||
################################################################################
|
||||
# Optional Features defaulted to 0 or 2, if they are not enabled from
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue