arch_features.mk 12 KB

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