xref: /rk3399_ARM-atf/make_helpers/arch_features.mk (revision 95b96ab605d4e54c509fe6458dfc7e84a15aed4e)
1#
2# Copyright (c) 2022-2026, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# 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:
11#   - Enable mandatory feature if not updated, as applicable to an Arch Version.
12#   - By default disable any mandatory features if they have not been defined yet.
13#   - Disable or enable any optional feature this would be enabled/disabled if needed by platform.
14
15#
16################################################################################
17# Enable Mandatory features if not updated yet, based on Arch versions.
18################################################################################
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)))"
23armv8-1-a-feats         := ENABLE_FEAT_PAN ENABLE_FEAT_VHE
24
25FEAT_LIST               := ${armv8-1-a-feats}
26endif
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)))"
30armv8-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}
43endif
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)))"
47armv8-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}
52endif
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)))"
56armv8-5-a-feats         := ENABLE_FEAT_RNG ENABLE_FEAT_SB
57# 8.4 Compliant
58armv8-5-a-feats         += ${armv8-4-a-feats}
59
60FEAT_LIST               := ${armv8-5-a-feats}
61endif
62
63# Enable the features which are mandatory from ARCH version 8.6 and upwards.
64ifeq "8.6" "$(word 1, $(sort 8.6 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
65armv8-6-a-feats         := ENABLE_FEAT_ECV ENABLE_FEAT_FGT
66# 8.5 Compliant
67armv8-6-a-feats         += ${armv8-5-a-feats}
68FEAT_LIST               := ${armv8-6-a-feats}
69endif
70
71# Enable the features which are mandatory from ARCH version 8.7 and upwards.
72ifeq "8.7" "$(word 1, $(sort 8.7 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
73armv8-7-a-feats         := ENABLE_FEAT_HCX
74# 8.6 Compliant
75armv8-7-a-feats         += ${armv8-6-a-feats}
76FEAT_LIST               := ${armv8-7-a-feats}
77endif
78
79# Enable the features which are mandatory from ARCH version 8.8 and upwards.
80ifeq "8.8" "$(word 1, $(sort 8.8 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
81armv8-8-a-feats		:= ENABLE_FEAT_MOPS
82# 8.7 Compliant
83armv8-8-a-feats         += ${armv8-7-a-feats}
84FEAT_LIST               := ${armv8-8-a-feats}
85endif
86
87# Enable the features which are mandatory from ARCH version 8.9 and upwards.
88ifeq "8.9" "$(word 1, $(sort 8.9 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
89armv8-9-a-feats         := ENABLE_FEAT_TCR2 ENABLE_FEAT_DEBUGV8P9	\
90			   ENABLE_FEAT_SCTLR2 ENABLE_FEAT_CLRBHB
91# 8.8 Compliant
92armv8-9-a-feats         += ${armv8-8-a-feats}
93FEAT_LIST               := ${armv8-9-a-feats}
94endif
95
96# Enable the features which are mandatory from ARCH version 9.0 and upwards.
97ifeq "9.0" "$(word 1, $(sort 9.0 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
98# 8.5 Compliant
99armv9-0-a-feats         += ${armv8-5-a-feats}
100FEAT_LIST               := ${armv9-0-a-feats}
101endif
102
103# Enable the features which are mandatory from ARCH version 9.1 and upwards.
104ifeq "9.1" "$(word 1, $(sort 9.1 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
105# 8.6 and 9.0 Compliant
106armv9-1-a-feats         += ${armv8-6-a-feats} ${armv9-0-a-feats}
107FEAT_LIST               := ${armv9-1-a-feats}
108endif
109
110# Enable the features which are mandatory from ARCH version 9.2 and upwards.
111ifeq "9.2" "$(word 1, $(sort 9.2 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
112# 8.7 and 9.1 Compliant
113armv9-2-a-feats         += ${armv8-7-a-feats} ${armv9-1-a-feats}
114FEAT_LIST               := ${armv9-2-a-feats}
115endif
116
117# Enable the features which are mandatory from ARCH version 9.3 and upwards.
118ifeq "9.3" "$(word 1, $(sort 9.3 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
119# 8.8 and 9.2 Compliant
120armv9-3-a-feats         += ${armv8-8-a-feats} ${armv9-2-a-feats}
121FEAT_LIST               := ${armv9-3-a-feats}
122endif
123
124# Enable the features which are mandatory from ARCH version 9.4 and upwards.
125ifeq "9.4" "$(word 1, $(sort 9.4 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
126# 8.9 and 9.3 Compliant
127armv9-4-a-feats         += ${armv8-9-a-feats} ${armv9-3-a-feats}
128FEAT_LIST               := ${armv9-4-a-feats}
129endif
130
131# Enable the features which are mandatory from ARCH version 9.5 and upwards.
132ifeq "9.5" "$(word 1, $(sort 9.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
133# 9.4 Compliant
134armv9-5-a-feats         := ENABLE_FEAT_STEP2
135armv9-5-a-feats         += ${armv9-4-a-feats}
136FEAT_LIST               := ${armv9-5-a-feats}
137endif
138
139# Enable the features which are mandatory from ARCH version 9.6 and upwards.
140ifeq "9.6" "$(word 1, $(sort 9.6 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
141# 9.5 Compliant
142armv9-6-a-feats         := ENABLE_FEAT_UINJ
143armv9-6-a-feats         += ${armv9-5-a-feats}
144FEAT_LIST               := ${armv9-6-a-feats}
145endif
146
147# Set all FEAT_* in FEAT_LIST to '1' if they are not yet defined or set
148# from build commandline options or platform makefile.
149$(eval $(call default_ones, ${sort ${FEAT_LIST}}))
150
151#
152################################################################################
153# Set mandatory features by default to zero, if they are not already updated.
154################################################################################
155#
156
157# Flag to enable the spinlock implementation variant using the FEAT_LSE
158# compare-and-swap instruction.
159USE_SPINLOCK_CAS		?=	0
160
161#----
162# 8.1
163#----
164
165# Flag to enable access to Privileged Access Never bit of PSTATE.
166ENABLE_FEAT_PAN			?=	0
167
168# Flag to enable Virtualization Host Extensions.
169ENABLE_FEAT_VHE			?=	0
170
171#----
172# 8.2
173#----
174
175# Enable RAS Support.
176ENABLE_FEAT_RAS			?=	0
177
178#----
179# 8.3
180#----
181
182# Flag to enable Pointer Authentication. Internal flag not meant for
183# direct setting. Use BRANCH_PROTECTION to enable PAUTH.
184ENABLE_PAUTH			?=	0
185
186# FEAT_PAUTH_LR is an optional architectural feature, so this flag must be set
187# manually in addition to the BRANCH_PROTECTION flag which is used for other
188# branch protection and pointer authentication features.
189ENABLE_FEAT_PAUTH_LR		?=	0
190
191# Include pointer authentication (ARMv8.3-PAuth) registers in cpu context. This
192# must be set to 1 if the platform wants to use this feature in the Secure
193# world. It is not necessary for use in the Non-secure world.
194CTX_INCLUDE_PAUTH_REGS		?=	0
195
196
197#----
198# 8.4
199#----
200
201# Flag to enable Secure EL-2 feature.
202ENABLE_FEAT_SEL2		?=	0
203
204# By default, disable trace filter control register access to lower non-secure
205# exception levels, i.e. NS-EL2, or NS-EL1 if NS-EL2 is implemented, but
206# trace filter control register access is unused if FEAT_TRF is implemented.
207ENABLE_TRF_FOR_NS		?=	0
208
209# Flag to enable Data Independent Timing instructions.
210ENABLE_FEAT_DIT			?=	0
211
212#----
213# 8.5
214#----
215
216# Flag to enable Branch Target Identification.
217# Internal flag not meant for direct setting.
218# Use BRANCH_PROTECTION to enable BTI.
219ENABLE_BTI			?=	0
220
221# Flag to enable access to the Random Number Generator registers.
222ENABLE_FEAT_RNG			?=	0
223
224# Flag to enable Speculation Barrier Instruction.
225ENABLE_FEAT_SB			?=	0
226
227#----
228# 8.6
229#----
230
231# Flag to enable access to the CNTPOFF_EL2 register.
232ENABLE_FEAT_ECV			?=	0
233
234# Flag to enable access to the HDFGRTR_EL2 register.
235ENABLE_FEAT_FGT			?=	0
236
237#----
238# 8.7
239#----
240
241# Flag to enable access to the HCRX_EL2 register by setting SCR_EL3.HXEn.
242ENABLE_FEAT_HCX			?=	0
243
244#----
245# 8.8
246#----
247
248# Flag to enable FEAT_MOPS (Standardization of Memory operations)
249# when INIT_UNUSED_NS_EL2 = 1
250ENABLE_FEAT_MOPS		?=	0
251
252#----
253# 8.9
254#----
255
256# Flag to enable access to TCR2 (FEAT_TCR2).
257ENABLE_FEAT_TCR2		?=	0
258
259# Flag to enable access to SCTLR2 (FEAT_SCTLR2).
260ENABLE_FEAT_SCTLR2		?=	0
261
262#
263################################################################################
264# Optional Features defaulted to 0 or 2, if they are not enabled from
265# build option. Can also be disabled or enabled by platform if needed.
266################################################################################
267#
268
269#----
270# 8.0
271#----
272
273# Flag to enable support for clrbhb instruction.
274ENABLE_FEAT_CLRBHB			?=	0
275
276# Flag to enable CSV2_2 extension.
277ENABLE_FEAT_CSV2_2			?=	0
278
279# Flag to enable CSV2_3 extension. FEAT_CSV2_3 enables access to the
280# SCXTNUM_ELx register.
281ENABLE_FEAT_CSV2_3			?=	0
282
283# By default, disable access of trace system registers from NS lower
284# ELs  i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused if
285# system register trace is implemented. This feature is available if
286# trace unit such as ETMv4.x, This feature is OPTIONAL and is only
287# permitted in Armv8 implementations.
288ENABLE_SYS_REG_TRACE_FOR_NS		?=	0
289
290#----
291# 8.2
292#----
293
294# Build option to enable/disable the Statistical Profiling Extension,
295# keep it enabled by default for AArch64.
296ifeq (${ARCH},aarch64)
297       ENABLE_SPE_FOR_NS		?=	2
298else ifeq (${ARCH},aarch32)
299       ENABLE_SPE_FOR_NS		:=	0
300endif
301
302# Enable SVE for non-secure world by default.
303ifeq (${ARCH},aarch64)
304       ENABLE_SVE_FOR_NS		?=	2
305# SVE is only supported on AArch64 so disable it on AArch32.
306else ifeq (${ARCH},aarch32)
307       ENABLE_SVE_FOR_NS		:=	0
308endif
309
310#----
311# 8.4
312#----
313
314# Feature flags for supporting Activity monitor extensions.
315ENABLE_FEAT_AMU				?=	0
316ENABLE_AMU_AUXILIARY_COUNTERS		?=	0
317AMU_RESTRICT_COUNTERS			?=	1
318
319# Build option to enable MPAM for lower ELs.
320# Enabling it by default
321ifeq (${ARCH},aarch64)
322        ENABLE_FEAT_MPAM		?=	2
323else ifeq (${ARCH},aarch32)
324        ENABLE_FEAT_MPAM		:=	0
325endif
326
327# Include nested virtualization control (Armv8.4-NV) registers in cpu context.
328# This must be set to 1 if architecture implements Nested Virtualization
329# Extension and platform wants to use this feature in the Secure world.
330CTX_INCLUDE_NEVE_REGS			?=	0
331
332#----
333# 8.5
334#----
335
336# Flag to enable support for EL3 trapping of reads of the RNDR and RNDRRS
337# registers, by setting SCR_EL3.TRNDR.
338ENABLE_FEAT_RNG_TRAP			?=	0
339
340# Enable FEAT_MTE2. This must be set to 1 if the platform wants
341# to use this feature and is enabled at ELX.
342ENABLE_FEAT_MTE2		        ?=	0
343
344#----
345# 8.6
346#----
347
348# Flag to enable AMUv1p1 extension.
349ENABLE_FEAT_AMUv1p1			?=	0
350
351# Flag to enable delayed trapping of WFE instruction (FEAT_TWED).
352ENABLE_FEAT_TWED			?=	0
353
354# In v8.6+ platforms with delayed trapping of WFE being supported
355# via FEAT_TWED, this flag takes the delay value to be set in the
356# SCR_EL3.TWEDEL(4bit) field, when FEAT_TWED is implemented.
357# By default it takes 0, and need to be updated by the platforms.
358TWED_DELAY				?=	0
359
360# Disable MTPMU if FEAT_MTPMU is supported.
361DISABLE_MTPMU				?=	0
362
363# Flag to enable FEAT_FGT2 (Fine Granular Traps 2)
364ENABLE_FEAT_FGT2			?=	0
365
366# LoadStore64Bytes extension using the ACCDATA_EL1 system register
367ENABLE_FEAT_LS64_ACCDATA		?=	0
368
369#----
370# 8.8
371#----
372
373# Flag to enable FEAT_THE (Translation Hardening Extension)
374ENABLE_FEAT_THE				?=	0
375
376#----
377# 8.9
378#----
379
380# Flag to enable access to Stage 2 Permission Indirection (FEAT_S2PIE).
381ENABLE_FEAT_S2PIE			?=	0
382
383# Flag to enable access to Stage 1 Permission Indirection (FEAT_S1PIE).
384ENABLE_FEAT_S1PIE			?=	0
385
386# Flag to enable access to Stage 2 Permission Overlay (FEAT_S2POE).
387ENABLE_FEAT_S2POE			?=	0
388
389# Flag to enable access to Stage 1 Permission Overlay (FEAT_S1POE).
390ENABLE_FEAT_S1POE			?=	0
391
392# Flag to enable access to Arm v8.9 Debug extension
393ENABLE_FEAT_DEBUGV8P9			?=	0
394
395# AIE extension using the (A)MAIR2 system registers
396ENABLE_FEAT_AIE				?=	0
397
398# PFAR extension using the PFAR system registers
399ENABLE_FEAT_PFAR			?=	0
400
401#-------------------------------------------------------------
402# Non-standard feature
403#-------------------------------------------------------------
404ENABLE_FEAT_MORELLO			?=	0
405
406#----
407# 9.0
408#----
409
410# Scalable Matrix Extension for non-secure world.
411ENABLE_SME_FOR_NS			?=	0
412
413# Scalable Vector Extension for secure world.
414ENABLE_SVE_FOR_SWD			?=	0
415
416# By default, disable access of trace buffer control registers from NS
417# lower ELs  i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
418# if FEAT_TRBE is implemented.
419# Note FEAT_TRBE is only supported on AArch64 - therefore do not enable in
420# AArch32.
421ifeq (${ARCH},aarch64)
422        ENABLE_TRBE_FOR_NS		?=	0
423else ifeq (${ARCH},aarch32)
424        ifneq ($(or $(ENABLE_TRBE_FOR_NS),0),0)
425               $(error ENABLE_TRBE_FOR_NS is not supported for AArch32)
426        else
427               ENABLE_TRBE_FOR_NS 	:=	0
428        endif
429endif
430
431# Flag that enables hardware injection of undefined exceptions
432ENABLE_FEAT_UINJ			?=	0
433
434#----
435# 9.2
436#----
437
438# Flag to enable Realm Management Extension (FEAT_RME).
439ENABLE_RME				?=	0
440
441# Scalable Matrix Extension version 2 for non-secure world.
442ENABLE_SME2_FOR_NS			?=	0
443
444# Scalable Matrix Extension for secure world.
445ENABLE_SME_FOR_SWD			?=	0
446
447# By default, disable access to branch record buffer control registers from NS
448# lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
449# if FEAT_BRBE is implemented.
450ENABLE_BRBE_FOR_NS			?=	0
451
452# Flag to enable Floating point exception Mode Register Feature (FEAT_FPMR)
453ENABLE_FEAT_FPMR			?=	0
454
455# Flag to enable Memory Encryption Contexts (FEAT_MEC).
456ENABLE_FEAT_MEC				?=	0
457
458#----
459# 9.3
460#----
461# Flag to enable access to Arm v9.3 FEAT_D128 extension
462ENABLE_FEAT_D128			?=	0
463
464# Flag to enable access to GICv5 CPU interface extension (FEAT_GCIE)
465ENABLE_FEAT_GCIE			?=	0
466
467# Enables access to PE-side MPAM bandwidth controls (FEAT_MPAM_PE_BW_CTRL)
468ENABLE_FEAT_MPAM_PE_BW_CTRL		?=	0
469
470# Flag to enable Exception-based Event Profiling (FEAT_EBEP)
471ENABLE_FEAT_EBEP			?=	0
472
473#----
474#9.4
475#----
476
477# Flag to enable FEAT_RME_GDI
478ENABLE_FEAT_RME_GDI			?=	0
479
480# Flag to enable access to Guarded Control Stack (FEAT_GCS).
481ENABLE_FEAT_GCS				?=	0
482
483# Flag to enable Fine Grained Write Traps (FEAT_FGWTE3) for EL3.
484ENABLE_FEAT_FGWTE3			?=	0
485
486# Flag to enable checked pointer arithmetic (FEAT_CPA2) for EL3.
487# We don't have a flag for FEAT_CPA since that has no effect on software
488ENABLE_FEAT_CPA2			?=	0
489
490# Flag to enable Enhanced Software Step Extension (FEAT_STEP2)
491ENABLE_FEAT_STEP2			?=	0
492
493# Flag to enable Hardware Dirty state tracking structure (FEAT_HDBSS).
494ENABLE_FEAT_HDBSS			?=	0
495
496# Flag to enable Hardening Address and Context Debug Banked State (FEAT_HACDBS).
497ENABLE_FEAT_HACDBS			?=	0
498
499#----
500#9.6
501#----
502
503# Flag to enable trapping of ID registers to EL3
504ENABLE_FEAT_IDTE3                       ?=      0
505