arch_features.mk 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. #
  2. # Copyright (c) 2022-2023, 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 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 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. ENABLE_FEAT_PAN := 1
  20. ENABLE_FEAT_VHE := 1
  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. ENABLE_FEAT_RAS := 1
  25. endif
  26. # Enable the features which are mandatory from ARCH version 8.4 and upwards.
  27. ifeq "8.4" "$(word 1, $(sort 8.4 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
  28. ENABLE_FEAT_SEL2 := 1
  29. ENABLE_TRF_FOR_NS := 1
  30. ENABLE_FEAT_DIT := 1
  31. endif
  32. # Enable the features which are mandatory from ARCH version 8.5 and upwards.
  33. ifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
  34. ENABLE_FEAT_RNG := 1
  35. ENABLE_FEAT_SB := 1
  36. # Enable Memory tagging, Branch Target Identification for aarch64 only.
  37. ifeq ($(ARCH), aarch64)
  38. mem_tag_arch_support := yes
  39. endif #(ARCH=aarch64)
  40. endif
  41. # Enable the features which are mandatory from ARCH version 8.6 and upwards.
  42. ifeq "8.6" "$(word 1, $(sort 8.6 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
  43. ENABLE_FEAT_ECV := 1
  44. ENABLE_FEAT_FGT := 1
  45. endif
  46. # Enable the features which are mandatory from ARCH version 8.7 and upwards.
  47. ifeq "8.7" "$(word 1, $(sort 8.7 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
  48. ENABLE_FEAT_HCX := 1
  49. endif
  50. # Enable the features which are mandatory from ARCH version 8.9 and upwards.
  51. ifeq "8.9" "$(word 1, $(sort 8.9 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
  52. ENABLE_FEAT_TCR2 := 1
  53. endif
  54. #
  55. ################################################################################
  56. # Set mandatory features by default to zero.
  57. ################################################################################
  58. #
  59. #----
  60. # 8.1
  61. #----
  62. # Flag to enable access to Privileged Access Never bit of PSTATE.
  63. ENABLE_FEAT_PAN ?= 0
  64. # Flag to enable Virtualization Host Extensions.
  65. ENABLE_FEAT_VHE ?= 0
  66. #----
  67. # 8.2
  68. #----
  69. # Enable RAS Support.
  70. ENABLE_FEAT_RAS ?= 0
  71. #----
  72. # 8.3
  73. #----
  74. # Flag to enable Pointer Authentication. Internal flag not meant for
  75. # direct setting. Use BRANCH_PROTECTION to enable PAUTH.
  76. ENABLE_PAUTH ?= 0
  77. # Include pointer authentication (ARMv8.3-PAuth) registers in cpu context. This
  78. # must be set to 1 if the platform wants to use this feature in the Secure
  79. # world. It is not necessary for use in the Non-secure world.
  80. CTX_INCLUDE_PAUTH_REGS ?= 0
  81. #----
  82. # 8.4
  83. #----
  84. # Flag to enable Secure EL-2 feature.
  85. ENABLE_FEAT_SEL2 ?= 0
  86. # By default, disable trace filter control register access to lower non-secure
  87. # exception levels, i.e. NS-EL2, or NS-EL1 if NS-EL2 is implemented, but
  88. # trace filter control register access is unused if FEAT_TRF is implemented.
  89. ENABLE_TRF_FOR_NS ?= 0
  90. # Flag to enable Data Independent Timing instructions.
  91. ENABLE_FEAT_DIT ?= 0
  92. #----
  93. # 8.5
  94. #----
  95. # Flag to enable Branch Target Identification.
  96. # Internal flag not meant for direct setting.
  97. # Use BRANCH_PROTECTION to enable BTI.
  98. ENABLE_BTI ?= 0
  99. # Flag to enable access to the Random Number Generator registers.
  100. ENABLE_FEAT_RNG ?= 0
  101. # Flag to enable Speculation Barrier Instruction.
  102. ENABLE_FEAT_SB ?= 0
  103. #----
  104. # 8.6
  105. #----
  106. # Flag to enable access to the CNTPOFF_EL2 register.
  107. ENABLE_FEAT_ECV ?= 0
  108. # Flag to enable access to the HDFGRTR_EL2 register.
  109. ENABLE_FEAT_FGT ?= 0
  110. #----
  111. # 8.7
  112. #----
  113. # Flag to enable access to the HCRX_EL2 register by setting SCR_EL3.HXEn.
  114. ENABLE_FEAT_HCX ?= 0
  115. #----
  116. # 8.9
  117. #----
  118. # Flag to enable access to TCR2 (FEAT_TCR2).
  119. ENABLE_FEAT_TCR2 ?= 0
  120. #
  121. ################################################################################
  122. # Optional Features defaulted to 0 or 2, if they are not enabled from
  123. # build option. Can also be disabled or enabled by platform if needed.
  124. ################################################################################
  125. #
  126. #----
  127. # 8.0
  128. #----
  129. # Flag to enable CSV2_2 extension.
  130. ENABLE_FEAT_CSV2_2 ?= 0
  131. # By default, disable access of trace system registers from NS lower
  132. # ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused if
  133. # system register trace is implemented. This feature is available if
  134. # trace unit such as ETMv4.x, This feature is OPTIONAL and is only
  135. # permitted in Armv8 implementations.
  136. ENABLE_SYS_REG_TRACE_FOR_NS ?= 0
  137. #----
  138. # 8.2
  139. #----
  140. # Build option to enable/disable the Statistical Profiling Extension,
  141. # keep it enabled by default for AArch64.
  142. ifeq (${ARCH},aarch64)
  143. ENABLE_SPE_FOR_NS ?= 2
  144. else ifeq (${ARCH},aarch32)
  145. ifneq ($(or $(ENABLE_SPE_FOR_NS),0),0)
  146. $(error ENABLE_SPE_FOR_NS is not supported for AArch32)
  147. else
  148. ENABLE_SPE_FOR_NS := 0
  149. endif
  150. endif
  151. # Enable SVE for non-secure world by default.
  152. ifeq (${ARCH},aarch64)
  153. ENABLE_SVE_FOR_NS ?= 2
  154. # SVE is only supported on AArch64 so disable it on AArch32.
  155. else ifeq (${ARCH},aarch32)
  156. ifneq ($(or $(ENABLE_SVE_FOR_NS),0),0)
  157. $(error ENABLE_SVE_FOR_NS is not supported for AArch32)
  158. else
  159. ENABLE_SVE_FOR_NS := 0
  160. endif
  161. endif
  162. #----
  163. # 8.4
  164. #----
  165. # Feature flags for supporting Activity monitor extensions.
  166. ENABLE_FEAT_AMU ?= 0
  167. ENABLE_AMU_AUXILIARY_COUNTERS ?= 0
  168. ENABLE_AMU_FCONF ?= 0
  169. AMU_RESTRICT_COUNTERS ?= 0
  170. # Build option to enable MPAM for lower ELs.
  171. # Enabling it by default
  172. ifeq (${ARCH},aarch64)
  173. ENABLE_FEAT_MPAM ?= 2
  174. else ifeq (${ARCH},aarch32)
  175. ifneq ($(or $(ENABLE_FEAT_MPAM),0),0)
  176. $(error ENABLE_FEAT_MPAM is not supported for AArch32)
  177. else
  178. ENABLE_FEAT_MPAM := 0
  179. endif
  180. endif
  181. # Include nested virtualization control (Armv8.4-NV) registers in cpu context.
  182. # This must be set to 1 if architecture implements Nested Virtualization
  183. # Extension and platform wants to use this feature in the Secure world.
  184. CTX_INCLUDE_NEVE_REGS ?= 0
  185. #----
  186. # 8.5
  187. #----
  188. # Flag to enable support for EL3 trapping of reads of the RNDR and RNDRRS
  189. # registers, by setting SCR_EL3.TRNDR.
  190. ENABLE_FEAT_RNG_TRAP ?= 0
  191. # Include Memory Tagging Extension registers in cpu context. This must be set
  192. # to 1 if the platform wants to use this feature in the Secure world and MTE is
  193. # enabled at ELX.
  194. CTX_INCLUDE_MTE_REGS ?= 0
  195. #----
  196. # 8.6
  197. #----
  198. # Flag to enable AMUv1p1 extension.
  199. ENABLE_FEAT_AMUv1p1 ?= 0
  200. # Flag to enable delayed trapping of WFE instruction (FEAT_TWED).
  201. ENABLE_FEAT_TWED ?= 0
  202. # In v8.6+ platforms with delayed trapping of WFE being supported
  203. # via FEAT_TWED, this flag takes the delay value to be set in the
  204. # SCR_EL3.TWEDEL(4bit) field, when FEAT_TWED is implemented.
  205. # By default it takes 0, and need to be updated by the platforms.
  206. TWED_DELAY ?= 0
  207. # Disable MTPMU if FEAT_MTPMU is supported.
  208. DISABLE_MTPMU ?= 0
  209. #----
  210. # 8.9
  211. #----
  212. # Flag to enable NoTagAccess memory region attribute for stage 2 of translation.
  213. ENABLE_FEAT_MTE_PERM ?= 0
  214. # Flag to enable access to Stage 2 Permission Indirection (FEAT_S2PIE).
  215. ENABLE_FEAT_S2PIE ?= 0
  216. # Flag to enable access to Stage 1 Permission Indirection (FEAT_S1PIE).
  217. ENABLE_FEAT_S1PIE ?= 0
  218. # Flag to enable access to Stage 2 Permission Overlay (FEAT_S2POE).
  219. ENABLE_FEAT_S2POE ?= 0
  220. # Flag to enable access to Stage 1 Permission Overlay (FEAT_S1POE).
  221. ENABLE_FEAT_S1POE ?= 0
  222. #----
  223. # 9.0
  224. #----
  225. # Flag to enable Realm Management Extension (FEAT_RME).
  226. ENABLE_RME ?= 0
  227. # Scalable Matrix Extension for non-secure world.
  228. ENABLE_SME_FOR_NS ?= 0
  229. # Scalable Vector Extension for secure world.
  230. ENABLE_SVE_FOR_SWD ?= 0
  231. # By default, disable access of trace buffer control registers from NS
  232. # lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
  233. # if FEAT_TRBE is implemented.
  234. # Note FEAT_TRBE is only supported on AArch64 - therefore do not enable in
  235. # AArch32.
  236. ifeq (${ARCH},aarch64)
  237. ENABLE_TRBE_FOR_NS ?= 0
  238. else ifeq (${ARCH},aarch32)
  239. ifneq ($(or $(ENABLE_TRBE_FOR_NS),0),0)
  240. $(error ENABLE_TRBE_FOR_NS is not supported for AArch32)
  241. else
  242. ENABLE_TRBE_FOR_NS := 0
  243. endif
  244. endif
  245. #----
  246. # 9.2
  247. #----
  248. # Scalable Matrix Extension version 2 for non-secure world.
  249. ENABLE_SME2_FOR_NS ?= 0
  250. # Scalable Matrix Extension for secure world.
  251. ENABLE_SME_FOR_SWD ?= 0
  252. # By default, disable access to branch record buffer control registers from NS
  253. # lower ELs i.e. NS-EL2, or NS-EL1 if NS-EL2 implemented but unused
  254. # if FEAT_BRBE is implemented.
  255. ENABLE_BRBE_FOR_NS ?= 0
  256. #----
  257. #9.4
  258. #----
  259. # Flag to enable access to Guarded Control Stack (FEAT_GCS).
  260. ENABLE_FEAT_GCS ?= 0