blob: 30b3a04284c7e5f7b91958d4866cfded92bfd3ed [file] [log] [blame]
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +00001#
Govindraj Rajaf5211422023-08-17 10:41:48 -05002# Copyright (c) 2022-2023, Arm Limited. All rights reserved.
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +00003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Govindraj Rajaf5211422023-08-17 10:41:48 -05007# This file lists all of the architectural features, and initializes
8# and enables them based on the configured architecture version.
9
10# This file follows the following format:
Govindraj Rajaf0d19762024-01-24 11:42:40 -060011# - Enable mandatory feature if not updated, as applicable to an Arch Version.
Govindraj Rajafb730112023-10-09 13:56:06 -050012# - By default disable any mandatory features if they have not been defined yet.
Govindraj Rajaf5211422023-08-17 10:41:48 -050013# - Disable or enable any optional feature this would be enabled/disabled if needed by platform.
14
15#
16################################################################################
Govindraj Rajaf0d19762024-01-24 11:42:40 -060017# Enable Mandatory features if not updated yet, based on Arch versions.
Govindraj Rajaf5211422023-08-17 10:41:48 -050018################################################################################
19#
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +000020
21# Enable the features which are mandatory from ARCH version 8.1 and upwards.
22ifeq "8.1" "$(word 1, $(sort 8.1 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
Govindraj Raja48b41b42024-01-23 14:20:52 -060023armv8-1-a-feats := ENABLE_FEAT_PAN ENABLE_FEAT_VHE
24
25FEAT_LIST := ${armv8-1-a-feats}
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +000026endif
27
Manish Pandey9202d512023-02-13 12:39:17 +000028# Enable the features which are mandatory from ARCH version 8.2 and upwards.
29ifeq "8.2" "$(word 1, $(sort 8.2 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
Govindraj Raja48b41b42024-01-23 14:20:52 -060030armv8-2-a-feats := ENABLE_FEAT_RAS
31# 8.1 Compliant
32armv8-2-a-feats += ${armv8-1-a-feats}
33
34FEAT_LIST := ${armv8-2-a-feats}
35endif
36
37# Enable the features which are mandatory from ARCH version 8.3 and upwards.
38ifeq "8.3" "$(word 1, $(sort 8.3 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
39# 8.2 Compliant
40armv8-3-a-feats += ${armv8-2-a-feats}
41
42FEAT_LIST := ${armv8-3-a-feats}
Manish Pandey9202d512023-02-13 12:39:17 +000043endif
44
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +000045# Enable the features which are mandatory from ARCH version 8.4 and upwards.
46ifeq "8.4" "$(word 1, $(sort 8.4 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
Govindraj Raja48b41b42024-01-23 14:20:52 -060047armv8-4-a-feats := ENABLE_FEAT_SEL2 ENABLE_TRF_FOR_NS ENABLE_FEAT_DIT
48# 8.3 Compliant
49armv8-4-a-feats += ${armv8-3-a-feats}
50
51FEAT_LIST := ${armv8-4-a-feats}
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +000052endif
53
54# Enable the features which are mandatory from ARCH version 8.5 and upwards.
55ifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
Govindraj Raja48b41b42024-01-23 14:20:52 -060056armv8-5-a-feats := ENABLE_FEAT_RNG ENABLE_FEAT_SB
57# 8.4 Compliant
58armv8-5-a-feats += ${armv8-4-a-feats}
Govindraj Rajaf5211422023-08-17 10:41:48 -050059
Govindraj Raja48b41b42024-01-23 14:20:52 -060060FEAT_LIST := ${armv8-5-a-feats}
Govindraj Rajaf5211422023-08-17 10:41:48 -050061# Enable Memory tagging, Branch Target Identification for aarch64 only.
62ifeq ($(ARCH), aarch64)
Govindraj Raja926f86b2024-01-11 13:56:40 -060063 mem_tag_arch_support ?= yes
Govindraj Rajaf5211422023-08-17 10:41:48 -050064endif #(ARCH=aarch64)
65
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +000066endif
67
68# Enable the features which are mandatory from ARCH version 8.6 and upwards.
69ifeq "8.6" "$(word 1, $(sort 8.6 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
Govindraj Raja48b41b42024-01-23 14:20:52 -060070armv8-6-a-feats := ENABLE_FEAT_ECV ENABLE_FEAT_FGT
71# 8.5 Compliant
72armv8-6-a-feats += ${armv8-5-a-feats}
73FEAT_LIST := ${armv8-6-a-feats}
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +000074endif
75
76# Enable the features which are mandatory from ARCH version 8.7 and upwards.
77ifeq "8.7" "$(word 1, $(sort 8.7 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
Govindraj Raja48b41b42024-01-23 14:20:52 -060078armv8-7-a-feats := ENABLE_FEAT_HCX
79# 8.6 Compliant
80armv8-7-a-feats += ${armv8-6-a-feats}
81FEAT_LIST := ${armv8-7-a-feats}
82endif
83
84# Enable the features which are mandatory from ARCH version 8.8 and upwards.
85ifeq "8.8" "$(word 1, $(sort 8.8 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
86# 8.7 Compliant
87armv8-7-a-feats += ${armv8-7-a-feats}
88FEAT_LIST := ${armv8-8-a-feats}
Jayanth Dodderi Chidanand6a0da732022-01-17 18:57:17 +000089endif
Govindraj Rajaf5211422023-08-17 10:41:48 -050090
91# Enable the features which are mandatory from ARCH version 8.9 and upwards.
92ifeq "8.9" "$(word 1, $(sort 8.9 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
Govindraj Raja48b41b42024-01-23 14:20:52 -060093armv8-9-a-feats := ENABLE_FEAT_TCR2
94# 8.8 Compliant
95armv8-9-a-feats += ${armv8-8-a-feats}
96FEAT_LIST := ${armv8-9-a-feats}
Govindraj Rajaf5211422023-08-17 10:41:48 -050097endif
98
Govindraj Raja48b41b42024-01-23 14:20:52 -060099# Enable the features which are mandatory from ARCH version 9.0 and upwards.
100ifeq "9.0" "$(word 1, $(sort 9.0 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
101# 8.5 Compliant
102armv9-0-a-feats += ${armv8-5-a-feats}
103FEAT_LIST := ${armv9-0-a-feats}
104endif
105
106# Enable the features which are mandatory from ARCH version 9.1 and upwards.
107ifeq "9.1" "$(word 1, $(sort 9.1 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
108# 8.6 and 9.0 Compliant
109armv9-1-a-feats += ${armv8-6-a-feats} ${armv9-0-a-feats}
110FEAT_LIST := ${armv9-1-a-feats}
111endif
112
113# Enable the features which are mandatory from ARCH version 9.2 and upwards.
114ifeq "9.2" "$(word 1, $(sort 9.2 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
115# 8.7 and 9.1 Compliant
116armv9-2-a-feats += ${armv8-7-a-feats} ${armv9-1-a-feats}
117FEAT_LIST := ${armv9-2-a-feats}
118endif
119
120# Enable the features which are mandatory from ARCH version 9.3 and upwards.
121ifeq "9.3" "$(word 1, $(sort 9.3 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
122# 8.8 and 9.2 Compliant
123armv9-3-a-feats += ${armv8-8-a-feats} ${armv9-2-a-feats}
124FEAT_LIST := ${armv9-3-a-feats}
125endif
126
127# Set all FEAT_* in FEAT_LIST to '1' if they are not yet defined or set
128# from build commandline options or platform makefile.
129$(eval $(call default_ones, ${sort ${FEAT_LIST}}))
130
Govindraj Rajaf5211422023-08-17 10:41:48 -0500131#
132################################################################################
Govindraj Rajaf0d19762024-01-24 11:42:40 -0600133# Set mandatory features by default to zero, if they are not already updated.
Govindraj Rajafb730112023-10-09 13:56:06 -0500134################################################################################
135#
136
137#----
138# 8.1
139#----
140
141# Flag to enable access to Privileged Access Never bit of PSTATE.
142ENABLE_FEAT_PAN ?= 0
143
144# Flag to enable Virtualization Host Extensions.
145ENABLE_FEAT_VHE ?= 0
146
147#----
148# 8.2
149#----
150
151# Enable RAS Support.
152ENABLE_FEAT_RAS ?= 0
153
154#----
155# 8.3
156#----
157
158# Flag to enable Pointer Authentication. Internal flag not meant for
159# direct setting. Use BRANCH_PROTECTION to enable PAUTH.
160ENABLE_PAUTH ?= 0
161
162# Include pointer authentication (ARMv8.3-PAuth) registers in cpu context. This
163# must be set to 1 if the platform wants to use this feature in the Secure
164# world. It is not necessary for use in the Non-secure world.
165CTX_INCLUDE_PAUTH_REGS ?= 0
166
167
168#----
169# 8.4
170#----
171
172# Flag to enable Secure EL-2 feature.
173ENABLE_FEAT_SEL2 ?= 0
174
175# By default, disable trace filter control register access to lower non-secure
176# exception levels, i.e. NS-EL2, or NS-EL1 if NS-EL2 is implemented, but
177# trace filter control register access is unused if FEAT_TRF is implemented.
178ENABLE_TRF_FOR_NS ?= 0
179
180# Flag to enable Data Independent Timing instructions.
181ENABLE_FEAT_DIT ?= 0
182
183#----
184# 8.5
185#----
186
187# Flag to enable Branch Target Identification.
188# Internal flag not meant for direct setting.
189# Use BRANCH_PROTECTION to enable BTI.
190ENABLE_BTI ?= 0
191
192# Flag to enable access to the Random Number Generator registers.
193ENABLE_FEAT_RNG ?= 0
194
195# Flag to enable Speculation Barrier Instruction.
196ENABLE_FEAT_SB ?= 0
197
198#----
199# 8.6
200#----
201
202# Flag to enable access to the CNTPOFF_EL2 register.
203ENABLE_FEAT_ECV ?= 0
204
205# Flag to enable access to the HDFGRTR_EL2 register.
206ENABLE_FEAT_FGT ?= 0
207
208#----
209# 8.7
210#----
211
212# Flag to enable access to the HCRX_EL2 register by setting SCR_EL3.HXEn.
213ENABLE_FEAT_HCX ?= 0
214
215#----
216# 8.9
217#----
218
219# Flag to enable access to TCR2 (FEAT_TCR2).
220ENABLE_FEAT_TCR2 ?= 0
221
222#
223################################################################################
Govindraj Rajaf5211422023-08-17 10:41:48 -0500224# Optional Features defaulted to 0 or 2, if they are not enabled from
225# build option. Can also be disabled or enabled by platform if needed.
226################################################################################
227#
228
229#----
230# 8.0
231#----
232
233# Flag to enable CSV2_2 extension.
234ENABLE_FEAT_CSV2_2 ?= 0
235
236# By default, disable access of trace system registers from NS lower
237# ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused if
238# system register trace is implemented. This feature is available if
239# trace unit such as ETMv4.x, This feature is OPTIONAL and is only
240# permitted in Armv8 implementations.
241ENABLE_SYS_REG_TRACE_FOR_NS ?= 0
242
243#----
244# 8.2
245#----
246
247# Build option to enable/disable the Statistical Profiling Extension,
248# keep it enabled by default for AArch64.
249ifeq (${ARCH},aarch64)
Govindraj Raja1ca73b42023-09-20 15:31:45 -0500250 ENABLE_SPE_FOR_NS ?= 2
Govindraj Rajaf5211422023-08-17 10:41:48 -0500251else ifeq (${ARCH},aarch32)
Govindraj Rajaf0c813b2023-10-17 08:13:03 -0500252 ifneq ($(or $(ENABLE_SPE_FOR_NS),0),0)
Govindraj Raja1ca73b42023-09-20 15:31:45 -0500253 $(error ENABLE_SPE_FOR_NS is not supported for AArch32)
254 else
255 ENABLE_SPE_FOR_NS := 0
256 endif
Govindraj Rajaf5211422023-08-17 10:41:48 -0500257endif
258
259# Enable SVE for non-secure world by default.
260ifeq (${ARCH},aarch64)
Govindraj Raja1ca73b42023-09-20 15:31:45 -0500261 ENABLE_SVE_FOR_NS ?= 2
Govindraj Rajaf5211422023-08-17 10:41:48 -0500262# SVE is only supported on AArch64 so disable it on AArch32.
263else ifeq (${ARCH},aarch32)
Govindraj Rajaf0c813b2023-10-17 08:13:03 -0500264 ifneq ($(or $(ENABLE_SVE_FOR_NS),0),0)
Govindraj Raja1ca73b42023-09-20 15:31:45 -0500265 $(error ENABLE_SVE_FOR_NS is not supported for AArch32)
266 else
267 ENABLE_SVE_FOR_NS := 0
268 endif
Govindraj Rajaf5211422023-08-17 10:41:48 -0500269endif
270
271#----
272# 8.4
273#----
274
275# Feature flags for supporting Activity monitor extensions.
276ENABLE_FEAT_AMU ?= 0
277ENABLE_AMU_AUXILIARY_COUNTERS ?= 0
278ENABLE_AMU_FCONF ?= 0
279AMU_RESTRICT_COUNTERS ?= 0
280
281# Build option to enable MPAM for lower ELs.
Arvind Ram Prakashedebefb2023-10-11 12:10:56 -0500282# Enabling it by default
283ifeq (${ARCH},aarch64)
Harrison Mutai72f027c2023-10-31 10:15:41 +0000284 ENABLE_FEAT_MPAM ?= 2
Arvind Ram Prakashedebefb2023-10-11 12:10:56 -0500285else ifeq (${ARCH},aarch32)
Harrison Mutai72f027c2023-10-31 10:15:41 +0000286 ifneq ($(or $(ENABLE_FEAT_MPAM),0),0)
287 $(error ENABLE_FEAT_MPAM is not supported for AArch32)
288 else
289 ENABLE_FEAT_MPAM := 0
290 endif
Arvind Ram Prakashedebefb2023-10-11 12:10:56 -0500291endif
Govindraj Rajaf5211422023-08-17 10:41:48 -0500292
Govindraj Raja8b2048c2023-09-19 08:43:16 -0500293# Include nested virtualization control (Armv8.4-NV) registers in cpu context.
294# This must be set to 1 if architecture implements Nested Virtualization
295# Extension and platform wants to use this feature in the Secure world.
296CTX_INCLUDE_NEVE_REGS ?= 0
297
Govindraj Rajaf5211422023-08-17 10:41:48 -0500298#----
299# 8.5
300#----
301
302# Flag to enable support for EL3 trapping of reads of the RNDR and RNDRRS
303# registers, by setting SCR_EL3.TRNDR.
304ENABLE_FEAT_RNG_TRAP ?= 0
305
306# Include Memory Tagging Extension registers in cpu context. This must be set
307# to 1 if the platform wants to use this feature in the Secure world and MTE is
308# enabled at ELX.
309CTX_INCLUDE_MTE_REGS ?= 0
310
311#----
312# 8.6
313#----
314
315# Flag to enable AMUv1p1 extension.
316ENABLE_FEAT_AMUv1p1 ?= 0
317
318# Flag to enable delayed trapping of WFE instruction (FEAT_TWED).
319ENABLE_FEAT_TWED ?= 0
320
321# In v8.6+ platforms with delayed trapping of WFE being supported
322# via FEAT_TWED, this flag takes the delay value to be set in the
323# SCR_EL3.TWEDEL(4bit) field, when FEAT_TWED is implemented.
324# By default it takes 0, and need to be updated by the platforms.
325TWED_DELAY ?= 0
326
327# Disable MTPMU if FEAT_MTPMU is supported.
328DISABLE_MTPMU ?= 0
329
330#----
331# 8.9
332#----
333
334# Flag to enable NoTagAccess memory region attribute for stage 2 of translation.
335ENABLE_FEAT_MTE_PERM ?= 0
336
337# Flag to enable access to Stage 2 Permission Indirection (FEAT_S2PIE).
338ENABLE_FEAT_S2PIE ?= 0
339
340# Flag to enable access to Stage 1 Permission Indirection (FEAT_S1PIE).
341ENABLE_FEAT_S1PIE ?= 0
342
343# Flag to enable access to Stage 2 Permission Overlay (FEAT_S2POE).
344ENABLE_FEAT_S2POE ?= 0
345
346# Flag to enable access to Stage 1 Permission Overlay (FEAT_S1POE).
347ENABLE_FEAT_S1POE ?= 0
348
349#----
350# 9.0
351#----
352
Govindraj Rajaf5211422023-08-17 10:41:48 -0500353# Scalable Matrix Extension for non-secure world.
354ENABLE_SME_FOR_NS ?= 0
355
356# Scalable Vector Extension for secure world.
357ENABLE_SVE_FOR_SWD ?= 0
358
359# By default, disable access of trace buffer control registers from NS
360# lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
361# if FEAT_TRBE is implemented.
362# Note FEAT_TRBE is only supported on AArch64 - therefore do not enable in
363# AArch32.
364ifeq (${ARCH},aarch64)
Govindraj Raja1ca73b42023-09-20 15:31:45 -0500365 ENABLE_TRBE_FOR_NS ?= 0
Govindraj Rajaf5211422023-08-17 10:41:48 -0500366else ifeq (${ARCH},aarch32)
Govindraj Rajaf0c813b2023-10-17 08:13:03 -0500367 ifneq ($(or $(ENABLE_TRBE_FOR_NS),0),0)
368 $(error ENABLE_TRBE_FOR_NS is not supported for AArch32)
Govindraj Raja1ca73b42023-09-20 15:31:45 -0500369 else
Govindraj Rajaf0c813b2023-10-17 08:13:03 -0500370 ENABLE_TRBE_FOR_NS := 0
Govindraj Raja1ca73b42023-09-20 15:31:45 -0500371 endif
Govindraj Rajaf5211422023-08-17 10:41:48 -0500372endif
373
374#----
375# 9.2
376#----
377
Govindraj Rajaf0d19762024-01-24 11:42:40 -0600378# Flag to enable Realm Management Extension (FEAT_RME).
379ENABLE_RME ?= 0
380
Govindraj Rajaf5211422023-08-17 10:41:48 -0500381# Scalable Matrix Extension version 2 for non-secure world.
382ENABLE_SME2_FOR_NS ?= 0
383
384# Scalable Matrix Extension for secure world.
385ENABLE_SME_FOR_SWD ?= 0
386
387# By default, disable access to branch record buffer control registers from NS
388# lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
389# if FEAT_BRBE is implemented.
390ENABLE_BRBE_FOR_NS ?= 0
391
392#----
393#9.4
394#----
395
396# Flag to enable access to Guarded Control Stack (FEAT_GCS).
397ENABLE_FEAT_GCS ?= 0