alt-boot-flows.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. Alternative Boot Flows
  2. ======================
  3. EL3 payloads alternative boot flow
  4. ----------------------------------
  5. On a pre-production system, the ability to execute arbitrary, bare-metal code at
  6. the highest exception level is required. It allows full, direct access to the
  7. hardware, for example to run silicon soak tests.
  8. Although it is possible to implement some baremetal secure firmware from
  9. scratch, this is a complex task on some platforms, depending on the level of
  10. configuration required to put the system in the expected state.
  11. Rather than booting a baremetal application, a possible compromise is to boot
  12. ``EL3 payloads`` through TF-A instead. This is implemented as an alternative
  13. boot flow, where a modified BL2 boots an EL3 payload, instead of loading the
  14. other BL images and passing control to BL31. It reduces the complexity of
  15. developing EL3 baremetal code by:
  16. - putting the system into a known architectural state;
  17. - taking care of platform secure world initialization;
  18. - loading the SCP_BL2 image if required by the platform.
  19. When booting an EL3 payload on Arm standard platforms, the configuration of the
  20. TrustZone controller is simplified such that only region 0 is enabled and is
  21. configured to permit secure access only. This gives full access to the whole
  22. DRAM to the EL3 payload.
  23. The system is left in the same state as when entering BL31 in the default boot
  24. flow. In particular:
  25. - Running in EL3;
  26. - Current state is AArch64;
  27. - Little-endian data access;
  28. - All exceptions disabled;
  29. - MMU disabled;
  30. - Caches disabled.
  31. .. _alt_boot_flows_el3_payload:
  32. Booting an EL3 payload
  33. ~~~~~~~~~~~~~~~~~~~~~~
  34. The EL3 payload image is a standalone image and is not part of the FIP. It is
  35. not loaded by TF-A. Therefore, there are 2 possible scenarios:
  36. - The EL3 payload may reside in non-volatile memory (NVM) and execute in
  37. place. In this case, booting it is just a matter of specifying the right
  38. address in NVM through ``EL3_PAYLOAD_BASE`` when building TF-A.
  39. - The EL3 payload needs to be loaded in volatile memory (e.g. DRAM) at
  40. run-time.
  41. To help in the latter scenario, the ``SPIN_ON_BL1_EXIT=1`` build option can be
  42. used. The infinite loop that it introduces in BL1 stops execution at the right
  43. moment for a debugger to take control of the target and load the payload (for
  44. example, over JTAG).
  45. It is expected that this loading method will work in most cases, as a debugger
  46. connection is usually available in a pre-production system. The user is free to
  47. use any other platform-specific mechanism to load the EL3 payload, though.
  48. Preloaded BL33 alternative boot flow
  49. ------------------------------------
  50. Some platforms have the ability to preload BL33 into memory instead of relying
  51. on TF-A to load it. This may simplify packaging of the normal world code and
  52. improve performance in a development environment. When secure world cold boot
  53. is complete, TF-A simply jumps to a BL33 base address provided at build time.
  54. For this option to be used, the ``PRELOADED_BL33_BASE`` build option has to be
  55. used when compiling TF-A. For example, the following command will create a FIP
  56. without a BL33 and prepare to jump to a BL33 image loaded at address
  57. 0x80000000:
  58. .. code:: shell
  59. make PRELOADED_BL33_BASE=0x80000000 PLAT=fvp all fip
  60. --------------
  61. *Copyright (c) 2019, Arm Limited. All rights reserved.*