booting.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. =====================
  2. Booting AArch64 Linux
  3. =====================
  4. Author: Will Deacon <will.deacon@arm.com>
  5. Date : 07 September 2012
  6. This document is based on the ARM booting document by Russell King and
  7. is relevant to all public releases of the AArch64 Linux kernel.
  8. The AArch64 exception model is made up of a number of exception levels
  9. (EL0 - EL3), with EL0, EL1 and EL2 having a secure and a non-secure
  10. counterpart. EL2 is the hypervisor level, EL3 is the highest priority
  11. level and exists only in secure mode. Both are architecturally optional.
  12. For the purposes of this document, we will use the term `boot loader`
  13. simply to define all software that executes on the CPU(s) before control
  14. is passed to the Linux kernel. This may include secure monitor and
  15. hypervisor code, or it may just be a handful of instructions for
  16. preparing a minimal boot environment.
  17. Essentially, the boot loader should provide (as a minimum) the
  18. following:
  19. 1. Setup and initialise the RAM
  20. 2. Setup the device tree
  21. 3. Decompress the kernel image
  22. 4. Call the kernel image
  23. 1. Setup and initialise RAM
  24. ---------------------------
  25. Requirement: MANDATORY
  26. The boot loader is expected to find and initialise all RAM that the
  27. kernel will use for volatile data storage in the system. It performs
  28. this in a machine dependent manner. (It may use internal algorithms
  29. to automatically locate and size all RAM, or it may use knowledge of
  30. the RAM in the machine, or any other method the boot loader designer
  31. sees fit.)
  32. For Arm Confidential Compute Realms this includes ensuring that all
  33. protected RAM has a Realm IPA state (RIPAS) of "RAM".
  34. 2. Setup the device tree
  35. -------------------------
  36. Requirement: MANDATORY
  37. The device tree blob (dtb) must be placed on an 8-byte boundary and must
  38. not exceed 2 megabytes in size. Since the dtb will be mapped cacheable
  39. using blocks of up to 2 megabytes in size, it must not be placed within
  40. any 2M region which must be mapped with any specific attributes.
  41. NOTE: versions prior to v4.2 also require that the DTB be placed within
  42. the 512 MB region starting at text_offset bytes below the kernel Image.
  43. 3. Decompress the kernel image
  44. ------------------------------
  45. Requirement: OPTIONAL
  46. The AArch64 kernel does not currently provide a decompressor and
  47. therefore requires decompression (gzip etc.) to be performed by the boot
  48. loader if a compressed Image target (e.g. Image.gz) is used. For
  49. bootloaders that do not implement this requirement, the uncompressed
  50. Image target is available instead.
  51. 4. Call the kernel image
  52. ------------------------
  53. Requirement: MANDATORY
  54. The decompressed kernel image contains a 64-byte header as follows::
  55. u32 code0; /* Executable code */
  56. u32 code1; /* Executable code */
  57. u64 text_offset; /* Image load offset, little endian */
  58. u64 image_size; /* Effective Image size, little endian */
  59. u64 flags; /* kernel flags, little endian */
  60. u64 res2 = 0; /* reserved */
  61. u64 res3 = 0; /* reserved */
  62. u64 res4 = 0; /* reserved */
  63. u32 magic = 0x644d5241; /* Magic number, little endian, "ARM\x64" */
  64. u32 res5; /* reserved (used for PE COFF offset) */
  65. Header notes:
  66. - As of v3.17, all fields are little endian unless stated otherwise.
  67. - code0/code1 are responsible for branching to stext.
  68. - when booting through EFI, code0/code1 are initially skipped.
  69. res5 is an offset to the PE header and the PE header has the EFI
  70. entry point (efi_stub_entry). When the stub has done its work, it
  71. jumps to code0 to resume the normal boot process.
  72. - Prior to v3.17, the endianness of text_offset was not specified. In
  73. these cases image_size is zero and text_offset is 0x80000 in the
  74. endianness of the kernel. Where image_size is non-zero image_size is
  75. little-endian and must be respected. Where image_size is zero,
  76. text_offset can be assumed to be 0x80000.
  77. - The flags field (introduced in v3.17) is a little-endian 64-bit field
  78. composed as follows:
  79. ============= ===============================================================
  80. Bit 0 Kernel endianness. 1 if BE, 0 if LE.
  81. Bit 1-2 Kernel Page size.
  82. * 0 - Unspecified.
  83. * 1 - 4K
  84. * 2 - 16K
  85. * 3 - 64K
  86. Bit 3 Kernel physical placement
  87. 0
  88. 2MB aligned base should be as close as possible
  89. to the base of DRAM, since memory below it is not
  90. accessible via the linear mapping
  91. 1
  92. 2MB aligned base such that all image_size bytes
  93. counted from the start of the image are within
  94. the 48-bit addressable range of physical memory
  95. Bits 4-63 Reserved.
  96. ============= ===============================================================
  97. - When image_size is zero, a bootloader should attempt to keep as much
  98. memory as possible free for use by the kernel immediately after the
  99. end of the kernel image. The amount of space required will vary
  100. depending on selected features, and is effectively unbound.
  101. The Image must be placed text_offset bytes from a 2MB aligned base
  102. address anywhere in usable system RAM and called there. The region
  103. between the 2 MB aligned base address and the start of the image has no
  104. special significance to the kernel, and may be used for other purposes.
  105. At least image_size bytes from the start of the image must be free for
  106. use by the kernel.
  107. NOTE: versions prior to v4.6 cannot make use of memory below the
  108. physical offset of the Image so it is recommended that the Image be
  109. placed as close as possible to the start of system RAM.
  110. If an initrd/initramfs is passed to the kernel at boot, it must reside
  111. entirely within a 1 GB aligned physical memory window of up to 32 GB in
  112. size that fully covers the kernel Image as well.
  113. Any memory described to the kernel (even that below the start of the
  114. image) which is not marked as reserved from the kernel (e.g., with a
  115. memreserve region in the device tree) will be considered as available to
  116. the kernel.
  117. Before jumping into the kernel, the following conditions must be met:
  118. - Quiesce all DMA capable devices so that memory does not get
  119. corrupted by bogus network packets or disk data. This will save
  120. you many hours of debug.
  121. - Primary CPU general-purpose register settings:
  122. - x0 = physical address of device tree blob (dtb) in system RAM.
  123. - x1 = 0 (reserved for future use)
  124. - x2 = 0 (reserved for future use)
  125. - x3 = 0 (reserved for future use)
  126. - CPU mode
  127. All forms of interrupts must be masked in PSTATE.DAIF (Debug, SError,
  128. IRQ and FIQ).
  129. The CPU must be in non-secure state, either in EL2 (RECOMMENDED in order
  130. to have access to the virtualisation extensions), or in EL1.
  131. - Caches, MMUs
  132. The MMU must be off.
  133. The instruction cache may be on or off, and must not hold any stale
  134. entries corresponding to the loaded kernel image.
  135. The address range corresponding to the loaded kernel image must be
  136. cleaned to the PoC. In the presence of a system cache or other
  137. coherent masters with caches enabled, this will typically require
  138. cache maintenance by VA rather than set/way operations.
  139. System caches which respect the architected cache maintenance by VA
  140. operations must be configured and may be enabled.
  141. System caches which do not respect architected cache maintenance by VA
  142. operations (not recommended) must be configured and disabled.
  143. - Architected timers
  144. CNTFRQ must be programmed with the timer frequency and CNTVOFF must
  145. be programmed with a consistent value on all CPUs. If entering the
  146. kernel at EL1, CNTHCTL_EL2 must have EL1PCTEN (bit 0) set where
  147. available.
  148. - Coherency
  149. All CPUs to be booted by the kernel must be part of the same coherency
  150. domain on entry to the kernel. This may require IMPLEMENTATION DEFINED
  151. initialisation to enable the receiving of maintenance operations on
  152. each CPU.
  153. - System registers
  154. All writable architected system registers at or below the exception
  155. level where the kernel image will be entered must be initialised by
  156. software at a higher exception level to prevent execution in an UNKNOWN
  157. state.
  158. For all systems:
  159. - If EL3 is present:
  160. - SCR_EL3.FIQ must have the same value across all CPUs the kernel is
  161. executing on.
  162. - The value of SCR_EL3.FIQ must be the same as the one present at boot
  163. time whenever the kernel is executing.
  164. - If EL3 is present and the kernel is entered at EL2:
  165. - SCR_EL3.HCE (bit 8) must be initialised to 0b1.
  166. For systems with a GICv5 interrupt controller to be used in v5 mode:
  167. - If the kernel is entered at EL1 and EL2 is present:
  168. - ICH_HFGRTR_EL2.ICC_PPI_ACTIVERn_EL1 (bit 20) must be initialised to 0b1.
  169. - ICH_HFGRTR_EL2.ICC_PPI_PRIORITYRn_EL1 (bit 19) must be initialised to 0b1.
  170. - ICH_HFGRTR_EL2.ICC_PPI_PENDRn_EL1 (bit 18) must be initialised to 0b1.
  171. - ICH_HFGRTR_EL2.ICC_PPI_ENABLERn_EL1 (bit 17) must be initialised to 0b1.
  172. - ICH_HFGRTR_EL2.ICC_PPI_HMRn_EL1 (bit 16) must be initialised to 0b1.
  173. - ICH_HFGRTR_EL2.ICC_IAFFIDR_EL1 (bit 7) must be initialised to 0b1.
  174. - ICH_HFGRTR_EL2.ICC_ICSR_EL1 (bit 6) must be initialised to 0b1.
  175. - ICH_HFGRTR_EL2.ICC_PCR_EL1 (bit 5) must be initialised to 0b1.
  176. - ICH_HFGRTR_EL2.ICC_HPPIR_EL1 (bit 4) must be initialised to 0b1.
  177. - ICH_HFGRTR_EL2.ICC_HAPR_EL1 (bit 3) must be initialised to 0b1.
  178. - ICH_HFGRTR_EL2.ICC_CR0_EL1 (bit 2) must be initialised to 0b1.
  179. - ICH_HFGRTR_EL2.ICC_IDRn_EL1 (bit 1) must be initialised to 0b1.
  180. - ICH_HFGRTR_EL2.ICC_APR_EL1 (bit 0) must be initialised to 0b1.
  181. - ICH_HFGWTR_EL2.ICC_PPI_ACTIVERn_EL1 (bit 20) must be initialised to 0b1.
  182. - ICH_HFGWTR_EL2.ICC_PPI_PRIORITYRn_EL1 (bit 19) must be initialised to 0b1.
  183. - ICH_HFGWTR_EL2.ICC_PPI_PENDRn_EL1 (bit 18) must be initialised to 0b1.
  184. - ICH_HFGWTR_EL2.ICC_PPI_ENABLERn_EL1 (bit 17) must be initialised to 0b1.
  185. - ICH_HFGWTR_EL2.ICC_ICSR_EL1 (bit 6) must be initialised to 0b1.
  186. - ICH_HFGWTR_EL2.ICC_PCR_EL1 (bit 5) must be initialised to 0b1.
  187. - ICH_HFGWTR_EL2.ICC_CR0_EL1 (bit 2) must be initialised to 0b1.
  188. - ICH_HFGWTR_EL2.ICC_APR_EL1 (bit 0) must be initialised to 0b1.
  189. - ICH_HFGITR_EL2.GICRCDNMIA (bit 10) must be initialised to 0b1.
  190. - ICH_HFGITR_EL2.GICRCDIA (bit 9) must be initialised to 0b1.
  191. - ICH_HFGITR_EL2.GICCDDI (bit 8) must be initialised to 0b1.
  192. - ICH_HFGITR_EL2.GICCDEOI (bit 7) must be initialised to 0b1.
  193. - ICH_HFGITR_EL2.GICCDHM (bit 6) must be initialised to 0b1.
  194. - ICH_HFGITR_EL2.GICCDRCFG (bit 5) must be initialised to 0b1.
  195. - ICH_HFGITR_EL2.GICCDPEND (bit 4) must be initialised to 0b1.
  196. - ICH_HFGITR_EL2.GICCDAFF (bit 3) must be initialised to 0b1.
  197. - ICH_HFGITR_EL2.GICCDPRI (bit 2) must be initialised to 0b1.
  198. - ICH_HFGITR_EL2.GICCDDIS (bit 1) must be initialised to 0b1.
  199. - ICH_HFGITR_EL2.GICCDEN (bit 0) must be initialised to 0b1.
  200. - The DT or ACPI tables must describe a GICv5 interrupt controller.
  201. For systems with a GICv3 interrupt controller to be used in v3 mode:
  202. - If EL3 is present:
  203. - ICC_SRE_EL3.Enable (bit 3) must be initialised to 0b1.
  204. - ICC_SRE_EL3.SRE (bit 0) must be initialised to 0b1.
  205. - ICC_CTLR_EL3.PMHE (bit 6) must be set to the same value across
  206. all CPUs the kernel is executing on, and must stay constant
  207. for the lifetime of the kernel.
  208. - If the kernel is entered at EL1:
  209. - ICC_SRE_EL2.Enable (bit 3) must be initialised to 0b1
  210. - ICC_SRE_EL2.SRE (bit 0) must be initialised to 0b1.
  211. - The DT or ACPI tables must describe a GICv3 interrupt controller.
  212. For systems with a GICv3 interrupt controller to be used in
  213. compatibility (v2) mode:
  214. - If EL3 is present:
  215. ICC_SRE_EL3.SRE (bit 0) must be initialised to 0b0.
  216. - If the kernel is entered at EL1:
  217. ICC_SRE_EL2.SRE (bit 0) must be initialised to 0b0.
  218. - The DT or ACPI tables must describe a GICv2 interrupt controller.
  219. For CPUs with pointer authentication functionality:
  220. - If EL3 is present:
  221. - SCR_EL3.APK (bit 16) must be initialised to 0b1
  222. - SCR_EL3.API (bit 17) must be initialised to 0b1
  223. - If the kernel is entered at EL1:
  224. - HCR_EL2.APK (bit 40) must be initialised to 0b1
  225. - HCR_EL2.API (bit 41) must be initialised to 0b1
  226. For CPUs with Activity Monitors Unit v1 (AMUv1) extension present:
  227. - If EL3 is present:
  228. - CPTR_EL3.TAM (bit 30) must be initialised to 0b0
  229. - CPTR_EL2.TAM (bit 30) must be initialised to 0b0
  230. - AMCNTENSET0_EL0 must be initialised to 0b1111
  231. - AMCNTENSET1_EL0 must be initialised to a platform specific value
  232. having 0b1 set for the corresponding bit for each of the auxiliary
  233. counters present.
  234. - If the kernel is entered at EL1:
  235. - AMCNTENSET0_EL0 must be initialised to 0b1111
  236. - AMCNTENSET1_EL0 must be initialised to a platform specific value
  237. having 0b1 set for the corresponding bit for each of the auxiliary
  238. counters present.
  239. For CPUs with the Fine Grained Traps (FEAT_FGT) extension present:
  240. - If EL3 is present and the kernel is entered at EL2:
  241. - SCR_EL3.FGTEn (bit 27) must be initialised to 0b1.
  242. For CPUs with the Fine Grained Traps 2 (FEAT_FGT2) extension present:
  243. - If EL3 is present and the kernel is entered at EL2:
  244. - SCR_EL3.FGTEn2 (bit 59) must be initialised to 0b1.
  245. For CPUs with support for HCRX_EL2 (FEAT_HCX) present:
  246. - If EL3 is present and the kernel is entered at EL2:
  247. - SCR_EL3.HXEn (bit 38) must be initialised to 0b1.
  248. For CPUs with Advanced SIMD and floating point support:
  249. - If EL3 is present:
  250. - CPTR_EL3.TFP (bit 10) must be initialised to 0b0.
  251. - If EL2 is present and the kernel is entered at EL1:
  252. - CPTR_EL2.TFP (bit 10) must be initialised to 0b0.
  253. For CPUs with the Scalable Vector Extension (FEAT_SVE) present:
  254. - if EL3 is present:
  255. - CPTR_EL3.EZ (bit 8) must be initialised to 0b1.
  256. - ZCR_EL3.LEN must be initialised to the same value for all CPUs the
  257. kernel is executed on.
  258. - If the kernel is entered at EL1 and EL2 is present:
  259. - CPTR_EL2.TZ (bit 8) must be initialised to 0b0.
  260. - CPTR_EL2.ZEN (bits 17:16) must be initialised to 0b11.
  261. - ZCR_EL2.LEN must be initialised to the same value for all CPUs the
  262. kernel will execute on.
  263. For CPUs with the Scalable Matrix Extension (FEAT_SME):
  264. - If EL3 is present:
  265. - CPTR_EL3.ESM (bit 12) must be initialised to 0b1.
  266. - SCR_EL3.EnTP2 (bit 41) must be initialised to 0b1.
  267. - SMCR_EL3.LEN must be initialised to the same value for all CPUs the
  268. kernel will execute on.
  269. - If the kernel is entered at EL1 and EL2 is present:
  270. - CPTR_EL2.TSM (bit 12) must be initialised to 0b0.
  271. - CPTR_EL2.SMEN (bits 25:24) must be initialised to 0b11.
  272. - SCTLR_EL2.EnTP2 (bit 60) must be initialised to 0b1.
  273. - SMCR_EL2.LEN must be initialised to the same value for all CPUs the
  274. kernel will execute on.
  275. - HFGRTR_EL2.nTPIDR2_EL0 (bit 55) must be initialised to 0b01.
  276. - HFGWTR_EL2.nTPIDR2_EL0 (bit 55) must be initialised to 0b01.
  277. - HFGRTR_EL2.nSMPRI_EL1 (bit 54) must be initialised to 0b01.
  278. - HFGWTR_EL2.nSMPRI_EL1 (bit 54) must be initialised to 0b01.
  279. For CPUs with the Scalable Matrix Extension FA64 feature (FEAT_SME_FA64):
  280. - If EL3 is present:
  281. - SMCR_EL3.FA64 (bit 31) must be initialised to 0b1.
  282. - If the kernel is entered at EL1 and EL2 is present:
  283. - SMCR_EL2.FA64 (bit 31) must be initialised to 0b1.
  284. For CPUs with the Memory Tagging Extension feature (FEAT_MTE2):
  285. - If EL3 is present:
  286. - SCR_EL3.ATA (bit 26) must be initialised to 0b1.
  287. - If the kernel is entered at EL1 and EL2 is present:
  288. - HCR_EL2.ATA (bit 56) must be initialised to 0b1.
  289. For CPUs with the Scalable Matrix Extension version 2 (FEAT_SME2):
  290. - If EL3 is present:
  291. - SMCR_EL3.EZT0 (bit 30) must be initialised to 0b1.
  292. - If the kernel is entered at EL1 and EL2 is present:
  293. - SMCR_EL2.EZT0 (bit 30) must be initialised to 0b1.
  294. For CPUs with the Branch Record Buffer Extension (FEAT_BRBE):
  295. - If EL3 is present:
  296. - MDCR_EL3.SBRBE (bits 33:32) must be initialised to 0b01 or 0b11.
  297. - If the kernel is entered at EL1 and EL2 is present:
  298. - BRBCR_EL2.CC (bit 3) must be initialised to 0b1.
  299. - BRBCR_EL2.MPRED (bit 4) must be initialised to 0b1.
  300. - HDFGRTR_EL2.nBRBDATA (bit 61) must be initialised to 0b1.
  301. - HDFGRTR_EL2.nBRBCTL (bit 60) must be initialised to 0b1.
  302. - HDFGRTR_EL2.nBRBIDR (bit 59) must be initialised to 0b1.
  303. - HDFGWTR_EL2.nBRBDATA (bit 61) must be initialised to 0b1.
  304. - HDFGWTR_EL2.nBRBCTL (bit 60) must be initialised to 0b1.
  305. - HFGITR_EL2.nBRBIALL (bit 56) must be initialised to 0b1.
  306. - HFGITR_EL2.nBRBINJ (bit 55) must be initialised to 0b1.
  307. For CPUs with the Performance Monitors Extension (FEAT_PMUv3p9):
  308. - If EL3 is present:
  309. - MDCR_EL3.EnPM2 (bit 7) must be initialised to 0b1.
  310. - If the kernel is entered at EL1 and EL2 is present:
  311. - HDFGRTR2_EL2.nPMICNTR_EL0 (bit 2) must be initialised to 0b1.
  312. - HDFGRTR2_EL2.nPMICFILTR_EL0 (bit 3) must be initialised to 0b1.
  313. - HDFGRTR2_EL2.nPMUACR_EL1 (bit 4) must be initialised to 0b1.
  314. - HDFGWTR2_EL2.nPMICNTR_EL0 (bit 2) must be initialised to 0b1.
  315. - HDFGWTR2_EL2.nPMICFILTR_EL0 (bit 3) must be initialised to 0b1.
  316. - HDFGWTR2_EL2.nPMUACR_EL1 (bit 4) must be initialised to 0b1.
  317. For CPUs with SPE data source filtering (FEAT_SPE_FDS):
  318. - If EL3 is present:
  319. - MDCR_EL3.EnPMS3 (bit 42) must be initialised to 0b1.
  320. - If the kernel is entered at EL1 and EL2 is present:
  321. - HDFGRTR2_EL2.nPMSDSFR_EL1 (bit 19) must be initialised to 0b1.
  322. - HDFGWTR2_EL2.nPMSDSFR_EL1 (bit 19) must be initialised to 0b1.
  323. For CPUs with Memory Copy and Memory Set instructions (FEAT_MOPS):
  324. - If the kernel is entered at EL1 and EL2 is present:
  325. - HCRX_EL2.MSCEn (bit 11) must be initialised to 0b1.
  326. - HCRX_EL2.MCE2 (bit 10) must be initialised to 0b1 and the hypervisor
  327. must handle MOPS exceptions as described in :ref:`arm64_mops_hyp`.
  328. For CPUs with the Extended Translation Control Register feature (FEAT_TCR2):
  329. - If EL3 is present:
  330. - SCR_EL3.TCR2En (bit 43) must be initialised to 0b1.
  331. - If the kernel is entered at EL1 and EL2 is present:
  332. - HCRX_EL2.TCR2En (bit 14) must be initialised to 0b1.
  333. For CPUs with the Stage 1 Permission Indirection Extension feature (FEAT_S1PIE):
  334. - If EL3 is present:
  335. - SCR_EL3.PIEn (bit 45) must be initialised to 0b1.
  336. - If the kernel is entered at EL1 and EL2 is present:
  337. - HFGRTR_EL2.nPIR_EL1 (bit 58) must be initialised to 0b1.
  338. - HFGWTR_EL2.nPIR_EL1 (bit 58) must be initialised to 0b1.
  339. - HFGRTR_EL2.nPIRE0_EL1 (bit 57) must be initialised to 0b1.
  340. - HFGRWR_EL2.nPIRE0_EL1 (bit 57) must be initialised to 0b1.
  341. - For CPUs with Guarded Control Stacks (FEAT_GCS):
  342. - GCSCR_EL1 must be initialised to 0.
  343. - GCSCRE0_EL1 must be initialised to 0.
  344. - If EL3 is present:
  345. - SCR_EL3.GCSEn (bit 39) must be initialised to 0b1.
  346. - If EL2 is present:
  347. - GCSCR_EL2 must be initialised to 0.
  348. - If the kernel is entered at EL1 and EL2 is present:
  349. - HCRX_EL2.GCSEn must be initialised to 0b1.
  350. - HFGITR_EL2.nGCSEPP (bit 59) must be initialised to 0b1.
  351. - HFGITR_EL2.nGCSSTR_EL1 (bit 58) must be initialised to 0b1.
  352. - HFGITR_EL2.nGCSPUSHM_EL1 (bit 57) must be initialised to 0b1.
  353. - HFGRTR_EL2.nGCS_EL1 (bit 53) must be initialised to 0b1.
  354. - HFGRTR_EL2.nGCS_EL0 (bit 52) must be initialised to 0b1.
  355. - HFGWTR_EL2.nGCS_EL1 (bit 53) must be initialised to 0b1.
  356. - HFGWTR_EL2.nGCS_EL0 (bit 52) must be initialised to 0b1.
  357. - For CPUs with debug architecture i.e FEAT_Debugv8pN (all versions):
  358. - If EL3 is present:
  359. - MDCR_EL3.TDA (bit 9) must be initialized to 0b0
  360. - For CPUs with FEAT_PMUv3:
  361. - If EL3 is present:
  362. - MDCR_EL3.TPM (bit 6) must be initialized to 0b0
  363. For CPUs with support for 64-byte loads and stores without status (FEAT_LS64):
  364. - If the kernel is entered at EL1 and EL2 is present:
  365. - HCRX_EL2.EnALS (bit 1) must be initialised to 0b1.
  366. For CPUs with support for 64-byte stores with status (FEAT_LS64_V):
  367. - If the kernel is entered at EL1 and EL2 is present:
  368. - HCRX_EL2.EnASR (bit 2) must be initialised to 0b1.
  369. The requirements described above for CPU mode, caches, MMUs, architected
  370. timers, coherency and system registers apply to all CPUs. All CPUs must
  371. enter the kernel in the same exception level. Where the values documented
  372. disable traps it is permissible for these traps to be enabled so long as
  373. those traps are handled transparently by higher exception levels as though
  374. the values documented were set.
  375. The boot loader is expected to enter the kernel on each CPU in the
  376. following manner:
  377. - The primary CPU must jump directly to the first instruction of the
  378. kernel image. The device tree blob passed by this CPU must contain
  379. an 'enable-method' property for each cpu node. The supported
  380. enable-methods are described below.
  381. It is expected that the bootloader will generate these device tree
  382. properties and insert them into the blob prior to kernel entry.
  383. - CPUs with a "spin-table" enable-method must have a 'cpu-release-addr'
  384. property in their cpu node. This property identifies a
  385. naturally-aligned 64-bit zero-initalised memory location.
  386. These CPUs should spin outside of the kernel in a reserved area of
  387. memory (communicated to the kernel by a /memreserve/ region in the
  388. device tree) polling their cpu-release-addr location, which must be
  389. contained in the reserved region. A wfe instruction may be inserted
  390. to reduce the overhead of the busy-loop and a sev will be issued by
  391. the primary CPU. When a read of the location pointed to by the
  392. cpu-release-addr returns a non-zero value, the CPU must jump to this
  393. value. The value will be written as a single 64-bit little-endian
  394. value, so CPUs must convert the read value to their native endianness
  395. before jumping to it.
  396. - CPUs with a "psci" enable method should remain outside of
  397. the kernel (i.e. outside of the regions of memory described to the
  398. kernel in the memory node, or in a reserved area of memory described
  399. to the kernel by a /memreserve/ region in the device tree). The
  400. kernel will issue CPU_ON calls as described in ARM document number ARM
  401. DEN 0022A ("Power State Coordination Interface System Software on ARM
  402. processors") to bring CPUs into the kernel.
  403. The device tree should contain a 'psci' node, as described in
  404. Documentation/devicetree/bindings/arm/psci.yaml.
  405. - Secondary CPU general-purpose register settings
  406. - x0 = 0 (reserved for future use)
  407. - x1 = 0 (reserved for future use)
  408. - x2 = 0 (reserved for future use)
  409. - x3 = 0 (reserved for future use)