arch_features.mk 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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-7-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
  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. #
  174. ################################################################################
  175. # Optional Features defaulted to 0 or 2, if they are not enabled from
  176. # build option. Can also be disabled or enabled by platform if needed.
  177. ################################################################################
  178. #
  179. #----
  180. # 8.0
  181. #----
  182. # Flag to enable CSV2_2 extension.
  183. ENABLE_FEAT_CSV2_2 ?= 0
  184. # Flag to enable CSV2_3 extension. FEAT_CSV2_3 enables access to the
  185. # SCXTNUM_ELx register.
  186. ENABLE_FEAT_CSV2_3 ?= 0
  187. # By default, disable access of trace system registers from NS lower
  188. # ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused if
  189. # system register trace is implemented. This feature is available if
  190. # trace unit such as ETMv4.x, This feature is OPTIONAL and is only
  191. # permitted in Armv8 implementations.
  192. ENABLE_SYS_REG_TRACE_FOR_NS ?= 0
  193. #----
  194. # 8.2
  195. #----
  196. # Build option to enable/disable the Statistical Profiling Extension,
  197. # keep it enabled by default for AArch64.
  198. ifeq (${ARCH},aarch64)
  199. ENABLE_SPE_FOR_NS ?= 2
  200. else ifeq (${ARCH},aarch32)
  201. ifneq ($(or $(ENABLE_SPE_FOR_NS),0),0)
  202. $(error ENABLE_SPE_FOR_NS is not supported for AArch32)
  203. else
  204. ENABLE_SPE_FOR_NS := 0
  205. endif
  206. endif
  207. # Enable SVE for non-secure world by default.
  208. ifeq (${ARCH},aarch64)
  209. ENABLE_SVE_FOR_NS ?= 2
  210. # SVE is only supported on AArch64 so disable it on AArch32.
  211. else ifeq (${ARCH},aarch32)
  212. ifneq ($(or $(ENABLE_SVE_FOR_NS),0),0)
  213. $(error ENABLE_SVE_FOR_NS is not supported for AArch32)
  214. else
  215. ENABLE_SVE_FOR_NS := 0
  216. endif
  217. endif
  218. #----
  219. # 8.4
  220. #----
  221. # Feature flags for supporting Activity monitor extensions.
  222. ENABLE_FEAT_AMU ?= 0
  223. ENABLE_AMU_AUXILIARY_COUNTERS ?= 0
  224. ENABLE_AMU_FCONF ?= 0
  225. AMU_RESTRICT_COUNTERS ?= 1
  226. # Build option to enable MPAM for lower ELs.
  227. # Enabling it by default
  228. ifeq (${ARCH},aarch64)
  229. ENABLE_FEAT_MPAM ?= 2
  230. else ifeq (${ARCH},aarch32)
  231. ifneq ($(or $(ENABLE_FEAT_MPAM),0),0)
  232. $(error ENABLE_FEAT_MPAM is not supported for AArch32)
  233. else
  234. ENABLE_FEAT_MPAM := 0
  235. endif
  236. endif
  237. # Include nested virtualization control (Armv8.4-NV) registers in cpu context.
  238. # This must be set to 1 if architecture implements Nested Virtualization
  239. # Extension and platform wants to use this feature in the Secure world.
  240. CTX_INCLUDE_NEVE_REGS ?= 0
  241. #----
  242. # 8.5
  243. #----
  244. # Flag to enable support for EL3 trapping of reads of the RNDR and RNDRRS
  245. # registers, by setting SCR_EL3.TRNDR.
  246. ENABLE_FEAT_RNG_TRAP ?= 0
  247. ifeq ($(CTX_INCLUDE_MTE_REGS),1)
  248. $(warning CTX_INCLUDE_MTE_REGS option is deprecated, Check ENABLE_FEAT_MTE2 usage)
  249. endif
  250. ifneq ($(ENABLE_FEAT_MTE),)
  251. $(warning ENABLE_FEAT_MTE option is deprecated, Check ENABLE_FEAT_MTE2 usage)
  252. endif
  253. # Enable FEAT_MTE2. This must be set to 1 if the platform wants
  254. # to use this feature and is enabled at ELX.
  255. ENABLE_FEAT_MTE2 ?= 0
  256. #----
  257. # 8.6
  258. #----
  259. # Flag to enable AMUv1p1 extension.
  260. ENABLE_FEAT_AMUv1p1 ?= 0
  261. # Flag to enable delayed trapping of WFE instruction (FEAT_TWED).
  262. ENABLE_FEAT_TWED ?= 0
  263. # In v8.6+ platforms with delayed trapping of WFE being supported
  264. # via FEAT_TWED, this flag takes the delay value to be set in the
  265. # SCR_EL3.TWEDEL(4bit) field, when FEAT_TWED is implemented.
  266. # By default it takes 0, and need to be updated by the platforms.
  267. TWED_DELAY ?= 0
  268. # Disable MTPMU if FEAT_MTPMU is supported.
  269. DISABLE_MTPMU ?= 0
  270. # Flag to enable FEAT_FGT2 (Fine Granular Traps 2)
  271. ENABLE_FEAT_FGT2 ?= 0
  272. #----
  273. # 8.9
  274. #----
  275. # Flag to enable access to Stage 2 Permission Indirection (FEAT_S2PIE).
  276. ENABLE_FEAT_S2PIE ?= 0
  277. # Flag to enable access to Stage 1 Permission Indirection (FEAT_S1PIE).
  278. ENABLE_FEAT_S1PIE ?= 0
  279. # Flag to enable access to Stage 2 Permission Overlay (FEAT_S2POE).
  280. ENABLE_FEAT_S2POE ?= 0
  281. # Flag to enable access to Stage 1 Permission Overlay (FEAT_S1POE).
  282. ENABLE_FEAT_S1POE ?= 0
  283. # Flag to enable access to Arm v8.9 Debug extension
  284. ENABLE_FEAT_DEBUGV8P9 ?= 0
  285. #----
  286. # 9.0
  287. #----
  288. # Scalable Matrix Extension for non-secure world.
  289. ENABLE_SME_FOR_NS ?= 0
  290. # Scalable Vector Extension for secure world.
  291. ENABLE_SVE_FOR_SWD ?= 0
  292. # By default, disable access of trace buffer control registers from NS
  293. # lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
  294. # if FEAT_TRBE is implemented.
  295. # Note FEAT_TRBE is only supported on AArch64 - therefore do not enable in
  296. # AArch32.
  297. ifeq (${ARCH},aarch64)
  298. ENABLE_TRBE_FOR_NS ?= 0
  299. else ifeq (${ARCH},aarch32)
  300. ifneq ($(or $(ENABLE_TRBE_FOR_NS),0),0)
  301. $(error ENABLE_TRBE_FOR_NS is not supported for AArch32)
  302. else
  303. ENABLE_TRBE_FOR_NS := 0
  304. endif
  305. endif
  306. #----
  307. # 9.2
  308. #----
  309. # Flag to enable Realm Management Extension (FEAT_RME).
  310. ENABLE_RME ?= 0
  311. # Scalable Matrix Extension version 2 for non-secure world.
  312. ENABLE_SME2_FOR_NS ?= 0
  313. # Scalable Matrix Extension for secure world.
  314. ENABLE_SME_FOR_SWD ?= 0
  315. # By default, disable access to branch record buffer control registers from NS
  316. # lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
  317. # if FEAT_BRBE is implemented.
  318. ENABLE_BRBE_FOR_NS ?= 0
  319. #----
  320. #9.4
  321. #----
  322. # Flag to enable access to Guarded Control Stack (FEAT_GCS).
  323. ENABLE_FEAT_GCS ?= 0