context-management-library.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. Context Management Library
  2. **************************
  3. This document provides an overview of the Context Management library implementation
  4. in Trusted Firmware-A (TF-A). It enumerates and describes the APIs implemented
  5. and their accessibility from other components at EL3.
  6. Overview
  7. ========
  8. Arm TrustZone architecture facilitates hardware-enforced isolation between
  9. software running in various security states (Secure/Non-Secure/Realm).
  10. The general-purpose registers, most of the system registers and vector registers
  11. are not banked per world. When moving between the security states it is the
  12. responsibility of the secure monitor software (BL31(AArch64) / BL32(Aarch32))
  13. in TF-A, not the hardware, to save and restore register state.
  14. Refer to `Trustzone for AArch64`_ for more details.
  15. EL3 Runtime Firmware, also termed as secure monitor firmware, is integrated
  16. with a context management library to handle the context of the CPU, managing the
  17. saving and restoring of register states across the worlds.
  18. TF-A Context
  19. ============
  20. In TF-A, the context is represented as a data structure used by the EL3 firmware
  21. to preserve the state of the CPU at the next lower exception level (EL) in a given
  22. security state and save enough EL3 metadata to be able to return to that exception
  23. level and security state. The memory for the context data structures are allocated
  24. in BSS section of EL3 firmware.
  25. In a trusted system at any instance, a given CPU could be executing in one of the
  26. security states (Non-Secure, Secure, Realm). Each world must have its
  27. configuration of system registers independent of other security states to access
  28. and execute any of the architectural features.
  29. If the CPU switches across security states (for example: from Non-secure to Secure
  30. or vice versa), the register contents, especially the ones that are not banked
  31. (EL2/EL1, vector, general-purpose registers), will be overwritten, as the software
  32. running in either state has the privileges to access them. Additionally, some of
  33. the architectural features enabled in the former security state will be unconditionally
  34. accessible in the latter security state as well. This can be a major concern when
  35. dealing with security-specific bits, as they need to be explicitly enabled or
  36. disabled in each state to prevent data leakage across the worlds.
  37. In general, an ideal trusted system should have Secure world-specific configurations
  38. that are not influenced by Normal World operations. Therefore, for each CPU, we
  39. need to maintain world-specific context to ensure that register entries from one
  40. world do not leak or impact the execution of the CPU in other worlds.
  41. This will help ensure the integrity and security of the system, preventing any
  42. unauthorized access or data corruption between the different security states.
  43. Design
  44. ======
  45. The Context Management library in TF-A is designed to cover all the requirements
  46. for maintaining world-specific context essential for a trusted system.
  47. This includes implementing CPU context initialization and management routines,
  48. as well as other helper APIs that are required by dispatcher components in EL3
  49. firmware, which are collectively referred to as CPU Context Management.
  50. The APIs and their usecases are listed in detail under the :ref:`Library APIs`
  51. section.
  52. Originally, the Context Management library in TF-A was designed to cater for a
  53. two-world system, comprising of Non-Secure and Secure Worlds. In this case, the
  54. EL3 Firmware is assumed to be running in Secure World.
  55. With introduction of Realm Management Extension (RME), from Armv9.2 a system
  56. can have four distinct worlds (Non-Secure, Secure, Realm, Root).
  57. RME isolates EL3 from all other Security states and moves it into its own security
  58. state called root. EL3 firmware now runs at Root World and thereby is
  59. trusted from software in Non-secure, Secure, and Realm states.
  60. Refer to `Security States with RME`_ for more details.
  61. Key principles followed in designing the context management library :
  62. 1. **EL3 should only initialize immediate used lower EL**
  63. Context Management library running at EL3 should only initialize and monitor the
  64. immediate used lower EL. This implies that, when S-EL2 is present in the system,
  65. EL3 should initialise and monitor S-EL2 registers only. S-EL1 registers should
  66. not be the concern of EL3 while S-EL2 is in place. In systems where S-EL2 is
  67. absent, S-EL1 registers should be initialised from EL3.
  68. 2. **Decentralized model for context management**
  69. Each world (Non-Secure, Secure, and Realm) should have their separate component
  70. in EL3 responsible for their respective world context management.
  71. Both the Secure and Realm world have associated dispatcher components in EL3
  72. firmware to allow management of the respective worlds. For the Non-Secure world,
  73. PSCI Library (BL31)/context management library provides routines to help
  74. initialize the Non-Secure world context.
  75. 3. **Flexibility for Dispatchers to select desired feature set to save and restore**
  76. Each feature is supported with a helper function ``is_feature_supported(void)``,
  77. to detect its presence at runtime. This helps dispatchers to select the desired
  78. feature set, and thereby save and restore the configuration associated with them.
  79. 4. **Dynamic discovery of Feature enablement by EL3**
  80. TF-A supports four states for feature enablement at EL3, to make them available
  81. for lower exception levels.
  82. .. code:: c
  83. #define FEAT_STATE_DISABLED 0
  84. #define FEAT_STATE_ENABLED 1
  85. #define FEAT_STATE_CHECK 2
  86. #define FEAT_STATE_CHECK_ASYMMETRIC 3
  87. A pattern is established for feature enablement behavior.
  88. Each feature must support the 3 possible values with rigid semantics.
  89. - **FEAT_STATE_DISABLED** - all code relating to this feature is always skipped.
  90. Firmware is unaware of this feature.
  91. - **FEAT_STATE_ALWAYS** - all code relating to this feature is always executed.
  92. Firmware expects this feature to be present in hardware.
  93. - **FEAT_STATE_CHECK** - same as ``FEAT_STATE_ALWAYS`` except that the feature's
  94. existence will be checked at runtime. Default on dynamic platforms (example: FVP).
  95. - **FEAT_STATE_CHECK_ASYMMETRIC** - same as ``FEAT_STATE_CHECK`` except that the feature's
  96. existence is asymmetric across cores, which requires the feature existence is checked
  97. during warmboot path also. Note that only limited number of features can be asymmetric.
  98. .. note::
  99. Only limited number of features can be ``FEAT_STATE_CHECK_ASYMMETRIC`` this is due to
  100. the fact that Operating systems are designed for SMP systems.
  101. There are no clear guidelines what kind of mismatch is allowed but following pointers
  102. can help making a decision
  103. - All mandatory features must be symmetric.
  104. - Any feature that impacts the generation of page tables must be symmetric.
  105. - Any feature access which does not trap to EL3 should be symmetric.
  106. - Features related with profiling, debug and trace could be asymmetric
  107. - Migration of vCPU/tasks between CPUs should not cause an error
  108. Whenever there is asymmetric feature support is added for a feature TF-A need to add
  109. feature specific code in context management code.
  110. .. note::
  111. ``FEAT_RAS`` is an exception here, as it impacts the execution of EL3 and
  112. it is essential to know its presence at compile time. Refer to ``ENABLE_FEAT``
  113. macro under :ref:`Build Options` section for more details.
  114. Code Structure
  115. ==============
  116. `lib/el3_runtime/(aarch32/aarch64)`_ - Context library code directory.
  117. Source Files
  118. ~~~~~~~~~~~~
  119. #. ``context_mgmt.c`` : consists of core functions that setup, save and restore
  120. context for different security states alongside high level feature enablement
  121. APIs for individual worlds.
  122. #. ``cpu_data_array.c`` : contains per_cpu_data structure instantiation.
  123. #. ``context.S`` : consists of functions that save and restore some of the context
  124. structure members in assembly code.
  125. #. ``cpu_data.S`` : consists of helper functions to initialise per_cpu_data pointers.
  126. #. ``el3_common_macros.S`` : consists of macros to facilitate actions to be performed
  127. during cold and warmboot and el3 registers initialisation in assembly code.
  128. Header Files
  129. ~~~~~~~~~~~~
  130. #. ``context_mgmt.h`` : contains the public interface to Context Management Library.
  131. #. ``context.h`` : contains the helper macros and definitions for context entries.
  132. #. ``cpu_data.h`` : contains the public interface to Per CPU data structure.
  133. #. ``context_debug.h`` : contains public interface to report context memory
  134. utilisation across the security states.
  135. #. ``context_el2.h`` : internal header consisting of helper macros to access EL2
  136. context entries. Used by ``context.h``.
  137. Apart from these files, we have some context related source files under ``BL1``
  138. and ``BL31`` directory. ``bl1_context_mgmt.c`` ``bl31_context_mgmt.c``
  139. Bootloader Images utilizing Context Management Library
  140. ======================================================
  141. +-------------------------------------------+-----------------------------+
  142. | Bootloader | Context Management Library |
  143. +-------------------------------------------+-----------------------------+
  144. | BL1 | Yes |
  145. +-------------------------------------------+-----------------------------+
  146. | BL2 | No |
  147. +-------------------------------------------+-----------------------------+
  148. | BL31 (Aarch64- EL3runtime firmware) | Yes |
  149. +-------------------------------------------+-----------------------------+
  150. | BL32 (Aarch32- EL3runtime firmware) | Yes |
  151. +-------------------------------------------+-----------------------------+
  152. CPU Data Structure
  153. ==================
  154. For a given system, depending on the CPU count, the platform statically
  155. allocates memory for the CPU data structure.
  156. .. code:: c
  157. /* The per_cpu_ptr_cache_t space allocation */
  158. cpu_data_t percpu_data[PLATFORM_CORE_COUNT];
  159. This CPU data structure has a member element with an array of pointers to hold
  160. the Non-Secure, Realm and Secure security state context structures as listed below.
  161. .. code:: c
  162. typedef struct cpu_data {
  163. #ifdef __aarch64__
  164. void *cpu_context[CPU_DATA_CONTEXT_NUM];
  165. #endif
  166. ....
  167. ....
  168. }cpu_data_t;
  169. |CPU Data Structure|
  170. At runtime, ``cpu_context[CPU_DATA_CONTEXT_NUM]`` array will be intitialised with
  171. the Secure, Non-Secure and Realm context structure addresses to ensure proper
  172. handling of the register state.
  173. See :ref:`Library APIs` section for more details.
  174. CPU Context and Memory allocation
  175. =================================
  176. CPU Context
  177. ~~~~~~~~~~~
  178. The members of the context structure used by the EL3 firmware to preserve the
  179. state of CPU across exception levels for a given security state are listed below.
  180. .. code:: c
  181. typedef struct cpu_context {
  182. gp_regs_t gpregs_ctx;
  183. el3_state_t el3state_ctx;
  184. cve_2018_3639_t cve_2018_3639_ctx;
  185. #if ERRATA_SPECULATIVE_AT
  186. errata_speculative_at_t errata_speculative_at_ctx;
  187. #endif
  188. #if CTX_INCLUDE_PAUTH_REGS
  189. pauth_t pauth_ctx;
  190. #endif
  191. #if (CTX_INCLUDE_EL2_REGS && IMAGE_BL31)
  192. el2_sysregs_t el2_sysregs_ctx;
  193. #else
  194. el1_sysregs_t el1_sysregs_ctx;
  195. #endif
  196. } cpu_context_t;
  197. Context Memory Allocation
  198. ~~~~~~~~~~~~~~~~~~~~~~~~~
  199. CPUs maintain their context per world. The individual context memory allocation
  200. for each CPU per world is allocated by the world-specific dispatcher components
  201. at compile time as shown below.
  202. |Context memory allocation|
  203. NS-Context Memory
  204. ~~~~~~~~~~~~~~~~~
  205. It's important to note that the Normal world doesn't possess the dispatcher
  206. component found in the Secure and Realm worlds. Instead, the PSCI library at EL3
  207. handles memory allocation for ``Non-Secure`` world context for all CPUs.
  208. .. code:: c
  209. static cpu_context_t psci_ns_context[PLATFORM_CORE_COUNT];
  210. Secure-Context Memory
  211. ~~~~~~~~~~~~~~~~~~~~~
  212. Secure World dispatcher (such as SPMD) at EL3 allocates the memory for ``Secure``
  213. world context of all CPUs.
  214. .. code:: c
  215. static spmd_spm_core_context_t spm_core_context[PLATFORM_CORE_COUNT];
  216. Realm-Context Memory
  217. ~~~~~~~~~~~~~~~~~~~~
  218. Realm World dispatcher (RMMD) at EL3 allocates the memory for ``Realm`` world
  219. context of all CPUs.
  220. .. code:: c
  221. rmmd_rmm_context_t rmm_context[PLATFORM_CORE_COUNT];
  222. To summarize, the world-specific context structures are synchronized with
  223. per-CPU data structures, which means that each CPU will have an array of pointers
  224. to individual worlds. The figure below illustrates the same.
  225. |CPU Context Memory Configuration|
  226. Context Setup/Initialization
  227. ============================
  228. The CPU has been assigned context structures for every security state, which include
  229. Non-Secure, Secure and Realm. It is crucial to initialize each of these structures
  230. during the bootup of every CPU before they enter any security state for the
  231. first time. This section explains the specifics of how the initialization of
  232. every CPU context takes place during both cold and warm boot paths.
  233. Context Setup during Cold boot
  234. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  235. The cold boot path is mainly executed by the primary CPU, other than essential
  236. CPU initialization executed by all CPUs. After executing BL1 and BL2, the Primary
  237. CPU jumps to the BL31 image for runtime services initialization.
  238. During this process, the per_cpu_data structure gets initialized with statically
  239. allocated world-specific context memory.
  240. Later in the cold boot sequence, the BL31 image at EL3 checks for the presence
  241. of a Secure world image at S-EL2. If detected, it invokes the secure context
  242. initialization sequence under SPMD. Additionally, based on RME enablement,
  243. the Realm context gets initialized from the RMMD at EL3. Finally, before exiting
  244. to the normal world, the Non-Secure context gets initialized via the context
  245. management library. At this stage, all Primary CPU contexts are initialized
  246. and the CPU exits EL3 to enter the Normal world.
  247. |Context Init ColdBoot|
  248. .. note::
  249. The figure above illustrates a scenario on FVP for one of the build
  250. configurations with TFTF component at NS-EL2.
  251. Context Setup during Warmboot
  252. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  253. During a warm boot sequence, the primary CPU is responsible for powering on the
  254. secondary CPUs. Refer to :ref:`CPU Reset` and :ref:`Firmware Design` sections for
  255. more details on the warm boot.
  256. |Context Init WarmBoot|
  257. The primary CPU initializes the Non-Secure context for the secondary CPU while
  258. restoring re-entry information for the Non-Secure world.
  259. It initialises via ``cm_init_context_by_index(target_idx, ep )``.
  260. ``psci_warmboot_entrypoint()`` is the warm boot entrypoint procedure.
  261. During the warm bootup process, secondary CPUs have their secure context
  262. initialized through SPMD at EL3. Upon successful SP initialization, the SPD
  263. power management operations become shared with the PSCI library. During this
  264. process, the SPMD duly registers its handlers with the PSCI library.
  265. .. code:: c
  266. file: psci_common.c
  267. const spd_pm_ops_t *psci_spd_pm;
  268. file: spmd_pm.c
  269. const spd_pm_ops_t spmd_pm = {
  270. .svc_on_finish = spmd_cpu_on_finish_handler,
  271. .svc_off = spmd_cpu_off_handler
  272. }
  273. Secondary CPUs during their bootup in the ``psci_cpu_on_finish()`` routine get
  274. their secure context initialised via the registered SPMD handler
  275. ``spmd_cpu_on_finish_handler()`` at EL3.
  276. The figure above illustrates the same with reference of Primary CPU running at
  277. NS-EL2.
  278. .. _Library APIs:
  279. Library APIs
  280. ============
  281. The public APIs and types can be found in ``include/lib/el3_runtime/context_management.h``
  282. and this section is intended to provide additional details and clarifications.
  283. Context Initialization for Individual Worlds
  284. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  285. The library implements high level APIs for the CPUs in setting up their individual
  286. context for each world (Non-Secure, Secure and Realm).
  287. .. c:function:: static void setup_context_common(cpu_context_t *ctx, const entry_point_info_t *ep);
  288. This function is responsible for the general context initialization that applies
  289. to all worlds. It will be invoked first, before calling the individual
  290. world-specific context setup APIs.
  291. .. c:function:: static void setup_ns_context(cpu_context_t *ctx, const struct entry_point_info *ep);
  292. .. c:function:: static void setup_realm_context(cpu_context_t *ctx, const struct entry_point_info *ep);
  293. .. c:function:: static void setup_secure_context(cpu_context_t *ctx, const struct entry_point_info *ep);
  294. Depending on the security state that the CPU needs to enter, the respective
  295. world-specific context setup handlers listed above will be invoked once per-CPU
  296. to set up the context for their execution.
  297. .. c:function:: void cm_manage_extensions_el3(void)
  298. This function initializes all EL3 registers whose values do not change during the
  299. lifetime of EL3 runtime firmware. It is invoked from each CPU via the cold boot
  300. path ``bl31_main()`` and in the WarmBoot entry path ``void psci_warmboot_entrypoint()``.
  301. Runtime Save and Restore of Registers
  302. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  303. EL1 Registers
  304. -------------
  305. .. c:function:: void cm_el1_sysregs_context_save(uint32_t security_state);
  306. .. c:function:: void cm_el1_sysregs_context_restore(uint32_t security_state);
  307. These functions are utilized by the world-specific dispatcher components running
  308. at EL3 to facilitate the saving and restoration of the EL1 system registers
  309. during a world switch.
  310. EL2 Registers
  311. -------------
  312. .. c:function:: void cm_el2_sysregs_context_save(uint32_t security_state);
  313. .. c:function:: void cm_el2_sysregs_context_restore(uint32_t security_state);
  314. These functions are utilized by the world-specific dispatcher components running
  315. at EL3 to facilitate the saving and restoration of the EL2 system registers
  316. during a world switch.
  317. Pauth Registers
  318. ---------------
  319. Pointer Authentication feature is enabled by default for Non-Secure world and
  320. disabled for Secure and Realm worlds. In this case, we don't need to explicitly
  321. save and restore the Pauth registers during world switch.
  322. However, ``CTX_INCLUDE_PAUTH_REGS`` flag is explicitly used to enable Pauth for
  323. lower exception levels of Secure and Realm worlds. In this scenario, we save the
  324. general purpose and Pauth registers while we enter EL3 from lower ELs via
  325. ``prepare_el3_entry`` and restore them back while we exit EL3 to lower ELs
  326. via ``el3_exit``.
  327. .. code:: c
  328. .macro save_gp_pmcr_pauth_regs
  329. func restore_gp_pmcr_pauth_regs
  330. Feature Enablement for Individual Worlds
  331. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  332. .. c:function:: static void manage_extensions_nonsecure(cpu_context_t *ctx);
  333. .. c:function:: static void manage_extensions_secure(cpu_context_t *ctx);
  334. .. c:function:: static void manage_extensions_realm(cpu_context_t *ctx)
  335. Functions that allow the enabling and disabling of architectural features for
  336. each security state. These functions are invoked from the top-level setup APIs
  337. during context initialization.
  338. Further, a pattern is established for feature enablement code (AArch64).
  339. Each feature implements following APIs as applicable:
  340. Note: (``xxx`` is the name of the feature in the APIs)
  341. - ``is_feat_xxx_supported()`` and ``is_feat_xxx_present()`` - mandatory for all features.
  342. - ``xxx_enable(cpu_context * )`` and ``xxx_disable(cpu_context * )`` - optional
  343. functions to enable the feature for the passed context only. To be called in
  344. the respective world's setup_context to select behaviour.
  345. - ``xxx_init_el3()`` - optional function to enable the feature in-place in any EL3
  346. registers that are never context switched. The values they write must never
  347. change, otherwise the functions mentioned in previous point should be used.
  348. Invoked from ``cm_manage_extensions_el3()``.
  349. - ``xxx_init_el2_unused()`` - optional function to enable the feature in-place
  350. in any EL2 registers that are necessary for execution in EL1 with no EL2 present.
  351. The above mentioned rules, followed for ``FEAT_SME`` is shown below:
  352. .. code:: c
  353. void sme_enable(cpu_context_t *context);
  354. void sme_init_el3(void);
  355. void sme_init_el2_unused(void);
  356. void sme_disable(cpu_context_t *context);
  357. Per-world Context
  358. =================
  359. Apart from the CPU context structure, we have another structure to manage some
  360. of the EL3 system registers whose values are identical across all the CPUs
  361. referred to as ``per_world_context_t``.
  362. The Per-world context structure is intended for managing EL3 system registers with
  363. identical values across all CPUs, requiring only a singular context entry for each
  364. individual world. This structure operates independently of the CPU context
  365. structure and is intended to manage specific EL3 registers.
  366. .. code-block:: c
  367. typedef struct per_world_context {
  368. uint64_t ctx_cptr_el3;
  369. uint64_t ctx_zcr_el3;
  370. uint64_t ctx_mpam3_el3;
  371. } per_world_context_t;
  372. These functions facilitate the activation of architectural extensions that possess
  373. identical values across all cores for the individual Non-secure, Secure, and
  374. Realm worlds.
  375. Root-Context (EL3-Execution-Context)
  376. ====================================
  377. EL3/Root Context is the execution environment while the CPU is running at EL3.
  378. Previously, while the CPU is in execution at EL3, the system registers persist
  379. with the values of the incoming world. This implies that if the CPU is entering
  380. EL3 from NS world, the EL1 and EL2 system registers which might be modified in
  381. lower exception levels NS(EL2/EL1) will carry forward those values to EL3.
  382. Further the EL3 registers also hold on to the values configured for Non-secure
  383. world, written during the previous ERET from EL3 to NS(EL2/EL1).
  384. Same policy is followed with respect to other worlds (Secure/Realm) depending on
  385. the system configuration.
  386. The firmware at EL3 has traditionally operated within the context of the incoming
  387. world (Secure/Non-Secure/Realm). This becomes problematic in scenarios where the
  388. EL3/Root world must explicitly use architectural features that depend on system
  389. registers configured for lower exception levels.
  390. A good example of this is the PAuth regs. The Root world would need to program
  391. its own PAuth Keys while executing in EL3 and this needs to be restored in entry
  392. to EL3 from any world.
  393. Therefore, Root world should maintain its own distinct settings to access
  394. features for its own execution at EL3.
  395. Register values which are currently known to be of importance during EL3 execution,
  396. is referred to as the EL3/Root context.
  397. This includes ( MDCR_EL3.SDD, SCR_EL3.{EA, SIF}, PMCR_EL0.DP, PSTATE.DIT)
  398. EL3 Context ensures, CPU executes under fixed EL3 system register settings
  399. which is not affected by settings of other worlds.
  400. Root Context needs to be setup as early as possible before we try and access/modify
  401. architectural features at EL3. Its a simple restore operation ``setup_el3_execution_context``
  402. that overwrites the selected bits listed above. EL3 never changes its mind about
  403. what those values should be, sets it as required for EL3. Henceforth, a Root
  404. context save operation is not required.
  405. The figure below illustrates the same with NS-world as a reference while entering
  406. EL3.
  407. |Root Context Sequence|
  408. .. code:: c
  409. # EL3/Root_Context routine
  410. .macro setup_el3_execution_context
  411. EL3 execution context needs to setup at both boot time (cold and warm boot)
  412. entrypaths and at all the possible exception handlers routing to EL3 at runtime.
  413. *Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.*
  414. .. |Context Memory Allocation| image:: ../resources/diagrams/context_memory_allocation.png
  415. .. |CPU Context Memory Configuration| image:: ../resources/diagrams/cpu_data_config_context_memory.png
  416. .. |CPU Data Structure| image:: ../resources/diagrams/percpu-data-struct.png
  417. .. |Context Init ColdBoot| image:: ../resources/diagrams/context_init_coldboot.png
  418. .. |Context Init WarmBoot| image:: ../resources/diagrams/context_init_warmboot.png
  419. .. |Root Context Sequence| image:: ../resources/diagrams/root_context_sequence.png
  420. .. _Trustzone for AArch64: https://developer.arm.com/documentation/102418/0101/TrustZone-in-the-processor/Switching-between-Security-states
  421. .. _Security States with RME: https://developer.arm.com/documentation/den0126/0100/Security-states
  422. .. _lib/el3_runtime/(aarch32/aarch64): https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/lib/el3_runtime