Jayanth Dodderi Chidanand | 9461a89 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 1 | # |
Govindraj Raja | 24d3a4e | 2023-12-21 13:57:49 -0600 | [diff] [blame] | 2 | # Copyright (c) 2022-2024, Arm Limited. All rights reserved. |
Jayanth Dodderi Chidanand | 9461a89 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 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: |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 11 | # - Enable mandatory feature if applicable to an Arch Version. |
| 12 | # - By default disable any mandatory features if they have not been defined yet. |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 13 | # - Disable or enable any optional feature this would be enabled/disabled if needed by platform. |
| 14 | |
| 15 | # |
| 16 | ################################################################################ |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 17 | # Enable Mandatory features based on Arch versions. |
| 18 | ################################################################################ |
| 19 | # |
| 20 | |
| 21 | # Enable the features which are mandatory from ARCH version 8.1 and upwards. |
| 22 | ifeq "8.1" "$(word 1, $(sort 8.1 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" |
| 23 | ENABLE_FEAT_PAN := 1 |
| 24 | ENABLE_FEAT_VHE := 1 |
| 25 | endif |
| 26 | |
| 27 | # Enable the features which are mandatory from ARCH version 8.2 and upwards. |
| 28 | ifeq "8.2" "$(word 1, $(sort 8.2 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" |
| 29 | ENABLE_FEAT_RAS := 1 |
| 30 | endif |
| 31 | |
| 32 | # Enable the features which are mandatory from ARCH version 8.4 and upwards. |
| 33 | ifeq "8.4" "$(word 1, $(sort 8.4 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" |
| 34 | ENABLE_FEAT_SEL2 := 1 |
| 35 | ENABLE_TRF_FOR_NS := 1 |
| 36 | ENABLE_FEAT_DIT := 1 |
| 37 | endif |
| 38 | |
| 39 | # Enable the features which are mandatory from ARCH version 8.5 and upwards. |
| 40 | ifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" |
| 41 | ENABLE_FEAT_RNG := 1 |
| 42 | ENABLE_FEAT_SB := 1 |
| 43 | |
| 44 | # Enable Memory tagging, Branch Target Identification for aarch64 only. |
| 45 | ifeq ($(ARCH), aarch64) |
| 46 | mem_tag_arch_support := yes |
| 47 | endif #(ARCH=aarch64) |
| 48 | |
| 49 | endif |
| 50 | |
| 51 | # Enable the features which are mandatory from ARCH version 8.6 and upwards. |
| 52 | ifeq "8.6" "$(word 1, $(sort 8.6 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" |
| 53 | ENABLE_FEAT_ECV := 1 |
| 54 | ENABLE_FEAT_FGT := 1 |
| 55 | endif |
| 56 | |
| 57 | # Enable the features which are mandatory from ARCH version 8.7 and upwards. |
| 58 | ifeq "8.7" "$(word 1, $(sort 8.7 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" |
| 59 | ENABLE_FEAT_HCX := 1 |
| 60 | endif |
| 61 | |
| 62 | # Enable the features which are mandatory from ARCH version 8.9 and upwards. |
| 63 | ifeq "8.9" "$(word 1, $(sort 8.9 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" |
| 64 | ENABLE_FEAT_TCR2 := 1 |
| 65 | endif |
| 66 | |
| 67 | # |
| 68 | ################################################################################ |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 69 | # Set mandatory features by default to zero. |
| 70 | ################################################################################ |
| 71 | # |
| 72 | |
| 73 | #---- |
| 74 | # 8.1 |
| 75 | #---- |
| 76 | |
| 77 | # Flag to enable access to Privileged Access Never bit of PSTATE. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 78 | ENABLE_FEAT_PAN ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 79 | |
| 80 | # Flag to enable Virtualization Host Extensions. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 81 | ENABLE_FEAT_VHE ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 82 | |
| 83 | #---- |
| 84 | # 8.2 |
| 85 | #---- |
| 86 | |
| 87 | # Enable RAS Support. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 88 | ENABLE_FEAT_RAS ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 89 | |
| 90 | #---- |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 91 | # 8.3 |
| 92 | #---- |
| 93 | |
| 94 | # Flag to enable Pointer Authentication. Internal flag not meant for |
| 95 | # direct setting. Use BRANCH_PROTECTION to enable PAUTH. |
| 96 | ENABLE_PAUTH ?= 0 |
| 97 | |
| 98 | # Include pointer authentication (ARMv8.3-PAuth) registers in cpu context. This |
| 99 | # must be set to 1 if the platform wants to use this feature in the Secure |
| 100 | # world. It is not necessary for use in the Non-secure world. |
| 101 | CTX_INCLUDE_PAUTH_REGS ?= 0 |
| 102 | |
| 103 | |
| 104 | #---- |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 105 | # 8.4 |
| 106 | #---- |
| 107 | |
| 108 | # Flag to enable Secure EL-2 feature. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 109 | ENABLE_FEAT_SEL2 ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 110 | |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 111 | # By default, disable trace filter control register access to lower non-secure |
| 112 | # exception levels, i.e. NS-EL2, or NS-EL1 if NS-EL2 is implemented, but |
| 113 | # trace filter control register access is unused if FEAT_TRF is implemented. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 114 | ENABLE_TRF_FOR_NS ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 115 | |
| 116 | # Flag to enable Data Independent Timing instructions. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 117 | ENABLE_FEAT_DIT ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 118 | |
| 119 | #---- |
| 120 | # 8.5 |
| 121 | #---- |
| 122 | |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 123 | # Flag to enable Branch Target Identification. |
| 124 | # Internal flag not meant for direct setting. |
| 125 | # Use BRANCH_PROTECTION to enable BTI. |
| 126 | ENABLE_BTI ?= 0 |
| 127 | |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 128 | # Flag to enable access to the Random Number Generator registers. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 129 | ENABLE_FEAT_RNG ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 130 | |
| 131 | # Flag to enable Speculation Barrier Instruction. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 132 | ENABLE_FEAT_SB ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 133 | |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 134 | #---- |
| 135 | # 8.6 |
| 136 | #---- |
| 137 | |
| 138 | # Flag to enable access to the CNTPOFF_EL2 register. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 139 | ENABLE_FEAT_ECV ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 140 | |
| 141 | # Flag to enable access to the HDFGRTR_EL2 register. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 142 | ENABLE_FEAT_FGT ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 143 | |
| 144 | #---- |
| 145 | # 8.7 |
| 146 | #---- |
| 147 | |
| 148 | # Flag to enable access to the HCRX_EL2 register by setting SCR_EL3.HXEn. |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 149 | ENABLE_FEAT_HCX ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 150 | |
| 151 | #---- |
| 152 | # 8.9 |
| 153 | #---- |
| 154 | |
| 155 | # Flag to enable access to TCR2 (FEAT_TCR2). |
Govindraj Raja | 16b1137 | 2023-10-09 13:56:06 -0500 | [diff] [blame] | 156 | ENABLE_FEAT_TCR2 ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 157 | |
| 158 | # |
| 159 | ################################################################################ |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 160 | # Optional Features defaulted to 0 or 2, if they are not enabled from |
| 161 | # build option. Can also be disabled or enabled by platform if needed. |
| 162 | ################################################################################ |
| 163 | # |
| 164 | |
| 165 | #---- |
| 166 | # 8.0 |
| 167 | #---- |
| 168 | |
| 169 | # Flag to enable CSV2_2 extension. |
| 170 | ENABLE_FEAT_CSV2_2 ?= 0 |
| 171 | |
| 172 | # By default, disable access of trace system registers from NS lower |
| 173 | # ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused if |
| 174 | # system register trace is implemented. This feature is available if |
| 175 | # trace unit such as ETMv4.x, This feature is OPTIONAL and is only |
| 176 | # permitted in Armv8 implementations. |
| 177 | ENABLE_SYS_REG_TRACE_FOR_NS ?= 0 |
| 178 | |
| 179 | #---- |
| 180 | # 8.2 |
| 181 | #---- |
| 182 | |
| 183 | # Build option to enable/disable the Statistical Profiling Extension, |
| 184 | # keep it enabled by default for AArch64. |
| 185 | ifeq (${ARCH},aarch64) |
Govindraj Raja | 28b525c | 2023-09-20 15:31:45 -0500 | [diff] [blame] | 186 | ENABLE_SPE_FOR_NS ?= 2 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 187 | else ifeq (${ARCH},aarch32) |
Govindraj Raja | 399541a | 2023-10-17 08:13:03 -0500 | [diff] [blame] | 188 | ifneq ($(or $(ENABLE_SPE_FOR_NS),0),0) |
Govindraj Raja | 28b525c | 2023-09-20 15:31:45 -0500 | [diff] [blame] | 189 | $(error ENABLE_SPE_FOR_NS is not supported for AArch32) |
| 190 | else |
| 191 | ENABLE_SPE_FOR_NS := 0 |
| 192 | endif |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 193 | endif |
| 194 | |
| 195 | # Enable SVE for non-secure world by default. |
| 196 | ifeq (${ARCH},aarch64) |
Govindraj Raja | 28b525c | 2023-09-20 15:31:45 -0500 | [diff] [blame] | 197 | ENABLE_SVE_FOR_NS ?= 2 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 198 | # SVE is only supported on AArch64 so disable it on AArch32. |
| 199 | else ifeq (${ARCH},aarch32) |
Govindraj Raja | 399541a | 2023-10-17 08:13:03 -0500 | [diff] [blame] | 200 | ifneq ($(or $(ENABLE_SVE_FOR_NS),0),0) |
Govindraj Raja | 28b525c | 2023-09-20 15:31:45 -0500 | [diff] [blame] | 201 | $(error ENABLE_SVE_FOR_NS is not supported for AArch32) |
| 202 | else |
| 203 | ENABLE_SVE_FOR_NS := 0 |
| 204 | endif |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 205 | endif |
| 206 | |
| 207 | #---- |
| 208 | # 8.4 |
| 209 | #---- |
| 210 | |
| 211 | # Feature flags for supporting Activity monitor extensions. |
| 212 | ENABLE_FEAT_AMU ?= 0 |
| 213 | ENABLE_AMU_AUXILIARY_COUNTERS ?= 0 |
| 214 | ENABLE_AMU_FCONF ?= 0 |
| 215 | AMU_RESTRICT_COUNTERS ?= 0 |
| 216 | |
| 217 | # Build option to enable MPAM for lower ELs. |
Arvind Ram Prakash | ab28d4b | 2023-10-11 12:10:56 -0500 | [diff] [blame] | 218 | # Enabling it by default |
| 219 | ifeq (${ARCH},aarch64) |
Harrison Mutai | bb75e4f | 2023-10-31 10:15:41 +0000 | [diff] [blame] | 220 | ENABLE_FEAT_MPAM ?= 2 |
Arvind Ram Prakash | ab28d4b | 2023-10-11 12:10:56 -0500 | [diff] [blame] | 221 | else ifeq (${ARCH},aarch32) |
Harrison Mutai | bb75e4f | 2023-10-31 10:15:41 +0000 | [diff] [blame] | 222 | ifneq ($(or $(ENABLE_FEAT_MPAM),0),0) |
| 223 | $(error ENABLE_FEAT_MPAM is not supported for AArch32) |
| 224 | else |
| 225 | ENABLE_FEAT_MPAM := 0 |
| 226 | endif |
Arvind Ram Prakash | ab28d4b | 2023-10-11 12:10:56 -0500 | [diff] [blame] | 227 | endif |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 228 | |
Govindraj Raja | 3748d90 | 2023-09-19 08:43:16 -0500 | [diff] [blame] | 229 | # Include nested virtualization control (Armv8.4-NV) registers in cpu context. |
| 230 | # This must be set to 1 if architecture implements Nested Virtualization |
| 231 | # Extension and platform wants to use this feature in the Secure world. |
| 232 | CTX_INCLUDE_NEVE_REGS ?= 0 |
| 233 | |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 234 | #---- |
| 235 | # 8.5 |
| 236 | #---- |
| 237 | |
| 238 | # Flag to enable support for EL3 trapping of reads of the RNDR and RNDRRS |
| 239 | # registers, by setting SCR_EL3.TRNDR. |
| 240 | ENABLE_FEAT_RNG_TRAP ?= 0 |
| 241 | |
Govindraj Raja | 24d3a4e | 2023-12-21 13:57:49 -0600 | [diff] [blame] | 242 | # Enable Memory Tagging Extension. This must be set to 1 if the platform wants |
| 243 | # to use this feature in the Secure world and MTE is enabled at ELX. |
| 244 | ifeq ($(CTX_INCLUDE_MTE_REGS),1) |
| 245 | $(warning CTX_INCLUDE_MTE_REGS option is deprecated use ENABLE_FEAT_MTE, Enabling ENABLE_FEAT_MTE) |
| 246 | ENABLE_FEAT_MTE ?= 1 |
| 247 | endif |
| 248 | ifeq (${ARCH},aarch32) |
| 249 | ifneq ($(or $(ENABLE_FEAT_MTE),0),0) |
| 250 | $(error ENABLE_FEAT_MTE is not supported for AArch32) |
| 251 | endif |
| 252 | endif |
| 253 | ENABLE_FEAT_MTE ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 254 | |
| 255 | #---- |
| 256 | # 8.6 |
| 257 | #---- |
| 258 | |
| 259 | # Flag to enable AMUv1p1 extension. |
| 260 | ENABLE_FEAT_AMUv1p1 ?= 0 |
| 261 | |
| 262 | # Flag to enable delayed trapping of WFE instruction (FEAT_TWED). |
| 263 | ENABLE_FEAT_TWED ?= 0 |
| 264 | |
| 265 | # In v8.6+ platforms with delayed trapping of WFE being supported |
| 266 | # via FEAT_TWED, this flag takes the delay value to be set in the |
| 267 | # SCR_EL3.TWEDEL(4bit) field, when FEAT_TWED is implemented. |
| 268 | # By default it takes 0, and need to be updated by the platforms. |
| 269 | TWED_DELAY ?= 0 |
| 270 | |
| 271 | # Disable MTPMU if FEAT_MTPMU is supported. |
| 272 | DISABLE_MTPMU ?= 0 |
| 273 | |
| 274 | #---- |
| 275 | # 8.9 |
| 276 | #---- |
| 277 | |
| 278 | # Flag to enable NoTagAccess memory region attribute for stage 2 of translation. |
| 279 | ENABLE_FEAT_MTE_PERM ?= 0 |
| 280 | |
| 281 | # Flag to enable access to Stage 2 Permission Indirection (FEAT_S2PIE). |
| 282 | ENABLE_FEAT_S2PIE ?= 0 |
| 283 | |
| 284 | # Flag to enable access to Stage 1 Permission Indirection (FEAT_S1PIE). |
| 285 | ENABLE_FEAT_S1PIE ?= 0 |
| 286 | |
| 287 | # Flag to enable access to Stage 2 Permission Overlay (FEAT_S2POE). |
| 288 | ENABLE_FEAT_S2POE ?= 0 |
| 289 | |
| 290 | # Flag to enable access to Stage 1 Permission Overlay (FEAT_S1POE). |
| 291 | ENABLE_FEAT_S1POE ?= 0 |
| 292 | |
| 293 | #---- |
| 294 | # 9.0 |
| 295 | #---- |
| 296 | |
| 297 | # Flag to enable Realm Management Extension (FEAT_RME). |
| 298 | ENABLE_RME ?= 0 |
| 299 | |
| 300 | # Scalable Matrix Extension for non-secure world. |
| 301 | ENABLE_SME_FOR_NS ?= 0 |
| 302 | |
| 303 | # Scalable Vector Extension for secure world. |
| 304 | ENABLE_SVE_FOR_SWD ?= 0 |
| 305 | |
| 306 | # By default, disable access of trace buffer control registers from NS |
| 307 | # lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused |
| 308 | # if FEAT_TRBE is implemented. |
| 309 | # Note FEAT_TRBE is only supported on AArch64 - therefore do not enable in |
| 310 | # AArch32. |
| 311 | ifeq (${ARCH},aarch64) |
Govindraj Raja | 28b525c | 2023-09-20 15:31:45 -0500 | [diff] [blame] | 312 | ENABLE_TRBE_FOR_NS ?= 0 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 313 | else ifeq (${ARCH},aarch32) |
Govindraj Raja | 399541a | 2023-10-17 08:13:03 -0500 | [diff] [blame] | 314 | ifneq ($(or $(ENABLE_TRBE_FOR_NS),0),0) |
| 315 | $(error ENABLE_TRBE_FOR_NS is not supported for AArch32) |
Govindraj Raja | 28b525c | 2023-09-20 15:31:45 -0500 | [diff] [blame] | 316 | else |
Govindraj Raja | 399541a | 2023-10-17 08:13:03 -0500 | [diff] [blame] | 317 | ENABLE_TRBE_FOR_NS := 0 |
Govindraj Raja | 28b525c | 2023-09-20 15:31:45 -0500 | [diff] [blame] | 318 | endif |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 319 | endif |
| 320 | |
| 321 | #---- |
| 322 | # 9.2 |
| 323 | #---- |
| 324 | |
| 325 | # Scalable Matrix Extension version 2 for non-secure world. |
| 326 | ENABLE_SME2_FOR_NS ?= 0 |
| 327 | |
| 328 | # Scalable Matrix Extension for secure world. |
| 329 | ENABLE_SME_FOR_SWD ?= 0 |
| 330 | |
| 331 | # By default, disable access to branch record buffer control registers from NS |
| 332 | # lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused |
| 333 | # if FEAT_BRBE is implemented. |
| 334 | ENABLE_BRBE_FOR_NS ?= 0 |
| 335 | |
| 336 | #---- |
| 337 | #9.4 |
| 338 | #---- |
| 339 | |
| 340 | # Flag to enable access to Guarded Control Stack (FEAT_GCS). |
| 341 | ENABLE_FEAT_GCS ?= 0 |