qti-msm8916.rst 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. Qualcomm MSM8916
  2. ================
  3. The MSM8916 platform port in TF-A supports multiple similar Qualcomm SoCs:
  4. +-----------------------+----------------+-------------------+-----------------+
  5. | System-on-Chip (SoC) | TF-A Platform | Application CPU | Supports |
  6. +=======================+================+===================+=================+
  7. | `Snapdragon 410`_ |``PLAT=msm8916``| 4x ARM Cortex-A53 | AArch64/AArch32 |
  8. | (MSM8x16, APQ8016(E)) | | | |
  9. | (`DragonBoard 410c`_) | | | |
  10. +-----------------------+----------------+-------------------+-----------------+
  11. | `Snapdragon 615`_ |``PLAT=msm8939``| 4x ARM Cortex-A53 | AArch64/AArch32 |
  12. | (MSM8x39, APQ8039) | | 4x ARM Cortex-A53 | |
  13. +-----------------------+----------------+-------------------+-----------------+
  14. | `Snapdragon 210`_ |``PLAT=msm8909``| 4x ARM Cortex-A7 | AArch32 only |
  15. | (MSM8x09, APQ8009) | | | |
  16. +-----------------------+----------------+-------------------+-----------------+
  17. | `Snapdragon X5 Modem`_|``PLAT=mdm9607``| 1x ARM Cortex-A7 | AArch32 only |
  18. | (MDM9x07) | | | |
  19. +-----------------------+----------------+-------------------+-----------------+
  20. It provides a minimal, community-maintained EL3 firmware and PSCI implementation,
  21. based on information from the public `Snapdragon 410E Technical Reference Manual`_
  22. combined with a lot of trial and error to actually make it work.
  23. .. note::
  24. Unlike the :doc:`QTI SC7180/SC7280 <qti>` ports, this port does **not**
  25. make use of a proprietary binary components (QTISECLIB). It is fully
  26. open-source but therefore limited to publicly documented hardware
  27. components.
  28. Functionality
  29. -------------
  30. The TF-A port is much more minimal compared to the original firmware and
  31. therefore expects the non-secure world (e.g. Linux) to manage more hardware,
  32. such as the SMMUs and all remote processors (RPM, WCNSS, Venus, Modem).
  33. Everything except modem is currently functional with a slightly modified version
  34. of mainline Linux.
  35. .. warning::
  36. This port is **not secure**. There is no special secure memory and the
  37. used DRAM is available from both the non-secure and secure worlds.
  38. Unfortunately, the hardware used for memory protection is not described
  39. in the APQ8016E documentation.
  40. The port is primarily intended as a minimal PSCI implementation (without a
  41. separate secure world) where this limitation is not a big problem. Booting
  42. secondary CPU cores (PSCI ``CPU_ON``) is supported. Basic CPU core power
  43. management (``CPU_SUSPEND``) is functional but still work-in-progress and
  44. will be added later once ready.
  45. Boot Flow
  46. ---------
  47. BL31 (AArch64) or BL32/SP_MIN (AArch32) replaces the original ``tz`` firmware
  48. in the boot flow::
  49. Boot ROM (PBL) -> SBL -> BL31 (EL3) -> U-Boot (EL2) -> Linux (EL2)
  50. After initialization the normal world starts at a fixed entry address in EL2/HYP
  51. mode, configured using ``PRELOADED_BL33_BASE``. At runtime, it is expected that
  52. the normal world bootloader was already loaded into RAM by a previous firmware
  53. component (usually SBL) and that it is capable of running in EL2/HYP mode.
  54. `U-Boot for DragonBoard 410c`_ is recommended if possible. The original Little
  55. Kernel-based bootloader from Qualcomm does not support EL2/HYP, but can be
  56. booted using an additional shim loader such as `tfalkstub`_.
  57. Build
  58. -----
  59. It is possible to build for either AArch64 or AArch32. Some platforms use 32-bit
  60. CPUs that only support AArch32 (see table above). For all others AArch64 is the
  61. preferred build option.
  62. AArch64 (BL31)
  63. ^^^^^^^^^^^^^^
  64. Setup the cross compiler for AArch64 and build BL31 for one of the platforms in
  65. the table above::
  66. $ make CROSS_COMPILE=aarch64-none-elf- PLAT=...
  67. The BL31 ELF image is generated in ``build/$PLAT/release/bl31/bl31.elf``.
  68. AArch32 (BL32/SP_MIN)
  69. ^^^^^^^^^^^^^^^^^^^^^
  70. Setup the cross compiler for AArch32 and build BL32 with SP_MIN for one of the
  71. platforms in the table above::
  72. $ make CROSS_COMPILE=arm-none-eabi- PLAT=... ARCH=aarch32 AARCH32_SP=sp_min
  73. The BL32 ELF image is generated in ``build/$PLAT/release/bl32/bl32.elf``.
  74. Build Options
  75. -------------
  76. Some options can be changed at build time by adding them to the make command line:
  77. * ``QTI_UART_NUM``: Number of UART controller to use for debug output and crash
  78. reports. This must be the same UART as used by earlier boot firmware since
  79. the UART controller does not get fully initialized at the moment. Defaults to
  80. the usual debug UART used for the platform (see ``platform.mk``).
  81. * ``QTI_RUNTIME_UART``: By default (``0``) the UART is only used for the boot
  82. process and critical crashes. If set to ``1`` it is also used for runtime
  83. messages. Note that this option can only be used if the UART is reserved in
  84. the normal world and the necessary clocks remain enabled.
  85. The memory region used for the different firmware components is not fixed and
  86. can be changed on the make command line. The default values match the addresses
  87. used by the original firmware (see ``platform.mk``):
  88. * ``PRELOADED_BL33_BASE``: The entry address for the normal world. Usually
  89. refers to the first bootloader (e.g. U-Boot).
  90. * ``BL31_BASE``: Base address for the BL31 firmware component. Must point to
  91. a 64K-aligned memory region with at least 128 KiB space that is permanently
  92. reserved in the normal world.
  93. * ``BL32_BASE``: Base address for the BL32 firmware component.
  94. * **AArch32:** BL32 is used in place of BL31, so the option is equivalent to
  95. ``BL31_BASE``.
  96. * **AArch64:** Secure-EL1 Payload. Defaults to using 128 KiB of space
  97. directly after BL31. For testing only, the port is primarily intended as
  98. a minimal PSCI implementation without a separate secure world.
  99. Installation
  100. ------------
  101. The ELF image must be "signed" before flashing it, even if the board has secure
  102. boot disabled. In this case the signature does not provide any security,
  103. but it provides the firmware with required metadata.
  104. The `DragonBoard 410c`_ does not have secure boot enabled by default. In this
  105. case you can simply sign the ELF image using a randomly generated key. You can
  106. use e.g. `qtestsign`_::
  107. $ ./qtestsign.py tz build/msm8916/release/bl31/bl31.elf
  108. Then install the resulting ``build/msm8916/release/bl31/bl31-test-signed.mbn``
  109. to the ``tz`` partition on the device. BL31 should be running after a reboot.
  110. .. note::
  111. On AArch32 the ELF image is called ``bl32.elf``.
  112. The installation procedure is identical.
  113. .. warning::
  114. Do not flash incorrectly signed firmware on devices that have secure
  115. boot enabled! Make sure that you have a way to recover the board in case
  116. of problems (e.g. using EDL).
  117. Boot Trace
  118. ----------
  119. AArch64 (BL31)
  120. ^^^^^^^^^^^^^^
  121. BL31 prints some lines on the debug console, which will usually look like this
  122. (with ``DEBUG=1``, otherwise only the ``NOTICE`` lines are shown)::
  123. ...
  124. S - DDR Frequency, 400 MHz
  125. NOTICE: BL31: v2.6(debug):v2.6
  126. NOTICE: BL31: Built : 20:00:00, Dec 01 2021
  127. INFO: BL31: Platform setup start
  128. INFO: ARM GICv2 driver initialized
  129. INFO: BL31: Platform setup done
  130. INFO: BL31: Initializing runtime services
  131. INFO: BL31: cortex_a53: CPU workaround for 819472 was applied
  132. INFO: BL31: cortex_a53: CPU workaround for 824069 was applied
  133. INFO: BL31: cortex_a53: CPU workaround for 826319 was applied
  134. INFO: BL31: cortex_a53: CPU workaround for 827319 was applied
  135. INFO: BL31: cortex_a53: CPU workaround for 835769 was applied
  136. INFO: BL31: cortex_a53: CPU workaround for disable_non_temporal_hint was applied
  137. INFO: BL31: cortex_a53: CPU workaround for 843419 was applied
  138. INFO: BL31: cortex_a53: CPU workaround for 1530924 was applied
  139. INFO: BL31: Preparing for EL3 exit to normal world
  140. INFO: Entry point address = 0x8f600000
  141. INFO: SPSR = 0x3c9
  142. U-Boot 2021.10 (Dec 01 2021 - 20:00:00 +0000)
  143. Qualcomm-DragonBoard 410C
  144. ...
  145. AArch32 (BL32/SP_MIN)
  146. ^^^^^^^^^^^^^^^^^^^^^
  147. BL32/SP_MIN prints some lines on the debug console, which will usually look like
  148. this (with ``DEBUG=1``, otherwise only the ``NOTICE`` lines are shown)::
  149. ...
  150. S - DDR Frequency, 400 MHz
  151. NOTICE: SP_MIN: v2.8(debug):v2.8
  152. NOTICE: SP_MIN: Built : 23:03:31, Mar 31 2023
  153. INFO: SP_MIN: Platform setup start
  154. INFO: ARM GICv2 driver initialized
  155. INFO: SP_MIN: Platform setup done
  156. INFO: SP_MIN: Initializing runtime services
  157. INFO: BL32: cortex_a53: CPU workaround for 819472 was applied
  158. INFO: BL32: cortex_a53: CPU workaround for 824069 was applied
  159. INFO: BL32: cortex_a53: CPU workaround for 826319 was applied
  160. INFO: BL32: cortex_a53: CPU workaround for 827319 was applied
  161. INFO: BL32: cortex_a53: CPU workaround for disable_non_temporal_hint was applied
  162. INFO: SP_MIN: Preparing exit to normal world
  163. INFO: Entry point address = 0x86400000
  164. INFO: SPSR = 0x1da
  165. Android Bootloader - UART_DM Initialized!!!
  166. [0] welcome to lk
  167. ...
  168. .. _Snapdragon 210: https://www.qualcomm.com/products/snapdragon-processors-210
  169. .. _Snapdragon 410: https://www.qualcomm.com/products/snapdragon-processors-410
  170. .. _Snapdragon 615: https://www.qualcomm.com/products/snapdragon-processors-615
  171. .. _Snapdragon X5 Modem: https://www.qualcomm.com/products/snapdragon-modems-4g-lte-x5
  172. .. _DragonBoard 410c: https://www.96boards.org/product/dragonboard410c/
  173. .. _Snapdragon 410E Technical Reference Manual: https://developer.qualcomm.com/download/sd410/snapdragon-410e-technical-reference-manual.pdf
  174. .. _U-Boot for DragonBoard 410c: https://u-boot.readthedocs.io/en/latest/board/qualcomm/dragonboard410c.html
  175. .. _qtestsign: https://github.com/msm8916-mainline/qtestsign
  176. .. _tfalkstub: https://github.com/msm8916-mainline/tfalkstub