2019-05-22 11:22:44 +01:00
|
|
|
Allwinner ARMv8 SoCs
|
|
|
|
====================
|
2017-08-12 10:07:39 +01:00
|
|
|
|
|
|
|
Trusted Firmware-A (TF-A) implements the EL3 firmware layer for Allwinner
|
|
|
|
SoCs with ARMv8 cores. Only BL31 is used to provide proper EL3 setup and
|
|
|
|
PSCI runtime services.
|
2018-06-22 00:33:28 +01:00
|
|
|
|
2020-12-11 21:29:31 +00:00
|
|
|
Building TF-A
|
|
|
|
-------------
|
2017-08-12 10:07:39 +01:00
|
|
|
|
2017-12-08 01:27:02 +00:00
|
|
|
To build for machines with an A64 or H5 SoC:
|
2017-08-12 10:07:39 +01:00
|
|
|
|
2019-03-13 15:11:04 +00:00
|
|
|
.. code:: shell
|
2017-08-12 10:07:39 +01:00
|
|
|
|
2020-01-08 20:37:18 +00:00
|
|
|
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_a64 DEBUG=1 bl31
|
2017-08-12 10:07:39 +01:00
|
|
|
|
2017-12-08 01:27:02 +00:00
|
|
|
To build for machines with an H6 SoC:
|
|
|
|
|
2019-03-13 15:11:04 +00:00
|
|
|
.. code:: shell
|
2017-12-08 01:27:02 +00:00
|
|
|
|
2020-01-08 20:37:18 +00:00
|
|
|
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_h6 DEBUG=1 bl31
|
2017-12-08 01:27:02 +00:00
|
|
|
|
2020-11-28 01:39:17 +00:00
|
|
|
To build for machines with an H616 or H313 SoC:
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_h616 DEBUG=1 bl31
|
|
|
|
|
2020-12-11 21:29:31 +00:00
|
|
|
|
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
|
|
|
U-Boot's SPL acts as a loader, loading both BL31 and BL33 (typically U-Boot).
|
|
|
|
Loading is done from SD card, eMMC or SPI flash, also via an USB debug
|
|
|
|
interface (FEL).
|
|
|
|
|
|
|
|
After building bl31.bin, the binary must be fed to the U-Boot build system
|
|
|
|
to include it in the FIT image that the SPL loader will process.
|
|
|
|
bl31.bin can be either copied (or sym-linked) into U-Boot's root directory,
|
|
|
|
or the environment variable BL31 must contain the binary's path.
|
|
|
|
See the respective `U-Boot documentation`_ for more details.
|
|
|
|
|
2020-07-01 12:53:07 +01:00
|
|
|
.. _U-Boot documentation: https://gitlab.denx.de/u-boot/u-boot/-/blob/master/board/sunxi/README.sunxi64
|
2018-06-19 20:14:50 +01:00
|
|
|
|
2020-12-11 21:29:31 +00:00
|
|
|
Memory layout
|
|
|
|
-------------
|
|
|
|
|
|
|
|
A64, H5 and H6 SoCs
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
BL31 lives in SRAM A2, which is documented to be accessible from secure
|
|
|
|
world only. Since this SRAM region is very limited (48 KB), we take
|
|
|
|
several measures to reduce memory consumption. One of them is to confine
|
|
|
|
BL31 to only 28 bits of virtual address space, which reduces the number
|
|
|
|
of required page tables (each occupying 4KB of memory).
|
|
|
|
The mapping we use on those SoCs is as follows:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
0 64K 16M 1GB 1G+160M physical address
|
|
|
|
+-+------+-+---+------+--...---+-------+----+------+----------
|
|
|
|
|B| |S|///| |//...///| |////| |
|
|
|
|
|R| SRAM |C|///| dev |//...///| (sec) |////| BL33 | DRAM ...
|
|
|
|
|O| |P|///| MMIO |//...///| DRAM |////| |
|
|
|
|
|M| | |///| |//...///| (32M) |////| |
|
|
|
|
+-+------+-+---+------+--...---+-------+----+------+----------
|
|
|
|
| | | | | | / / / /
|
|
|
|
| | | | | | / / / /
|
|
|
|
| | | | | | / / / /
|
|
|
|
| | | | | | / // /
|
|
|
|
| | | | | | / / /
|
|
|
|
+-+------+-+---+------+--+-------+------+
|
|
|
|
|B| |S|///| |//| | |
|
|
|
|
|R| SRAM |C|///| dev |//| sec | BL33 |
|
|
|
|
|O| |P|///| MMIO |//| DRAM | |
|
|
|
|
|M| | |///| |//| | |
|
|
|
|
+-+------+-+---+------+--+-------+------+
|
|
|
|
0 64K 16M 160M 192M 256M virtual address
|
|
|
|
|
|
|
|
|
2020-11-28 01:39:17 +00:00
|
|
|
H616 SoC
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
The H616 lacks the secure SRAM region present on the other SoCs, also
|
|
|
|
lacks the "ARISC" management processor (SCP) we use. BL31 thus needs to
|
|
|
|
run from DRAM, which prevents our compressed virtual memory map described
|
|
|
|
above. Since running in DRAM also lifts the restriction of the limited
|
|
|
|
SRAM size, we use the normal 1:1 mapping with 32 bits worth of virtual
|
|
|
|
address space. So the virtual addresses used in BL31 match the physical
|
|
|
|
addresses as presented above.
|
|
|
|
|
2018-06-19 20:14:50 +01:00
|
|
|
Trusted OS dispatcher
|
2019-05-22 11:22:44 +01:00
|
|
|
---------------------
|
2018-06-19 20:14:50 +01:00
|
|
|
|
|
|
|
One can boot Trusted OS(OP-TEE OS, bl32 image) along side bl31 image on Allwinner A64.
|
|
|
|
|
|
|
|
In order to include the 'opteed' dispatcher in the image, pass 'SPD=opteed' on the command line
|
|
|
|
while compiling the bl31 image and make sure the loader (SPL) loads the Trusted OS binary to
|
|
|
|
the beginning of DRAM (0x40000000).
|