blob: 57609d51c10f8743da2a25de0b8b0a6912cb894f [file] [log] [blame]
Jayanth Dodderi Chidanand9461a892022-01-17 18:57:17 +00001#
Govindraj Raja24d3a4e2023-12-21 13:57:49 -06002# Copyright (c) 2022-2024, Arm Limited. All rights reserved.
Jayanth Dodderi Chidanand9461a892022-01-17 18:57:17 +00003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Govindraj Raja0386e312023-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 Rajaf7676dd2024-01-24 11:42:40 -060011# - Enable mandatory feature if not updated, as applicable to an Arch Version.
Govindraj Raja16b11372023-10-09 13:56:06 -050012# - By default disable any mandatory features if they have not been defined yet.
Govindraj Raja0386e312023-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 Rajaf7676dd2024-01-24 11:42:40 -060017# Enable Mandatory features if not updated yet, based on Arch versions.
Govindraj Raja16b11372023-10-09 13:56:06 -050018################################################################################
19#
20
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 Raja7dc5f1b2024-01-23 14:20:52 -060023armv8-1-a-feats := ENABLE_FEAT_PAN ENABLE_FEAT_VHE
24
25FEAT_LIST := ${armv8-1-a-feats}
Govindraj Raja16b11372023-10-09 13:56:06 -050026endif
27
28# 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 Raja7dc5f1b2024-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}
Govindraj Raja16b11372023-10-09 13:56:06 -050043endif
44
45# 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 Raja7dc5f1b2024-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}
Govindraj Raja16b11372023-10-09 13:56:06 -050052endif
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 Raja7dc5f1b2024-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 Raja16b11372023-10-09 13:56:06 -050059
Govindraj Raja7dc5f1b2024-01-23 14:20:52 -060060FEAT_LIST := ${armv8-5-a-feats}
Govindraj Raja16b11372023-10-09 13:56:06 -050061# Enable Memory tagging, Branch Target Identification for aarch64 only.
62ifeq ($(ARCH), aarch64)
Govindraj Raja01f97012024-01-11 13:56:40 -060063 mem_tag_arch_support ?= yes
Govindraj Raja16b11372023-10-09 13:56:06 -050064endif #(ARCH=aarch64)
65
66endif
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 Raja7dc5f1b2024-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}
Govindraj Raja16b11372023-10-09 13:56:06 -050074endif
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 Raja7dc5f1b2024-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
Manish V Badarkhee901bac2024-11-08 09:41:51 +000087armv8-8-a-feats += ${armv8-7-a-feats}
Govindraj Raja7dc5f1b2024-01-23 14:20:52 -060088FEAT_LIST := ${armv8-8-a-feats}
Govindraj Raja16b11372023-10-09 13:56:06 -050089endif
90
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)))"
Jayanth Dodderi Chidanand70cc1752024-09-06 13:49:31 +010093armv8-9-a-feats := ENABLE_FEAT_TCR2 ENABLE_FEAT_DEBUGV8P9 ENABLE_FEAT_SCTLR2
Govindraj Raja7dc5f1b2024-01-23 14:20:52 -060094# 8.8 Compliant
95armv8-9-a-feats += ${armv8-8-a-feats}
96FEAT_LIST := ${armv8-9-a-feats}
Govindraj Raja16b11372023-10-09 13:56:06 -050097endif
98
Govindraj Raja7dc5f1b2024-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 Raja16b11372023-10-09 13:56:06 -0500131#
132################################################################################
Govindraj Rajaf7676dd2024-01-24 11:42:40 -0600133# Set mandatory features by default to zero, if they are not already updated.
Govindraj Raja0386e312023-08-17 10:41:48 -0500134################################################################################
135#
136
137#----
138# 8.1
139#----
140
141# Flag to enable access to Privileged Access Never bit of PSTATE.
Govindraj Raja16b11372023-10-09 13:56:06 -0500142ENABLE_FEAT_PAN ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500143
144# Flag to enable Virtualization Host Extensions.
Govindraj Raja16b11372023-10-09 13:56:06 -0500145ENABLE_FEAT_VHE ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500146
147#----
148# 8.2
149#----
150
151# Enable RAS Support.
Govindraj Raja16b11372023-10-09 13:56:06 -0500152ENABLE_FEAT_RAS ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500153
154#----
Govindraj Raja16b11372023-10-09 13:56:06 -0500155# 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#----
Govindraj Raja0386e312023-08-17 10:41:48 -0500169# 8.4
170#----
171
172# Flag to enable Secure EL-2 feature.
Govindraj Raja16b11372023-10-09 13:56:06 -0500173ENABLE_FEAT_SEL2 ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500174
Govindraj Raja0386e312023-08-17 10:41:48 -0500175# 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.
Govindraj Raja16b11372023-10-09 13:56:06 -0500178ENABLE_TRF_FOR_NS ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500179
180# Flag to enable Data Independent Timing instructions.
Govindraj Raja16b11372023-10-09 13:56:06 -0500181ENABLE_FEAT_DIT ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500182
183#----
184# 8.5
185#----
186
Govindraj Raja16b11372023-10-09 13:56:06 -0500187# 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
Govindraj Raja0386e312023-08-17 10:41:48 -0500192# Flag to enable access to the Random Number Generator registers.
Govindraj Raja16b11372023-10-09 13:56:06 -0500193ENABLE_FEAT_RNG ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500194
195# Flag to enable Speculation Barrier Instruction.
Govindraj Raja16b11372023-10-09 13:56:06 -0500196ENABLE_FEAT_SB ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500197
Govindraj Raja0386e312023-08-17 10:41:48 -0500198#----
199# 8.6
200#----
201
202# Flag to enable access to the CNTPOFF_EL2 register.
Govindraj Raja16b11372023-10-09 13:56:06 -0500203ENABLE_FEAT_ECV ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500204
205# Flag to enable access to the HDFGRTR_EL2 register.
Govindraj Raja16b11372023-10-09 13:56:06 -0500206ENABLE_FEAT_FGT ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500207
208#----
209# 8.7
210#----
211
212# Flag to enable access to the HCRX_EL2 register by setting SCR_EL3.HXEn.
Govindraj Raja16b11372023-10-09 13:56:06 -0500213ENABLE_FEAT_HCX ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500214
215#----
216# 8.9
217#----
218
219# Flag to enable access to TCR2 (FEAT_TCR2).
Govindraj Raja16b11372023-10-09 13:56:06 -0500220ENABLE_FEAT_TCR2 ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500221
Jayanth Dodderi Chidanand70cc1752024-09-06 13:49:31 +0100222# Flag to enable access to SCTLR2 (FEAT_SCTLR2).
223ENABLE_FEAT_SCTLR2 ?= 0
224
Govindraj Raja0386e312023-08-17 10:41:48 -0500225#
226################################################################################
Govindraj Raja0386e312023-08-17 10:41:48 -0500227# Optional Features defaulted to 0 or 2, if they are not enabled from
228# build option. Can also be disabled or enabled by platform if needed.
229################################################################################
230#
231
232#----
233# 8.0
234#----
235
236# Flag to enable CSV2_2 extension.
237ENABLE_FEAT_CSV2_2 ?= 0
238
Sona Mathew3b84c962023-10-25 16:48:19 -0500239# Flag to enable CSV2_3 extension. FEAT_CSV2_3 enables access to the
240# SCXTNUM_ELx register.
241ENABLE_FEAT_CSV2_3 ?= 0
242
Govindraj Raja0386e312023-08-17 10:41:48 -0500243# By default, disable access of trace system registers from NS lower
244# ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused if
245# system register trace is implemented. This feature is available if
246# trace unit such as ETMv4.x, This feature is OPTIONAL and is only
247# permitted in Armv8 implementations.
248ENABLE_SYS_REG_TRACE_FOR_NS ?= 0
249
250#----
251# 8.2
252#----
253
254# Build option to enable/disable the Statistical Profiling Extension,
255# keep it enabled by default for AArch64.
256ifeq (${ARCH},aarch64)
Govindraj Raja28b525c2023-09-20 15:31:45 -0500257 ENABLE_SPE_FOR_NS ?= 2
Govindraj Raja0386e312023-08-17 10:41:48 -0500258else ifeq (${ARCH},aarch32)
Govindraj Raja399541a2023-10-17 08:13:03 -0500259 ifneq ($(or $(ENABLE_SPE_FOR_NS),0),0)
Govindraj Raja28b525c2023-09-20 15:31:45 -0500260 $(error ENABLE_SPE_FOR_NS is not supported for AArch32)
261 else
262 ENABLE_SPE_FOR_NS := 0
263 endif
Govindraj Raja0386e312023-08-17 10:41:48 -0500264endif
265
266# Enable SVE for non-secure world by default.
267ifeq (${ARCH},aarch64)
Govindraj Raja28b525c2023-09-20 15:31:45 -0500268 ENABLE_SVE_FOR_NS ?= 2
Govindraj Raja0386e312023-08-17 10:41:48 -0500269# SVE is only supported on AArch64 so disable it on AArch32.
270else ifeq (${ARCH},aarch32)
Govindraj Raja399541a2023-10-17 08:13:03 -0500271 ifneq ($(or $(ENABLE_SVE_FOR_NS),0),0)
Govindraj Raja28b525c2023-09-20 15:31:45 -0500272 $(error ENABLE_SVE_FOR_NS is not supported for AArch32)
273 else
274 ENABLE_SVE_FOR_NS := 0
275 endif
Govindraj Raja0386e312023-08-17 10:41:48 -0500276endif
277
278#----
279# 8.4
280#----
281
282# Feature flags for supporting Activity monitor extensions.
283ENABLE_FEAT_AMU ?= 0
284ENABLE_AMU_AUXILIARY_COUNTERS ?= 0
285ENABLE_AMU_FCONF ?= 0
Juan Pablo Conde79b5f572024-04-03 13:18:40 -0500286AMU_RESTRICT_COUNTERS ?= 1
Govindraj Raja0386e312023-08-17 10:41:48 -0500287
288# Build option to enable MPAM for lower ELs.
Arvind Ram Prakashab28d4b2023-10-11 12:10:56 -0500289# Enabling it by default
290ifeq (${ARCH},aarch64)
Harrison Mutaibb75e4f2023-10-31 10:15:41 +0000291 ENABLE_FEAT_MPAM ?= 2
Arvind Ram Prakashab28d4b2023-10-11 12:10:56 -0500292else ifeq (${ARCH},aarch32)
Harrison Mutaibb75e4f2023-10-31 10:15:41 +0000293 ifneq ($(or $(ENABLE_FEAT_MPAM),0),0)
294 $(error ENABLE_FEAT_MPAM is not supported for AArch32)
295 else
296 ENABLE_FEAT_MPAM := 0
297 endif
Arvind Ram Prakashab28d4b2023-10-11 12:10:56 -0500298endif
Govindraj Raja0386e312023-08-17 10:41:48 -0500299
Govindraj Raja3748d902023-09-19 08:43:16 -0500300# Include nested virtualization control (Armv8.4-NV) registers in cpu context.
301# This must be set to 1 if architecture implements Nested Virtualization
302# Extension and platform wants to use this feature in the Secure world.
303CTX_INCLUDE_NEVE_REGS ?= 0
304
Govindraj Raja0386e312023-08-17 10:41:48 -0500305#----
306# 8.5
307#----
308
309# Flag to enable support for EL3 trapping of reads of the RNDR and RNDRRS
310# registers, by setting SCR_EL3.TRNDR.
311ENABLE_FEAT_RNG_TRAP ?= 0
312
Govindraj Rajac1be66f2024-03-07 14:42:20 -0600313# Enable FEAT_MTE2. This must be set to 1 if the platform wants
314# to use this feature and is enabled at ELX.
315ENABLE_FEAT_MTE2 ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500316
317#----
318# 8.6
319#----
320
321# Flag to enable AMUv1p1 extension.
322ENABLE_FEAT_AMUv1p1 ?= 0
323
324# Flag to enable delayed trapping of WFE instruction (FEAT_TWED).
325ENABLE_FEAT_TWED ?= 0
326
327# In v8.6+ platforms with delayed trapping of WFE being supported
328# via FEAT_TWED, this flag takes the delay value to be set in the
329# SCR_EL3.TWEDEL(4bit) field, when FEAT_TWED is implemented.
330# By default it takes 0, and need to be updated by the platforms.
331TWED_DELAY ?= 0
332
333# Disable MTPMU if FEAT_MTPMU is supported.
334DISABLE_MTPMU ?= 0
335
Arvind Ram Prakash62d87e72024-06-06 11:33:37 -0500336# Flag to enable FEAT_FGT2 (Fine Granular Traps 2)
337ENABLE_FEAT_FGT2 ?= 0
338
Andre Przywara8fc8e182024-08-09 17:04:22 +0100339# LoadStore64Bytes extension using the ACCDATA_EL1 system register
340ENABLE_FEAT_LS64_ACCDATA ?= 0
341
Govindraj Raja0386e312023-08-17 10:41:48 -0500342#----
Jayanth Dodderi Chidanand6b706862024-09-05 22:24:04 +0100343# 8.8
344#----
345
346# Flag to enable FEAT_THE (Translation Hardening Extension)
347ENABLE_FEAT_THE ?= 0
348
349#----
Govindraj Raja0386e312023-08-17 10:41:48 -0500350# 8.9
351#----
352
Govindraj Raja0386e312023-08-17 10:41:48 -0500353# Flag to enable access to Stage 2 Permission Indirection (FEAT_S2PIE).
354ENABLE_FEAT_S2PIE ?= 0
355
356# Flag to enable access to Stage 1 Permission Indirection (FEAT_S1PIE).
357ENABLE_FEAT_S1PIE ?= 0
358
359# Flag to enable access to Stage 2 Permission Overlay (FEAT_S2POE).
360ENABLE_FEAT_S2POE ?= 0
361
362# Flag to enable access to Stage 1 Permission Overlay (FEAT_S1POE).
363ENABLE_FEAT_S1POE ?= 0
364
Arvind Ram Prakash05b47632024-05-22 15:24:00 -0500365# Flag to enable access to Arm v8.9 Debug extension
366ENABLE_FEAT_DEBUGV8P9 ?= 0
367
Govindraj Raja0386e312023-08-17 10:41:48 -0500368#----
369# 9.0
370#----
371
Govindraj Raja0386e312023-08-17 10:41:48 -0500372# Scalable Matrix Extension for non-secure world.
373ENABLE_SME_FOR_NS ?= 0
374
375# Scalable Vector Extension for secure world.
376ENABLE_SVE_FOR_SWD ?= 0
377
378# By default, disable access of trace buffer control registers from NS
379# lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
380# if FEAT_TRBE is implemented.
381# Note FEAT_TRBE is only supported on AArch64 - therefore do not enable in
382# AArch32.
383ifeq (${ARCH},aarch64)
Govindraj Raja28b525c2023-09-20 15:31:45 -0500384 ENABLE_TRBE_FOR_NS ?= 0
Govindraj Raja0386e312023-08-17 10:41:48 -0500385else ifeq (${ARCH},aarch32)
Govindraj Raja399541a2023-10-17 08:13:03 -0500386 ifneq ($(or $(ENABLE_TRBE_FOR_NS),0),0)
387 $(error ENABLE_TRBE_FOR_NS is not supported for AArch32)
Govindraj Raja28b525c2023-09-20 15:31:45 -0500388 else
Govindraj Raja399541a2023-10-17 08:13:03 -0500389 ENABLE_TRBE_FOR_NS := 0
Govindraj Raja28b525c2023-09-20 15:31:45 -0500390 endif
Govindraj Raja0386e312023-08-17 10:41:48 -0500391endif
392
393#----
394# 9.2
395#----
396
Govindraj Rajaf7676dd2024-01-24 11:42:40 -0600397# Flag to enable Realm Management Extension (FEAT_RME).
398ENABLE_RME ?= 0
399
Govindraj Raja0386e312023-08-17 10:41:48 -0500400# Scalable Matrix Extension version 2 for non-secure world.
401ENABLE_SME2_FOR_NS ?= 0
402
403# Scalable Matrix Extension for secure world.
404ENABLE_SME_FOR_SWD ?= 0
405
406# By default, disable access to branch record buffer control registers from NS
407# lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
408# if FEAT_BRBE is implemented.
409ENABLE_BRBE_FOR_NS ?= 0
410
411#----
Govindraj Rajae63794e2024-09-06 15:43:43 +0100412# 9.3
413#----
414# Flag to enable access to Arm v9.3 FEAT_D128 extension
415ENABLE_FEAT_D128 ?= 0
416
417#----
Govindraj Raja0386e312023-08-17 10:41:48 -0500418#9.4
419#----
420
421# Flag to enable access to Guarded Control Stack (FEAT_GCS).
422ENABLE_FEAT_GCS ?= 0