Browse Source

refactor(build): refactor mandatory options

Currently we enable all mandatory options for a current MAJOR.MINOR
number without considering architecturally to what version the current
arch should be compliant with.

For example Arch v9 should be compliant with 8.5 and shouldn't
consider being compliant with 8.9, so refactor FEAT_* handling to
ensure we capture and handle compliance correctly.

So refactor to use a list and add FEAT_* which are only compliant
with a given arch rather than relying on all the FEAT_* from previous
should be enabled for given arch version.

Change-Id: I8b0dd076c168a647de43b8618fbbe607412f7cab
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
pull/1999/merge
Govindraj Raja 10 months ago
parent
commit
2a71f1633c
  1. 88
      make_helpers/arch_features.mk
  2. 12
      make_helpers/build_macros.mk

88
make_helpers/arch_features.mk

@ -20,27 +20,44 @@
# 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
armv8-1-a-feats := ENABLE_FEAT_PAN ENABLE_FEAT_VHE
FEAT_LIST := ${armv8-1-a-feats}
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
armv8-2-a-feats := ENABLE_FEAT_RAS
# 8.1 Compliant
armv8-2-a-feats += ${armv8-1-a-feats}
FEAT_LIST := ${armv8-2-a-feats}
endif
# Enable the features which are mandatory from ARCH version 8.3 and upwards.
ifeq "8.3" "$(word 1, $(sort 8.3 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
# 8.2 Compliant
armv8-3-a-feats += ${armv8-2-a-feats}
FEAT_LIST := ${armv8-3-a-feats}
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
armv8-4-a-feats := ENABLE_FEAT_SEL2 ENABLE_TRF_FOR_NS ENABLE_FEAT_DIT
# 8.3 Compliant
armv8-4-a-feats += ${armv8-3-a-feats}
FEAT_LIST := ${armv8-4-a-feats}
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
armv8-5-a-feats := ENABLE_FEAT_RNG ENABLE_FEAT_SB
# 8.4 Compliant
armv8-5-a-feats += ${armv8-4-a-feats}
FEAT_LIST := ${armv8-5-a-feats}
# Enable Memory tagging, Branch Target Identification for aarch64 only.
ifeq ($(ARCH), aarch64)
mem_tag_arch_support ?= yes
@ -50,20 +67,67 @@ 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
armv8-6-a-feats := ENABLE_FEAT_ECV ENABLE_FEAT_FGT
# 8.5 Compliant
armv8-6-a-feats += ${armv8-5-a-feats}
FEAT_LIST := ${armv8-6-a-feats}
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
armv8-7-a-feats := ENABLE_FEAT_HCX
# 8.6 Compliant
armv8-7-a-feats += ${armv8-6-a-feats}
FEAT_LIST := ${armv8-7-a-feats}
endif
# Enable the features which are mandatory from ARCH version 8.8 and upwards.
ifeq "8.8" "$(word 1, $(sort 8.8 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
# 8.7 Compliant
armv8-7-a-feats += ${armv8-7-a-feats}
FEAT_LIST := ${armv8-8-a-feats}
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
armv8-9-a-feats := ENABLE_FEAT_TCR2
# 8.8 Compliant
armv8-9-a-feats += ${armv8-8-a-feats}
FEAT_LIST := ${armv8-9-a-feats}
endif
# Enable the features which are mandatory from ARCH version 9.0 and upwards.
ifeq "9.0" "$(word 1, $(sort 9.0 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
# 8.5 Compliant
armv9-0-a-feats += ${armv8-5-a-feats}
FEAT_LIST := ${armv9-0-a-feats}
endif
# Enable the features which are mandatory from ARCH version 9.1 and upwards.
ifeq "9.1" "$(word 1, $(sort 9.1 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
# 8.6 and 9.0 Compliant
armv9-1-a-feats += ${armv8-6-a-feats} ${armv9-0-a-feats}
FEAT_LIST := ${armv9-1-a-feats}
endif
# Enable the features which are mandatory from ARCH version 9.2 and upwards.
ifeq "9.2" "$(word 1, $(sort 9.2 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
# 8.7 and 9.1 Compliant
armv9-2-a-feats += ${armv8-7-a-feats} ${armv9-1-a-feats}
FEAT_LIST := ${armv9-2-a-feats}
endif
# Enable the features which are mandatory from ARCH version 9.3 and upwards.
ifeq "9.3" "$(word 1, $(sort 9.3 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
# 8.8 and 9.2 Compliant
armv9-3-a-feats += ${armv8-8-a-feats} ${armv9-2-a-feats}
FEAT_LIST := ${armv9-3-a-feats}
endif
# Set all FEAT_* in FEAT_LIST to '1' if they are not yet defined or set
# from build commandline options or platform makefile.
$(eval $(call default_ones, ${sort ${FEAT_LIST}}))
#
################################################################################
# Set mandatory features by default to zero.

12
make_helpers/build_macros.mk

@ -50,6 +50,18 @@ define default_zeros
$(foreach var,$1,$(eval $(call default_zero,$(var))))
endef
# Convenience function for setting a variable to 1 if not previously set
# $(eval $(call default_one,FOO))
define default_one
$(eval $(1) ?= 1)
endef
# Convenience function for setting a list of variables to 1 if not previously set
# $(eval $(call default_ones,FOO BAR))
define default_ones
$(foreach var,$1,$(eval $(call default_one,$(var))))
endef
# Convenience function for adding build definitions
# $(eval $(call add_define,FOO)) will have:
# -DFOO if $(FOO) is empty; -DFOO=$(FOO) otherwise

Loading…
Cancel
Save