xref: /arm-trusted-firmware/docs/components/secure-partition-manager.rst (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700SchasingluluSecure Partition Manager
2*91f16700Schasinglulu************************
3*91f16700Schasinglulu
4*91f16700Schasinglulu.. contents::
5*91f16700Schasinglulu
6*91f16700Schasinglulu.. toctree::
7*91f16700Schasinglulu  ffa-manifest-binding
8*91f16700Schasinglulu
9*91f16700SchasingluluAcronyms
10*91f16700Schasinglulu========
11*91f16700Schasinglulu
12*91f16700Schasinglulu+--------+--------------------------------------+
13*91f16700Schasinglulu| CoT    | Chain of Trust                       |
14*91f16700Schasinglulu+--------+--------------------------------------+
15*91f16700Schasinglulu| DMA    | Direct Memory Access                 |
16*91f16700Schasinglulu+--------+--------------------------------------+
17*91f16700Schasinglulu| DTB    | Device Tree Blob                     |
18*91f16700Schasinglulu+--------+--------------------------------------+
19*91f16700Schasinglulu| DTS    | Device Tree Source                   |
20*91f16700Schasinglulu+--------+--------------------------------------+
21*91f16700Schasinglulu| EC     | Execution Context                    |
22*91f16700Schasinglulu+--------+--------------------------------------+
23*91f16700Schasinglulu| FIP    | Firmware Image Package               |
24*91f16700Schasinglulu+--------+--------------------------------------+
25*91f16700Schasinglulu| FF-A   | Firmware Framework for Arm A-profile |
26*91f16700Schasinglulu+--------+--------------------------------------+
27*91f16700Schasinglulu| IPA    | Intermediate Physical Address        |
28*91f16700Schasinglulu+--------+--------------------------------------+
29*91f16700Schasinglulu| JOP    | Jump-Oriented Programming            |
30*91f16700Schasinglulu+--------+--------------------------------------+
31*91f16700Schasinglulu| NWd    | Normal World                         |
32*91f16700Schasinglulu+--------+--------------------------------------+
33*91f16700Schasinglulu| ODM    | Original Design Manufacturer         |
34*91f16700Schasinglulu+--------+--------------------------------------+
35*91f16700Schasinglulu| OEM    | Original Equipment Manufacturer      |
36*91f16700Schasinglulu+--------+--------------------------------------+
37*91f16700Schasinglulu| PA     | Physical Address                     |
38*91f16700Schasinglulu+--------+--------------------------------------+
39*91f16700Schasinglulu| PE     | Processing Element                   |
40*91f16700Schasinglulu+--------+--------------------------------------+
41*91f16700Schasinglulu| PM     | Power Management                     |
42*91f16700Schasinglulu+--------+--------------------------------------+
43*91f16700Schasinglulu| PVM    | Primary VM                           |
44*91f16700Schasinglulu+--------+--------------------------------------+
45*91f16700Schasinglulu| ROP    | Return-Oriented Programming          |
46*91f16700Schasinglulu+--------+--------------------------------------+
47*91f16700Schasinglulu| SMMU   | System Memory Management Unit        |
48*91f16700Schasinglulu+--------+--------------------------------------+
49*91f16700Schasinglulu| SP     | Secure Partition                     |
50*91f16700Schasinglulu+--------+--------------------------------------+
51*91f16700Schasinglulu| SPD    | Secure Payload Dispatcher            |
52*91f16700Schasinglulu+--------+--------------------------------------+
53*91f16700Schasinglulu| SPM    | Secure Partition Manager             |
54*91f16700Schasinglulu+--------+--------------------------------------+
55*91f16700Schasinglulu| SPMC   | SPM Core                             |
56*91f16700Schasinglulu+--------+--------------------------------------+
57*91f16700Schasinglulu| SPMD   | SPM Dispatcher                       |
58*91f16700Schasinglulu+--------+--------------------------------------+
59*91f16700Schasinglulu| SiP    | Silicon Provider                     |
60*91f16700Schasinglulu+--------+--------------------------------------+
61*91f16700Schasinglulu| SWd    | Secure World                         |
62*91f16700Schasinglulu+--------+--------------------------------------+
63*91f16700Schasinglulu| TLV    | Tag-Length-Value                     |
64*91f16700Schasinglulu+--------+--------------------------------------+
65*91f16700Schasinglulu| TOS    | Trusted Operating System             |
66*91f16700Schasinglulu+--------+--------------------------------------+
67*91f16700Schasinglulu| VM     | Virtual Machine                      |
68*91f16700Schasinglulu+--------+--------------------------------------+
69*91f16700Schasinglulu
70*91f16700SchasingluluForeword
71*91f16700Schasinglulu========
72*91f16700Schasinglulu
73*91f16700SchasingluluThree implementations of a Secure Partition Manager co-exist in the TF-A
74*91f16700Schasinglulucodebase:
75*91f16700Schasinglulu
76*91f16700Schasinglulu#. S-EL2 SPMC based on the FF-A specification `[1]`_, enabling virtualization in
77*91f16700Schasinglulu   the secure world, managing multiple S-EL1 or S-EL0 partitions.
78*91f16700Schasinglulu#. EL3 SPMC based on the FF-A specification, managing a single S-EL1 partition
79*91f16700Schasinglulu   without virtualization in the secure world.
80*91f16700Schasinglulu#. EL3 SPM based on the MM specification, legacy implementation managing a
81*91f16700Schasinglulu   single S-EL0 partition `[2]`_.
82*91f16700Schasinglulu
83*91f16700SchasingluluThese implementations differ in their respective SW architecture and only one
84*91f16700Schasinglulucan be selected at build time. This document:
85*91f16700Schasinglulu
86*91f16700Schasinglulu- describes the implementation from bullet 1. when the SPMC resides at S-EL2.
87*91f16700Schasinglulu- is not an architecture specification and it might provide assumptions
88*91f16700Schasinglulu  on sections mandated as implementation-defined in the specification.
89*91f16700Schasinglulu- covers the implications to TF-A used as a bootloader, and Hafnium used as a
90*91f16700Schasinglulu  reference code base for an S-EL2/SPMC secure firmware on platforms
91*91f16700Schasinglulu  implementing the FEAT_SEL2 architecture extension.
92*91f16700Schasinglulu
93*91f16700SchasingluluTerminology
94*91f16700Schasinglulu-----------
95*91f16700Schasinglulu
96*91f16700Schasinglulu- The term Hypervisor refers to the NS-EL2 component managing Virtual Machines
97*91f16700Schasinglulu  (or partitions) in the normal world.
98*91f16700Schasinglulu- The term SPMC refers to the S-EL2 component managing secure partitions in
99*91f16700Schasinglulu  the secure world when the FEAT_SEL2 architecture extension is implemented.
100*91f16700Schasinglulu- Alternatively, SPMC can refer to an S-EL1 component, itself being a secure
101*91f16700Schasinglulu  partition and implementing the FF-A ABI on platforms not implementing the
102*91f16700Schasinglulu  FEAT_SEL2 architecture extension.
103*91f16700Schasinglulu- The term VM refers to a normal world Virtual Machine managed by an Hypervisor.
104*91f16700Schasinglulu- The term SP refers to a secure world "Virtual Machine" managed by an SPMC.
105*91f16700Schasinglulu
106*91f16700SchasingluluSupport for legacy platforms
107*91f16700Schasinglulu----------------------------
108*91f16700Schasinglulu
109*91f16700SchasingluluThe SPM is split into a dispatcher and a core component (respectively SPMD and
110*91f16700SchasingluluSPMC) residing at different exception levels. To permit the FF-A specification
111*91f16700Schasingluluadoption and a smooth migration, the SPMD supports an SPMC residing either at
112*91f16700SchasingluluS-EL1 or S-EL2:
113*91f16700Schasinglulu
114*91f16700Schasinglulu- The SPMD is located at EL3 and mainly relays the FF-A protocol from NWd
115*91f16700Schasinglulu  (Hypervisor or OS kernel) to the SPMC.
116*91f16700Schasinglulu- The same SPMD component is used for both S-EL1 and S-EL2 SPMC configurations.
117*91f16700Schasinglulu- The SPMC exception level is a build time choice.
118*91f16700Schasinglulu
119*91f16700SchasingluluTF-A supports both cases:
120*91f16700Schasinglulu
121*91f16700Schasinglulu- S-EL1 SPMC for platforms not supporting the FEAT_SEL2 architecture
122*91f16700Schasinglulu  extension. The SPMD relays the FF-A protocol from EL3 to S-EL1.
123*91f16700Schasinglulu- S-EL2 SPMC for platforms implementing the FEAT_SEL2 architecture
124*91f16700Schasinglulu  extension. The SPMD relays the FF-A protocol from EL3 to S-EL2.
125*91f16700Schasinglulu
126*91f16700SchasingluluSample reference stack
127*91f16700Schasinglulu======================
128*91f16700Schasinglulu
129*91f16700SchasingluluThe following diagram illustrates a possible configuration when the
130*91f16700SchasingluluFEAT_SEL2 architecture extension is implemented, showing the SPMD
131*91f16700Schasingluluand SPMC, one or multiple secure partitions, with an optional
132*91f16700SchasingluluHypervisor:
133*91f16700Schasinglulu
134*91f16700Schasinglulu.. image:: ../resources/diagrams/ff-a-spm-sel2.png
135*91f16700Schasinglulu
136*91f16700SchasingluluTF-A build options
137*91f16700Schasinglulu==================
138*91f16700Schasinglulu
139*91f16700SchasingluluThis section explains the TF-A build options involved in building with
140*91f16700Schasinglulusupport for an FF-A based SPM where the SPMD is located at EL3 and the
141*91f16700SchasingluluSPMC located at S-EL1, S-EL2 or EL3:
142*91f16700Schasinglulu
143*91f16700Schasinglulu- **SPD=spmd**: this option selects the SPMD component to relay the FF-A
144*91f16700Schasinglulu  protocol from NWd to SWd back and forth. It is not possible to
145*91f16700Schasinglulu  enable another Secure Payload Dispatcher when this option is chosen.
146*91f16700Schasinglulu- **SPMD_SPM_AT_SEL2**: this option adjusts the SPMC exception
147*91f16700Schasinglulu  level to being at S-EL2. It defaults to enabled (value 1) when
148*91f16700Schasinglulu  SPD=spmd is chosen.
149*91f16700Schasinglulu- **SPMC_AT_EL3**: this option adjusts the SPMC exception level to being
150*91f16700Schasinglulu  at EL3.
151*91f16700Schasinglulu- If neither ``SPMD_SPM_AT_SEL2`` or ``SPMC_AT_EL3`` are enabled the SPMC
152*91f16700Schasinglulu  exception level is set to S-EL1.
153*91f16700Schasinglulu  ``SPMD_SPM_AT_SEL2`` is enabled. The context save/restore routine
154*91f16700Schasinglulu  and exhaustive list of registers is visible at `[4]`_.
155*91f16700Schasinglulu- **SPMC_AT_EL3_SEL0_SP**: this option enables the support to load SEL0 SP
156*91f16700Schasinglulu  when SPMC at EL3 support is enabled.
157*91f16700Schasinglulu- **SP_LAYOUT_FILE**: this option specifies a text description file
158*91f16700Schasinglulu  providing paths to SP binary images and manifests in DTS format
159*91f16700Schasinglulu  (see `Describing secure partitions`_). It
160*91f16700Schasinglulu  is required when ``SPMD_SPM_AT_SEL2`` is enabled hence when multiple
161*91f16700Schasinglulu  secure partitions are to be loaded by BL2 on behalf of the SPMC.
162*91f16700Schasinglulu
163*91f16700Schasinglulu+---------------+------------------+-------------+-------------------------+
164*91f16700Schasinglulu|               | SPMD_SPM_AT_SEL2 | SPMC_AT_EL3 | CTX_INCLUDE_EL2_REGS(*) |
165*91f16700Schasinglulu+---------------+------------------+-------------+-------------------------+
166*91f16700Schasinglulu| SPMC at S-EL1 |        0         |      0      |             0           |
167*91f16700Schasinglulu+---------------+------------------+-------------+-------------------------+
168*91f16700Schasinglulu| SPMC at S-EL2 | 1 (default when  |      0      |             1           |
169*91f16700Schasinglulu|               |    SPD=spmd)     |             |                         |
170*91f16700Schasinglulu+---------------+------------------+-------------+-------------------------+
171*91f16700Schasinglulu| SPMC at EL3   |        0         |      1      |             0           |
172*91f16700Schasinglulu+---------------+------------------+-------------+-------------------------+
173*91f16700Schasinglulu
174*91f16700SchasingluluOther combinations of such build options either break the build or are not
175*91f16700Schasinglulusupported.
176*91f16700Schasinglulu
177*91f16700SchasingluluNotes:
178*91f16700Schasinglulu
179*91f16700Schasinglulu- Only Arm's FVP platform is supported to use with the TF-A reference software
180*91f16700Schasinglulu  stack.
181*91f16700Schasinglulu- When ``SPMD_SPM_AT_SEL2=1``, the reference software stack assumes enablement
182*91f16700Schasinglulu  of FEAT_PAuth, FEAT_BTI and FEAT_MTE architecture extensions.
183*91f16700Schasinglulu- ``(*) CTX_INCLUDE_EL2_REGS``, this flag is |TF-A| internal and informational
184*91f16700Schasinglulu  in this table. When set, it provides the generic support for saving/restoring
185*91f16700Schasinglulu  EL2 registers required when S-EL2 firmware is present.
186*91f16700Schasinglulu- BL32 option is re-purposed to specify the SPMC image. It can specify either
187*91f16700Schasinglulu  the Hafnium binary path (built for the secure world) or the path to a TEE
188*91f16700Schasinglulu  binary implementing FF-A interfaces.
189*91f16700Schasinglulu- BL33 option can specify the TFTF binary or a normal world loader
190*91f16700Schasinglulu  such as U-Boot or the UEFI framework payload.
191*91f16700Schasinglulu
192*91f16700SchasingluluSample TF-A build command line when the SPMC is located at S-EL1
193*91f16700Schasinglulu(e.g. when the FEAT_SEL2 architecture extension is not implemented):
194*91f16700Schasinglulu
195*91f16700Schasinglulu.. code:: shell
196*91f16700Schasinglulu
197*91f16700Schasinglulu    make \
198*91f16700Schasinglulu    CROSS_COMPILE=aarch64-none-elf- \
199*91f16700Schasinglulu    SPD=spmd \
200*91f16700Schasinglulu    SPMD_SPM_AT_SEL2=0 \
201*91f16700Schasinglulu    BL32=<path-to-tee-binary> \
202*91f16700Schasinglulu    BL33=<path-to-bl33-binary> \
203*91f16700Schasinglulu    PLAT=fvp \
204*91f16700Schasinglulu    all fip
205*91f16700Schasinglulu
206*91f16700SchasingluluSample TF-A build command line when FEAT_SEL2 architecture extension is
207*91f16700Schasingluluimplemented and the SPMC is located at S-EL2:
208*91f16700Schasinglulu
209*91f16700Schasinglulu.. code:: shell
210*91f16700Schasinglulu
211*91f16700Schasinglulu    make \
212*91f16700Schasinglulu    CROSS_COMPILE=aarch64-none-elf- \
213*91f16700Schasinglulu    PLAT=fvp \
214*91f16700Schasinglulu    SPD=spmd \
215*91f16700Schasinglulu    ARM_ARCH_MINOR=5 \
216*91f16700Schasinglulu    BRANCH_PROTECTION=1 \
217*91f16700Schasinglulu    CTX_INCLUDE_PAUTH_REGS=1 \
218*91f16700Schasinglulu    CTX_INCLUDE_MTE_REGS=1 \
219*91f16700Schasinglulu    BL32=<path-to-hafnium-binary> \
220*91f16700Schasinglulu    BL33=<path-to-bl33-binary> \
221*91f16700Schasinglulu    SP_LAYOUT_FILE=sp_layout.json \
222*91f16700Schasinglulu    all fip
223*91f16700Schasinglulu
224*91f16700SchasingluluSample TF-A build command line when FEAT_SEL2 architecture extension is
225*91f16700Schasingluluimplemented, the SPMC is located at S-EL2, and enabling secure boot:
226*91f16700Schasinglulu
227*91f16700Schasinglulu.. code:: shell
228*91f16700Schasinglulu
229*91f16700Schasinglulu    make \
230*91f16700Schasinglulu    CROSS_COMPILE=aarch64-none-elf- \
231*91f16700Schasinglulu    PLAT=fvp \
232*91f16700Schasinglulu    SPD=spmd \
233*91f16700Schasinglulu    ARM_ARCH_MINOR=5 \
234*91f16700Schasinglulu    BRANCH_PROTECTION=1 \
235*91f16700Schasinglulu    CTX_INCLUDE_PAUTH_REGS=1 \
236*91f16700Schasinglulu    CTX_INCLUDE_MTE_REGS=1 \
237*91f16700Schasinglulu    BL32=<path-to-hafnium-binary> \
238*91f16700Schasinglulu    BL33=<path-to-bl33-binary> \
239*91f16700Schasinglulu    SP_LAYOUT_FILE=sp_layout.json \
240*91f16700Schasinglulu    MBEDTLS_DIR=<path-to-mbedtls-lib> \
241*91f16700Schasinglulu    TRUSTED_BOARD_BOOT=1 \
242*91f16700Schasinglulu    COT=dualroot \
243*91f16700Schasinglulu    ARM_ROTPK_LOCATION=devel_rsa \
244*91f16700Schasinglulu    ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem \
245*91f16700Schasinglulu    GENERATE_COT=1 \
246*91f16700Schasinglulu    all fip
247*91f16700Schasinglulu
248*91f16700SchasingluluSample TF-A build command line when the SPMC is located at EL3:
249*91f16700Schasinglulu
250*91f16700Schasinglulu.. code:: shell
251*91f16700Schasinglulu
252*91f16700Schasinglulu    make \
253*91f16700Schasinglulu    CROSS_COMPILE=aarch64-none-elf- \
254*91f16700Schasinglulu    SPD=spmd \
255*91f16700Schasinglulu    SPMD_SPM_AT_SEL2=0 \
256*91f16700Schasinglulu    SPMC_AT_EL3=1 \
257*91f16700Schasinglulu    BL32=<path-to-tee-binary> \
258*91f16700Schasinglulu    BL33=<path-to-bl33-binary> \
259*91f16700Schasinglulu    PLAT=fvp \
260*91f16700Schasinglulu    all fip
261*91f16700Schasinglulu
262*91f16700SchasingluluSample TF-A build command line when the SPMC is located at EL3 and SEL0 SP is
263*91f16700Schasingluluenabled:
264*91f16700Schasinglulu
265*91f16700Schasinglulu.. code:: shell
266*91f16700Schasinglulu
267*91f16700Schasinglulu    make \
268*91f16700Schasinglulu    CROSS_COMPILE=aarch64-none-elf- \
269*91f16700Schasinglulu    SPD=spmd \
270*91f16700Schasinglulu    SPMD_SPM_AT_SEL2=0 \
271*91f16700Schasinglulu    SPMC_AT_EL3=1 \
272*91f16700Schasinglulu    SPMC_AT_EL3_SEL0_SP=1 \
273*91f16700Schasinglulu    BL32=<path-to-tee-binary> \
274*91f16700Schasinglulu    BL33=<path-to-bl33-binary> \
275*91f16700Schasinglulu    PLAT=fvp \
276*91f16700Schasinglulu    all fip
277*91f16700Schasinglulu
278*91f16700SchasingluluFVP model invocation
279*91f16700Schasinglulu====================
280*91f16700Schasinglulu
281*91f16700SchasingluluThe FVP command line needs the following options to exercise the S-EL2 SPMC:
282*91f16700Schasinglulu
283*91f16700Schasinglulu+---------------------------------------------------+------------------------------------+
284*91f16700Schasinglulu| - cluster0.has_arm_v8-5=1                         | Implements FEAT_SEL2, FEAT_PAuth,  |
285*91f16700Schasinglulu| - cluster1.has_arm_v8-5=1                         | and FEAT_BTI.                      |
286*91f16700Schasinglulu+---------------------------------------------------+------------------------------------+
287*91f16700Schasinglulu| - pci.pci_smmuv3.mmu.SMMU_AIDR=2                  | Parameters required for the        |
288*91f16700Schasinglulu| - pci.pci_smmuv3.mmu.SMMU_IDR0=0x0046123B         | SMMUv3.2 modeling.                 |
289*91f16700Schasinglulu| - pci.pci_smmuv3.mmu.SMMU_IDR1=0x00600002         |                                    |
290*91f16700Schasinglulu| - pci.pci_smmuv3.mmu.SMMU_IDR3=0x1714             |                                    |
291*91f16700Schasinglulu| - pci.pci_smmuv3.mmu.SMMU_IDR5=0xFFFF0472         |                                    |
292*91f16700Schasinglulu| - pci.pci_smmuv3.mmu.SMMU_S_IDR1=0xA0000002       |                                    |
293*91f16700Schasinglulu| - pci.pci_smmuv3.mmu.SMMU_S_IDR2=0                |                                    |
294*91f16700Schasinglulu| - pci.pci_smmuv3.mmu.SMMU_S_IDR3=0                |                                    |
295*91f16700Schasinglulu+---------------------------------------------------+------------------------------------+
296*91f16700Schasinglulu| - cluster0.has_branch_target_exception=1          | Implements FEAT_BTI.               |
297*91f16700Schasinglulu| - cluster1.has_branch_target_exception=1          |                                    |
298*91f16700Schasinglulu+---------------------------------------------------+------------------------------------+
299*91f16700Schasinglulu| - cluster0.has_pointer_authentication=2           | Implements FEAT_PAuth              |
300*91f16700Schasinglulu| - cluster1.has_pointer_authentication=2           |                                    |
301*91f16700Schasinglulu+---------------------------------------------------+------------------------------------+
302*91f16700Schasinglulu| - cluster0.memory_tagging_support_level=2         | Implements FEAT_MTE2               |
303*91f16700Schasinglulu| - cluster1.memory_tagging_support_level=2         |                                    |
304*91f16700Schasinglulu| - bp.dram_metadata.is_enabled=1                   |                                    |
305*91f16700Schasinglulu+---------------------------------------------------+------------------------------------+
306*91f16700Schasinglulu
307*91f16700SchasingluluSample FVP command line invocation:
308*91f16700Schasinglulu
309*91f16700Schasinglulu.. code:: shell
310*91f16700Schasinglulu
311*91f16700Schasinglulu    <path-to-fvp-model>/FVP_Base_RevC-2xAEMvA -C pctl.startup=0.0.0.0 \
312*91f16700Schasinglulu    -C cluster0.NUM_CORES=4 -C cluster1.NUM_CORES=4 -C bp.secure_memory=1 \
313*91f16700Schasinglulu    -C bp.secureflashloader.fname=trusted-firmware-a/build/fvp/debug/bl1.bin \
314*91f16700Schasinglulu    -C bp.flashloader0.fname=trusted-firmware-a/build/fvp/debug/fip.bin \
315*91f16700Schasinglulu    -C bp.pl011_uart0.out_file=fvp-uart0.log -C bp.pl011_uart1.out_file=fvp-uart1.log \
316*91f16700Schasinglulu    -C bp.pl011_uart2.out_file=fvp-uart2.log \
317*91f16700Schasinglulu    -C cluster0.has_arm_v8-5=1 -C cluster1.has_arm_v8-5=1 \
318*91f16700Schasinglulu    -C cluster0.has_pointer_authentication=2 -C cluster1.has_pointer_authentication=2 \
319*91f16700Schasinglulu    -C cluster0.has_branch_target_exception=1 -C cluster1.has_branch_target_exception=1 \
320*91f16700Schasinglulu    -C cluster0.memory_tagging_support_level=2 -C cluster1.memory_tagging_support_level=2 \
321*91f16700Schasinglulu    -C bp.dram_metadata.is_enabled=1 \
322*91f16700Schasinglulu    -C pci.pci_smmuv3.mmu.SMMU_AIDR=2 -C pci.pci_smmuv3.mmu.SMMU_IDR0=0x0046123B \
323*91f16700Schasinglulu    -C pci.pci_smmuv3.mmu.SMMU_IDR1=0x00600002 -C pci.pci_smmuv3.mmu.SMMU_IDR3=0x1714 \
324*91f16700Schasinglulu    -C pci.pci_smmuv3.mmu.SMMU_IDR5=0xFFFF0472 -C pci.pci_smmuv3.mmu.SMMU_S_IDR1=0xA0000002 \
325*91f16700Schasinglulu    -C pci.pci_smmuv3.mmu.SMMU_S_IDR2=0 -C pci.pci_smmuv3.mmu.SMMU_S_IDR3=0
326*91f16700Schasinglulu
327*91f16700SchasingluluBoot process
328*91f16700Schasinglulu============
329*91f16700Schasinglulu
330*91f16700SchasingluluLoading Hafnium and secure partitions in the secure world
331*91f16700Schasinglulu---------------------------------------------------------
332*91f16700Schasinglulu
333*91f16700SchasingluluTF-A BL2 is the bootlader for the SPMC and SPs in the secure world.
334*91f16700Schasinglulu
335*91f16700SchasingluluSPs may be signed by different parties (SiP, OEM/ODM, TOS vendor, etc.).
336*91f16700SchasingluluThus they are supplied as distinct signed entities within the FIP flash
337*91f16700Schasingluluimage. The FIP image itself is not signed hence this provides the ability
338*91f16700Schasingluluto upgrade SPs in the field.
339*91f16700Schasinglulu
340*91f16700SchasingluluBooting through TF-A
341*91f16700Schasinglulu--------------------
342*91f16700Schasinglulu
343*91f16700SchasingluluSP manifests
344*91f16700Schasinglulu~~~~~~~~~~~~
345*91f16700Schasinglulu
346*91f16700SchasingluluAn SP manifest describes SP attributes as defined in `[1]`_
347*91f16700Schasinglulu(partition manifest at virtual FF-A instance) in DTS format. It is
348*91f16700Schasinglulurepresented as a single file associated with the SP. A sample is
349*91f16700Schasingluluprovided by `[5]`_. A binding document is provided by `[6]`_.
350*91f16700Schasinglulu
351*91f16700SchasingluluSecure Partition packages
352*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~
353*91f16700Schasinglulu
354*91f16700SchasingluluSecure partitions are bundled as independent package files consisting
355*91f16700Schasingluluof:
356*91f16700Schasinglulu
357*91f16700Schasinglulu- a header
358*91f16700Schasinglulu- a DTB
359*91f16700Schasinglulu- an image payload
360*91f16700Schasinglulu
361*91f16700SchasingluluThe header starts with a magic value and offset values to SP DTB and
362*91f16700Schasingluluimage payload. Each SP package is loaded independently by BL2 loader
363*91f16700Schasingluluand verified for authenticity and integrity.
364*91f16700Schasinglulu
365*91f16700SchasingluluThe SP package identified by its UUID (matching FF-A uuid property) is
366*91f16700Schasingluluinserted as a single entry into the FIP at end of the TF-A build flow
367*91f16700Schasingluluas shown:
368*91f16700Schasinglulu
369*91f16700Schasinglulu.. code:: shell
370*91f16700Schasinglulu
371*91f16700Schasinglulu    Trusted Boot Firmware BL2: offset=0x1F0, size=0x8AE1, cmdline="--tb-fw"
372*91f16700Schasinglulu    EL3 Runtime Firmware BL31: offset=0x8CD1, size=0x13000, cmdline="--soc-fw"
373*91f16700Schasinglulu    Secure Payload BL32 (Trusted OS): offset=0x1BCD1, size=0x15270, cmdline="--tos-fw"
374*91f16700Schasinglulu    Non-Trusted Firmware BL33: offset=0x30F41, size=0x92E0, cmdline="--nt-fw"
375*91f16700Schasinglulu    HW_CONFIG: offset=0x3A221, size=0x2348, cmdline="--hw-config"
376*91f16700Schasinglulu    TB_FW_CONFIG: offset=0x3C569, size=0x37A, cmdline="--tb-fw-config"
377*91f16700Schasinglulu    SOC_FW_CONFIG: offset=0x3C8E3, size=0x48, cmdline="--soc-fw-config"
378*91f16700Schasinglulu    TOS_FW_CONFIG: offset=0x3C92B, size=0x427, cmdline="--tos-fw-config"
379*91f16700Schasinglulu    NT_FW_CONFIG: offset=0x3CD52, size=0x48, cmdline="--nt-fw-config"
380*91f16700Schasinglulu    B4B5671E-4A90-4FE1-B81F-FB13DAE1DACB: offset=0x3CD9A, size=0xC168, cmdline="--blob"
381*91f16700Schasinglulu    D1582309-F023-47B9-827C-4464F5578FC8: offset=0x48F02, size=0xC168, cmdline="--blob"
382*91f16700Schasinglulu
383*91f16700Schasinglulu.. uml:: ../resources/diagrams/plantuml/fip-secure-partitions.puml
384*91f16700Schasinglulu
385*91f16700SchasingluluDescribing secure partitions
386*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~
387*91f16700Schasinglulu
388*91f16700SchasingluluA json-formatted description file is passed to the build flow specifying paths
389*91f16700Schasingluluto the SP binary image and associated DTS partition manifest file. The latter
390*91f16700Schasingluluis processed by the dtc compiler to generate a DTB fed into the SP package.
391*91f16700SchasingluluOptionally, the partition's json description can contain offsets for both
392*91f16700Schasingluluthe image and partition manifest within the SP package. Both offsets need to be
393*91f16700Schasinglulu4KB aligned, because it is the translation granule supported by Hafnium SPMC.
394*91f16700SchasingluluThese fields can be leveraged to support SPs with S1 translation granules that
395*91f16700Schasingluludiffer from 4KB, and to configure the regions allocated within the SP package,
396*91f16700Schasingluluas well as to comply with the requirements for the implementation of the boot
397*91f16700Schasingluluinformation protocol (see `Passing boot data to the SP`_ for more details). In
398*91f16700Schasinglulucase the offsets are absent in their json node, they default to 0x1000 and
399*91f16700Schasinglulu0x4000 for the manifest offset and image offset respectively.
400*91f16700SchasingluluThis file also specifies the SP owner (as an optional field) identifying the
401*91f16700Schasinglulusigning domain in case of dual root CoT.
402*91f16700SchasingluluThe SP owner can either be the silicon or the platform provider. The
403*91f16700Schasinglulucorresponding "owner" field value can either take the value of "SiP" or "Plat".
404*91f16700SchasingluluIn absence of "owner" field, it defaults to "SiP" owner.
405*91f16700SchasingluluThe UUID of the partition can be specified as a field in the description file or
406*91f16700Schasingluluif it does not exist there the UUID is extracted from the DTS partition
407*91f16700Schasinglulumanifest.
408*91f16700Schasinglulu
409*91f16700Schasinglulu.. code:: shell
410*91f16700Schasinglulu
411*91f16700Schasinglulu    {
412*91f16700Schasinglulu        "tee1" : {
413*91f16700Schasinglulu            "image": "tee1.bin",
414*91f16700Schasinglulu             "pm": "tee1.dts",
415*91f16700Schasinglulu             "owner": "SiP",
416*91f16700Schasinglulu             "uuid": "1b1820fe-48f7-4175-8999-d51da00b7c9f"
417*91f16700Schasinglulu        },
418*91f16700Schasinglulu
419*91f16700Schasinglulu        "tee2" : {
420*91f16700Schasinglulu            "image": "tee2.bin",
421*91f16700Schasinglulu            "pm": "tee2.dts",
422*91f16700Schasinglulu            "owner": "Plat"
423*91f16700Schasinglulu        },
424*91f16700Schasinglulu
425*91f16700Schasinglulu        "tee3" : {
426*91f16700Schasinglulu            "image": {
427*91f16700Schasinglulu                "file": "tee3.bin",
428*91f16700Schasinglulu                "offset":"0x2000"
429*91f16700Schasinglulu             },
430*91f16700Schasinglulu            "pm": {
431*91f16700Schasinglulu                "file": "tee3.dts",
432*91f16700Schasinglulu                "offset":"0x6000"
433*91f16700Schasinglulu             },
434*91f16700Schasinglulu            "owner": "Plat"
435*91f16700Schasinglulu        },
436*91f16700Schasinglulu    }
437*91f16700Schasinglulu
438*91f16700SchasingluluSPMC manifest
439*91f16700Schasinglulu~~~~~~~~~~~~~
440*91f16700Schasinglulu
441*91f16700SchasingluluThis manifest contains the SPMC *attribute* node consumed by the SPMD at boot
442*91f16700Schasinglulutime. It implements `[1]`_ (SP manifest at physical FF-A instance) and serves
443*91f16700Schasinglulutwo different cases:
444*91f16700Schasinglulu
445*91f16700Schasinglulu- The SPMC resides at S-EL1: the SPMC manifest is used by the SPMD to setup a
446*91f16700Schasinglulu  SP that co-resides with the SPMC and executes at S-EL1 or Secure Supervisor
447*91f16700Schasinglulu  mode.
448*91f16700Schasinglulu- The SPMC resides at S-EL2: the SPMC manifest is used by the SPMD to setup
449*91f16700Schasinglulu  the environment required by the SPMC to run at S-EL2. SPs run at S-EL1 or
450*91f16700Schasinglulu  S-EL0.
451*91f16700Schasinglulu
452*91f16700Schasinglulu.. code:: shell
453*91f16700Schasinglulu
454*91f16700Schasinglulu    attribute {
455*91f16700Schasinglulu        spmc_id = <0x8000>;
456*91f16700Schasinglulu        maj_ver = <0x1>;
457*91f16700Schasinglulu        min_ver = <0x1>;
458*91f16700Schasinglulu        exec_state = <0x0>;
459*91f16700Schasinglulu        load_address = <0x0 0x6000000>;
460*91f16700Schasinglulu        entrypoint = <0x0 0x6000000>;
461*91f16700Schasinglulu        binary_size = <0x60000>;
462*91f16700Schasinglulu    };
463*91f16700Schasinglulu
464*91f16700Schasinglulu- *spmc_id* defines the endpoint ID value that SPMC can query through
465*91f16700Schasinglulu  ``FFA_ID_GET``.
466*91f16700Schasinglulu- *maj_ver/min_ver*. SPMD checks provided version versus its internal
467*91f16700Schasinglulu  version and aborts if not matching.
468*91f16700Schasinglulu- *exec_state* defines the SPMC execution state (AArch64 or AArch32).
469*91f16700Schasinglulu  Notice Hafnium used as a SPMC only supports AArch64.
470*91f16700Schasinglulu- *load_address* and *binary_size* are mostly used to verify secondary
471*91f16700Schasinglulu  entry points fit into the loaded binary image.
472*91f16700Schasinglulu- *entrypoint* defines the cold boot primary core entry point used by
473*91f16700Schasinglulu  SPMD (currently matches ``BL32_BASE``) to enter the SPMC.
474*91f16700Schasinglulu
475*91f16700SchasingluluOther nodes in the manifest are consumed by Hafnium in the secure world.
476*91f16700SchasingluluA sample can be found at `[7]`_:
477*91f16700Schasinglulu
478*91f16700Schasinglulu- The *hypervisor* node describes SPs. *is_ffa_partition* boolean attribute
479*91f16700Schasinglulu  indicates a FF-A compliant SP. The *load_address* field specifies the load
480*91f16700Schasinglulu  address at which BL2 loaded the SP package.
481*91f16700Schasinglulu- *cpus* node provide the platform topology and allows MPIDR to VMPIDR mapping.
482*91f16700Schasinglulu  Note the primary core is declared first, then secondary cores are declared
483*91f16700Schasinglulu  in reverse order.
484*91f16700Schasinglulu- The *memory* nodes provide platform information on the ranges of memory
485*91f16700Schasinglulu  available for use by SPs at runtime. These ranges relate to either
486*91f16700Schasinglulu  secure or non-secure memory, depending on the *device_type* field.
487*91f16700Schasinglulu  If the field specifies "memory" the range is secure, else if it specifies
488*91f16700Schasinglulu  "ns-memory" the memory is non-secure. The system integrator must exclude
489*91f16700Schasinglulu  the memory used by other components that are not SPs, such as the monitor,
490*91f16700Schasinglulu  or the SPMC itself, the OS Kernel/Hypervisor, or other NWd VMs. The SPMC
491*91f16700Schasinglulu  limits the SP's address space such that they do not access memory outside
492*91f16700Schasinglulu  of those ranges.
493*91f16700Schasinglulu
494*91f16700SchasingluluSPMC boot
495*91f16700Schasinglulu~~~~~~~~~
496*91f16700Schasinglulu
497*91f16700SchasingluluThe SPMC is loaded by BL2 as the BL32 image.
498*91f16700Schasinglulu
499*91f16700SchasingluluThe SPMC manifest is loaded by BL2 as the ``TOS_FW_CONFIG`` image `[9]`_.
500*91f16700Schasinglulu
501*91f16700SchasingluluBL2 passes the SPMC manifest address to BL31 through a register.
502*91f16700Schasinglulu
503*91f16700SchasingluluAt boot time, the SPMD in BL31 runs from the primary core, initializes the core
504*91f16700Schasinglulucontexts and launches the SPMC (BL32) passing the following information through
505*91f16700Schasingluluregisters:
506*91f16700Schasinglulu
507*91f16700Schasinglulu- X0 holds the ``TOS_FW_CONFIG`` physical address (or SPMC manifest blob).
508*91f16700Schasinglulu- X1 holds the ``HW_CONFIG`` physical address.
509*91f16700Schasinglulu- X4 holds the currently running core linear id.
510*91f16700Schasinglulu
511*91f16700SchasingluluLoading of SPs
512*91f16700Schasinglulu~~~~~~~~~~~~~~
513*91f16700Schasinglulu
514*91f16700SchasingluluAt boot time, BL2 loads SPs sequentially in addition to the SPMC as depicted
515*91f16700Schasinglulubelow:
516*91f16700Schasinglulu
517*91f16700Schasinglulu.. uml:: ../resources/diagrams/plantuml/bl2-loading-sp.puml
518*91f16700Schasinglulu
519*91f16700SchasingluluNote this boot flow is an implementation sample on Arm's FVP platform.
520*91f16700SchasingluluPlatforms not using TF-A's *Firmware CONFiguration* framework would adjust to a
521*91f16700Schasingluludifferent boot flow. The flow restricts to a maximum of 8 secure partitions.
522*91f16700Schasinglulu
523*91f16700SchasingluluSecure boot
524*91f16700Schasinglulu~~~~~~~~~~~
525*91f16700Schasinglulu
526*91f16700SchasingluluThe SP content certificate is inserted as a separate FIP item so that BL2 loads SPMC,
527*91f16700SchasingluluSPMC manifest, secure partitions and verifies them for authenticity and integrity.
528*91f16700SchasingluluRefer to TBBR specification `[3]`_.
529*91f16700Schasinglulu
530*91f16700SchasingluluThe multiple-signing domain feature (in current state dual signing domain `[8]`_) allows
531*91f16700Schasingluluthe use of two root keys namely S-ROTPK and NS-ROTPK:
532*91f16700Schasinglulu
533*91f16700Schasinglulu- SPMC (BL32) and SPMC manifest are signed by the SiP using the S-ROTPK.
534*91f16700Schasinglulu- BL33 may be signed by the OEM using NS-ROTPK.
535*91f16700Schasinglulu- An SP may be signed either by SiP (using S-ROTPK) or by OEM (using NS-ROTPK).
536*91f16700Schasinglulu- A maximum of 4 partitions can be signed with the S-ROTPK key and 4 partitions
537*91f16700Schasinglulu  signed with the NS-ROTPK key.
538*91f16700Schasinglulu
539*91f16700SchasingluluAlso refer to `Describing secure partitions`_ and `TF-A build options`_ sections.
540*91f16700Schasinglulu
541*91f16700SchasingluluHafnium in the secure world
542*91f16700Schasinglulu===========================
543*91f16700Schasinglulu
544*91f16700SchasingluluGeneral considerations
545*91f16700Schasinglulu----------------------
546*91f16700Schasinglulu
547*91f16700SchasingluluBuild platform for the secure world
548*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
549*91f16700Schasinglulu
550*91f16700SchasingluluIn the Hafnium reference implementation specific code parts are only relevant to
551*91f16700Schasingluluthe secure world. Such portions are isolated in architecture specific files
552*91f16700Schasingluluand/or enclosed by a ``SECURE_WORLD`` macro.
553*91f16700Schasinglulu
554*91f16700SchasingluluSecure partitions scheduling
555*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~
556*91f16700Schasinglulu
557*91f16700SchasingluluThe FF-A specification `[1]`_ provides two ways to relinquinsh CPU time to
558*91f16700Schasinglulusecure partitions. For this a VM (Hypervisor or OS kernel), or SP invokes one of:
559*91f16700Schasinglulu
560*91f16700Schasinglulu- the FFA_MSG_SEND_DIRECT_REQ interface.
561*91f16700Schasinglulu- the FFA_RUN interface.
562*91f16700Schasinglulu
563*91f16700SchasingluluAdditionally a secure interrupt can pre-empt the normal world execution and give
564*91f16700SchasingluluCPU cycles by transitioning to EL3 and S-EL2.
565*91f16700Schasinglulu
566*91f16700SchasingluluPlatform topology
567*91f16700Schasinglulu~~~~~~~~~~~~~~~~~
568*91f16700Schasinglulu
569*91f16700SchasingluluThe *execution-ctx-count* SP manifest field can take the value of one or the
570*91f16700Schasinglulutotal number of PEs. The FF-A specification `[1]`_  recommends the
571*91f16700Schasinglulufollowing SP types:
572*91f16700Schasinglulu
573*91f16700Schasinglulu- Pinned MP SPs: an execution context matches a physical PE. MP SPs must
574*91f16700Schasinglulu  implement the same number of ECs as the number of PEs in the platform.
575*91f16700Schasinglulu- Migratable UP SPs: a single execution context can run and be migrated on any
576*91f16700Schasinglulu  physical PE. Such SP declares a single EC in its SP manifest. An UP SP can
577*91f16700Schasinglulu  receive a direct message request originating from any physical core targeting
578*91f16700Schasinglulu  the single execution context.
579*91f16700Schasinglulu
580*91f16700SchasingluluParsing SP partition manifests
581*91f16700Schasinglulu------------------------------
582*91f16700Schasinglulu
583*91f16700SchasingluluHafnium consumes SP manifests as defined in `[1]`_ and `SP manifests`_.
584*91f16700SchasingluluNote the current implementation may not implement all optional fields.
585*91f16700Schasinglulu
586*91f16700SchasingluluThe SP manifest may contain memory and device regions nodes. In case of
587*91f16700Schasingluluan S-EL2 SPMC:
588*91f16700Schasinglulu
589*91f16700Schasinglulu- Memory regions are mapped in the SP EL1&0 Stage-2 translation regime at
590*91f16700Schasinglulu  load time (or EL1&0 Stage-1 for an S-EL1 SPMC). A memory region node can
591*91f16700Schasinglulu  specify RX/TX buffer regions in which case it is not necessary for an SP
592*91f16700Schasinglulu  to explicitly invoke the ``FFA_RXTX_MAP`` interface. The memory referred
593*91f16700Schasinglulu  shall be contained within the memory ranges defined in SPMC manifest. The
594*91f16700Schasinglulu  NS bit in the attributes field should be consistent with the security
595*91f16700Schasinglulu  state of the range that it relates to. I.e. non-secure memory shall be
596*91f16700Schasinglulu  part of a non-secure memory range, and secure memory shall be contained
597*91f16700Schasinglulu  in a secure memory range of a given platform.
598*91f16700Schasinglulu- Device regions are mapped in the SP EL1&0 Stage-2 translation regime (or
599*91f16700Schasinglulu  EL1&0 Stage-1 for an S-EL1 SPMC) as peripherals and possibly allocate
600*91f16700Schasinglulu  additional resources (e.g. interrupts).
601*91f16700Schasinglulu
602*91f16700SchasingluluFor the S-EL2 SPMC, base addresses for memory and device region nodes are IPAs
603*91f16700Schasingluluprovided the SPMC identity maps IPAs to PAs within SP EL1&0 Stage-2 translation
604*91f16700Schasingluluregime.
605*91f16700Schasinglulu
606*91f16700SchasingluluNote: in the current implementation both VTTBR_EL2 and VSTTBR_EL2 point to the
607*91f16700Schasinglulusame set of page tables. It is still open whether two sets of page tables shall
608*91f16700Schasinglulube provided per SP. The memory region node as defined in the specification
609*91f16700Schasingluluprovides a memory security attribute hinting to map either to the secure or
610*91f16700Schasinglulunon-secure EL1&0 Stage-2 table if it exists.
611*91f16700Schasinglulu
612*91f16700SchasingluluPassing boot data to the SP
613*91f16700Schasinglulu---------------------------
614*91f16700Schasinglulu
615*91f16700SchasingluluIn `[1]`_ , the section  "Boot information protocol" defines a method for passing
616*91f16700Schasingluludata to the SPs at boot time. It specifies the format for the boot information
617*91f16700Schasingluludescriptor and boot information header structures, which describe the data to be
618*91f16700Schasingluluexchanged between SPMC and SP.
619*91f16700SchasingluluThe specification also defines the types of data that can be passed.
620*91f16700SchasingluluThe aggregate of both the boot info structures and the data itself is designated
621*91f16700Schasingluluthe boot information blob, and is passed to a Partition as a contiguous memory
622*91f16700Schasingluluregion.
623*91f16700Schasinglulu
624*91f16700SchasingluluCurrently, the SPM implementation supports the FDT type which is used to pass the
625*91f16700Schasinglulupartition's DTB manifest.
626*91f16700Schasinglulu
627*91f16700SchasingluluThe region for the boot information blob is allocated through the SP package.
628*91f16700Schasinglulu
629*91f16700Schasinglulu.. image:: ../resources/diagrams/partition-package.png
630*91f16700Schasinglulu
631*91f16700SchasingluluTo adjust the space allocated for the boot information blob, the json description
632*91f16700Schasingluluof the SP (see section `Describing secure partitions`_) shall be updated to contain
633*91f16700Schasingluluthe manifest offset. If no offset is provided the manifest offset defaults to 0x1000,
634*91f16700Schasingluluwhich is the page size in the Hafnium SPMC.
635*91f16700Schasinglulu
636*91f16700SchasingluluThe configuration of the boot protocol is done in the SPs manifest. As defined by
637*91f16700Schasingluluthe specification, the manifest field 'gp-register-num' configures the GP register
638*91f16700Schasingluluwhich shall be used to pass the address to the partitions boot information blob when
639*91f16700Schasinglulubooting the partition.
640*91f16700SchasingluluIn addition, the Hafnium SPMC implementation requires the boot information arguments
641*91f16700Schasingluluto be listed in a designated DT node:
642*91f16700Schasinglulu
643*91f16700Schasinglulu.. code:: shell
644*91f16700Schasinglulu
645*91f16700Schasinglulu  boot-info {
646*91f16700Schasinglulu      compatible = "arm,ffa-manifest-boot-info";
647*91f16700Schasinglulu      ffa_manifest;
648*91f16700Schasinglulu  };
649*91f16700Schasinglulu
650*91f16700SchasingluluThe whole secure partition package image (see `Secure Partition packages`_) is
651*91f16700Schasinglulumapped to the SP secure EL1&0 Stage-2 translation regime. As such, the SP can
652*91f16700Schasingluluretrieve the address for the boot information blob in the designated GP register,
653*91f16700Schasingluluprocess the boot information header and descriptors, access its own manifest
654*91f16700SchasingluluDTB blob and extract its partition manifest properties.
655*91f16700Schasinglulu
656*91f16700SchasingluluSP Boot order
657*91f16700Schasinglulu-------------
658*91f16700Schasinglulu
659*91f16700SchasingluluSP manifests provide an optional boot order attribute meant to resolve
660*91f16700Schasingluludependencies such as an SP providing a service required to properly boot
661*91f16700Schasingluluanother SP. SPMC boots the SPs in accordance to the boot order attribute,
662*91f16700Schasinglululowest to the highest value. If the boot order attribute is absent from the FF-A
663*91f16700Schasinglulumanifest, the SP is treated as if it had the highest boot order value
664*91f16700Schasinglulu(i.e. lowest booting priority).
665*91f16700Schasinglulu
666*91f16700SchasingluluIt is possible for an SP to call into another SP through a direct request
667*91f16700Schasingluluprovided the latter SP has already been booted.
668*91f16700Schasinglulu
669*91f16700SchasingluluBoot phases
670*91f16700Schasinglulu-----------
671*91f16700Schasinglulu
672*91f16700SchasingluluPrimary core boot-up
673*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~
674*91f16700Schasinglulu
675*91f16700SchasingluluUpon boot-up, BL31 hands over to the SPMC (BL32) on the primary boot physical
676*91f16700Schasinglulucore. The SPMC performs its platform initializations and registers the SPMC
677*91f16700Schasinglulusecondary physical core entry point physical address by the use of the
678*91f16700Schasinglulu`FFA_SECONDARY_EP_REGISTER`_ interface (SMC invocation from the SPMC to the SPMD
679*91f16700Schasingluluat secure physical FF-A instance).
680*91f16700Schasinglulu
681*91f16700SchasingluluThe SPMC then creates secure partitions based on SP packages and manifests. Each
682*91f16700Schasinglulusecure partition is launched in sequence (`SP Boot order`_) on their "primary"
683*91f16700Schasingluluexecution context. If the primary boot physical core linear id is N, an MP SP is
684*91f16700Schasinglulustarted using EC[N] on PE[N] (see `Platform topology`_). If the partition is a
685*91f16700SchasingluluUP SP, it is started using its unique EC0 on PE[N].
686*91f16700Schasinglulu
687*91f16700SchasingluluThe SP primary EC (or the EC used when the partition is booted as described
688*91f16700Schasingluluabove):
689*91f16700Schasinglulu
690*91f16700Schasinglulu- Performs the overall SP boot time initialization, and in case of a MP SP,
691*91f16700Schasinglulu  prepares the SP environment for other execution contexts.
692*91f16700Schasinglulu- In the case of a MP SP, it invokes the FFA_SECONDARY_EP_REGISTER at secure
693*91f16700Schasinglulu  virtual FF-A instance (SMC invocation from SP to SPMC) to provide the IPA
694*91f16700Schasinglulu  entry point for other execution contexts.
695*91f16700Schasinglulu- Exits through ``FFA_MSG_WAIT`` to indicate successful initialization or
696*91f16700Schasinglulu  ``FFA_ERROR`` in case of failure.
697*91f16700Schasinglulu
698*91f16700SchasingluluSecondary cores boot-up
699*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~
700*91f16700Schasinglulu
701*91f16700SchasingluluOnce the system is started and NWd brought up, a secondary physical core is
702*91f16700Schasingluluwoken up by the ``PSCI_CPU_ON`` service invocation. The TF-A SPD hook mechanism
703*91f16700Schasinglulucalls into the SPMD on the newly woken up physical core. Then the SPMC is
704*91f16700Schasingluluentered at the secondary physical core entry point.
705*91f16700Schasinglulu
706*91f16700SchasingluluIn the current implementation, the first SP is resumed on the coresponding EC
707*91f16700Schasinglulu(the virtual CPU which matches the physical core). The implication is that the
708*91f16700Schasinglulufirst SP must be a MP SP.
709*91f16700Schasinglulu
710*91f16700SchasingluluIn a linux based system, once secure and normal worlds are booted but prior to
711*91f16700Schasinglulua NWd FF-A driver has been loaded:
712*91f16700Schasinglulu
713*91f16700Schasinglulu- The first SP has initialized all its ECs in response to primary core boot up
714*91f16700Schasinglulu  (at system initialization) and secondary core boot up (as a result of linux
715*91f16700Schasinglulu  invoking PSCI_CPU_ON for all secondary cores).
716*91f16700Schasinglulu- Other SPs have their first execution context initialized as a result of secure
717*91f16700Schasinglulu  world initialization on the primary boot core. Other ECs for those SPs have to
718*91f16700Schasinglulu  be run first through ffa_run to complete their initialization (which results
719*91f16700Schasinglulu  in the EC completing with FFA_MSG_WAIT).
720*91f16700Schasinglulu
721*91f16700SchasingluluRefer to `Power management`_ for further details.
722*91f16700Schasinglulu
723*91f16700SchasingluluNotifications
724*91f16700Schasinglulu-------------
725*91f16700Schasinglulu
726*91f16700SchasingluluThe FF-A v1.1 specification `[1]`_ defines notifications as an asynchronous
727*91f16700Schasinglulucommunication mechanism with non-blocking semantics. It allows for one FF-A
728*91f16700Schasingluluendpoint to signal another for service provision, without hindering its current
729*91f16700Schasingluluprogress.
730*91f16700Schasinglulu
731*91f16700SchasingluluHafnium currently supports 64 notifications. The IDs of each notification define
732*91f16700Schasinglulua position in a 64-bit bitmap.
733*91f16700Schasinglulu
734*91f16700SchasingluluThe signaling of notifications can interchangeably happen between NWd and SWd
735*91f16700SchasingluluFF-A endpoints.
736*91f16700Schasinglulu
737*91f16700SchasingluluThe SPMC is in charge of managing notifications from SPs to SPs, from SPs to
738*91f16700SchasingluluVMs, and from VMs to SPs. An hypervisor component would only manage
739*91f16700Schasinglulunotifications from VMs to VMs. Given the SPMC has no visibility of the endpoints
740*91f16700Schasingluludeployed in NWd, the Hypervisor or OS kernel must invoke the interface
741*91f16700SchasingluluFFA_NOTIFICATION_BITMAP_CREATE to allocate the notifications bitmap per FF-A
742*91f16700Schasingluluendpoint in the NWd that supports it.
743*91f16700Schasinglulu
744*91f16700SchasingluluA sender can signal notifications once the receiver has provided it with
745*91f16700Schasinglulupermissions. Permissions are provided by invoking the interface
746*91f16700SchasingluluFFA_NOTIFICATION_BIND.
747*91f16700Schasinglulu
748*91f16700SchasingluluNotifications are signaled by invoking FFA_NOTIFICATION_SET. Henceforth
749*91f16700Schasingluluthey are considered to be in a pending sate. The receiver can retrieve its
750*91f16700Schasinglulupending notifications invoking FFA_NOTIFICATION_GET, which, from that moment,
751*91f16700Schasingluluare considered to be handled.
752*91f16700Schasinglulu
753*91f16700SchasingluluPer the FF-A v1.1 spec, each FF-A endpoint must be associated with a scheduler
754*91f16700Schasingluluthat is in charge of donating CPU cycles for notifications handling. The
755*91f16700SchasingluluFF-A driver calls FFA_NOTIFICATION_INFO_GET to retrieve the information about
756*91f16700Schasingluluwhich FF-A endpoints have pending notifications. The receiver scheduler is
757*91f16700Schasinglulucalled and informed by the FF-A driver, and it should allocate CPU cycles to the
758*91f16700Schasinglulureceiver.
759*91f16700Schasinglulu
760*91f16700SchasingluluThere are two types of notifications supported:
761*91f16700Schasinglulu
762*91f16700Schasinglulu- Global, which are targeted to a FF-A endpoint and can be handled within any of
763*91f16700Schasinglulu  its execution contexts, as determined by the scheduler of the system.
764*91f16700Schasinglulu- Per-vCPU, which are targeted to a FF-A endpoint and to be handled within a
765*91f16700Schasinglulu  a specific execution context, as determined by the sender.
766*91f16700Schasinglulu
767*91f16700SchasingluluThe type of a notification is set when invoking FFA_NOTIFICATION_BIND to give
768*91f16700Schasinglulupermissions to the sender.
769*91f16700Schasinglulu
770*91f16700SchasingluluNotification signaling resorts to two interrupts:
771*91f16700Schasinglulu
772*91f16700Schasinglulu- Schedule Receiver Interrupt: non-secure physical interrupt to be handled by
773*91f16700Schasinglulu  the FF-A driver within the receiver scheduler. At initialization the SPMC
774*91f16700Schasinglulu  donates a SGI ID chosen from the secure SGI IDs range and configures it as
775*91f16700Schasinglulu  non-secure. The SPMC triggers this SGI on the currently running core when
776*91f16700Schasinglulu  there are pending notifications, and the respective receivers need CPU cycles
777*91f16700Schasinglulu  to handle them.
778*91f16700Schasinglulu- Notifications Pending Interrupt: virtual interrupt to be handled by the
779*91f16700Schasinglulu  receiver of the notification. Set when there are pending notifications for the
780*91f16700Schasinglulu  given secure partition. The NPI is pended when the NWd relinquishes CPU cycles
781*91f16700Schasinglulu  to an SP.
782*91f16700Schasinglulu
783*91f16700SchasingluluThe notifications receipt support is enabled in the partition FF-A manifest.
784*91f16700Schasinglulu
785*91f16700SchasingluluMandatory interfaces
786*91f16700Schasinglulu--------------------
787*91f16700Schasinglulu
788*91f16700SchasingluluThe following interfaces are exposed to SPs:
789*91f16700Schasinglulu
790*91f16700Schasinglulu-  ``FFA_VERSION``
791*91f16700Schasinglulu-  ``FFA_FEATURES``
792*91f16700Schasinglulu-  ``FFA_RX_RELEASE``
793*91f16700Schasinglulu-  ``FFA_RXTX_MAP``
794*91f16700Schasinglulu-  ``FFA_RXTX_UNMAP``
795*91f16700Schasinglulu-  ``FFA_PARTITION_INFO_GET``
796*91f16700Schasinglulu-  ``FFA_ID_GET``
797*91f16700Schasinglulu-  ``FFA_MSG_WAIT``
798*91f16700Schasinglulu-  ``FFA_MSG_SEND_DIRECT_REQ``
799*91f16700Schasinglulu-  ``FFA_MSG_SEND_DIRECT_RESP``
800*91f16700Schasinglulu-  ``FFA_MEM_DONATE``
801*91f16700Schasinglulu-  ``FFA_MEM_LEND``
802*91f16700Schasinglulu-  ``FFA_MEM_SHARE``
803*91f16700Schasinglulu-  ``FFA_MEM_RETRIEVE_REQ``
804*91f16700Schasinglulu-  ``FFA_MEM_RETRIEVE_RESP``
805*91f16700Schasinglulu-  ``FFA_MEM_RELINQUISH``
806*91f16700Schasinglulu-  ``FFA_MEM_FRAG_RX``
807*91f16700Schasinglulu-  ``FFA_MEM_FRAG_TX``
808*91f16700Schasinglulu-  ``FFA_MEM_RECLAIM``
809*91f16700Schasinglulu-  ``FFA_RUN``
810*91f16700Schasinglulu
811*91f16700SchasingluluAs part of the FF-A v1.1 support, the following interfaces were added:
812*91f16700Schasinglulu
813*91f16700Schasinglulu - ``FFA_NOTIFICATION_BITMAP_CREATE``
814*91f16700Schasinglulu - ``FFA_NOTIFICATION_BITMAP_DESTROY``
815*91f16700Schasinglulu - ``FFA_NOTIFICATION_BIND``
816*91f16700Schasinglulu - ``FFA_NOTIFICATION_UNBIND``
817*91f16700Schasinglulu - ``FFA_NOTIFICATION_SET``
818*91f16700Schasinglulu - ``FFA_NOTIFICATION_GET``
819*91f16700Schasinglulu - ``FFA_NOTIFICATION_INFO_GET``
820*91f16700Schasinglulu - ``FFA_SPM_ID_GET``
821*91f16700Schasinglulu - ``FFA_SECONDARY_EP_REGISTER``
822*91f16700Schasinglulu - ``FFA_MEM_PERM_GET``
823*91f16700Schasinglulu - ``FFA_MEM_PERM_SET``
824*91f16700Schasinglulu - ``FFA_MSG_SEND2``
825*91f16700Schasinglulu - ``FFA_RX_ACQUIRE``
826*91f16700Schasinglulu
827*91f16700SchasingluluFFA_VERSION
828*91f16700Schasinglulu~~~~~~~~~~~
829*91f16700Schasinglulu
830*91f16700Schasinglulu``FFA_VERSION`` requires a *requested_version* parameter from the caller.
831*91f16700SchasingluluThe returned value depends on the caller:
832*91f16700Schasinglulu
833*91f16700Schasinglulu- Hypervisor or OS kernel in NS-EL1/EL2: the SPMD returns the SPMC version
834*91f16700Schasinglulu  specified in the SPMC manifest.
835*91f16700Schasinglulu- SP: the SPMC returns its own implemented version.
836*91f16700Schasinglulu- SPMC at S-EL1/S-EL2: the SPMD returns its own implemented version.
837*91f16700Schasinglulu
838*91f16700SchasingluluFFA_FEATURES
839*91f16700Schasinglulu~~~~~~~~~~~~
840*91f16700Schasinglulu
841*91f16700SchasingluluFF-A features supported by the SPMC may be discovered by secure partitions at
842*91f16700Schasingluluboot (that is prior to NWd is booted) or run-time.
843*91f16700Schasinglulu
844*91f16700SchasingluluThe SPMC calling FFA_FEATURES at secure physical FF-A instance always get
845*91f16700SchasingluluFFA_SUCCESS from the SPMD.
846*91f16700Schasinglulu
847*91f16700SchasingluluThe request made by an Hypervisor or OS kernel is forwarded to the SPMC and
848*91f16700Schasingluluthe response relayed back to the NWd.
849*91f16700Schasinglulu
850*91f16700SchasingluluFFA_RXTX_MAP/FFA_RXTX_UNMAP
851*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~
852*91f16700Schasinglulu
853*91f16700SchasingluluWhen invoked from a secure partition FFA_RXTX_MAP maps the provided send and
854*91f16700Schasinglulureceive buffers described by their IPAs to the SP EL1&0 Stage-2 translation
855*91f16700Schasingluluregime as secure buffers in the MMU descriptors.
856*91f16700Schasinglulu
857*91f16700SchasingluluWhen invoked from the Hypervisor or OS kernel, the buffers are mapped into the
858*91f16700SchasingluluSPMC EL2 Stage-1 translation regime and marked as NS buffers in the MMU
859*91f16700Schasingluludescriptors. The provided addresses may be owned by a VM in the normal world,
860*91f16700Schasingluluwhich is expected to receive messages from the secure world. The SPMC will in
861*91f16700Schasingluluthis case allocate internal state structures to facilitate RX buffer access
862*91f16700Schasinglulusynchronization (through FFA_RX_ACQUIRE interface), and to permit SPs to send
863*91f16700Schasinglulumessages.
864*91f16700Schasinglulu
865*91f16700SchasingluluThe FFA_RXTX_UNMAP unmaps the RX/TX pair from the translation regime of the
866*91f16700Schasinglulucaller, either it being the Hypervisor or OS kernel, as well as a secure
867*91f16700Schasinglulupartition.
868*91f16700Schasinglulu
869*91f16700SchasingluluFFA_PARTITION_INFO_GET
870*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~
871*91f16700Schasinglulu
872*91f16700SchasingluluPartition info get call can originate:
873*91f16700Schasinglulu
874*91f16700Schasinglulu- from SP to SPMC
875*91f16700Schasinglulu- from Hypervisor or OS kernel to SPMC. The request is relayed by the SPMD.
876*91f16700Schasinglulu
877*91f16700SchasingluluFFA_ID_GET
878*91f16700Schasinglulu~~~~~~~~~~
879*91f16700Schasinglulu
880*91f16700SchasingluluThe FF-A id space is split into a non-secure space and secure space:
881*91f16700Schasinglulu
882*91f16700Schasinglulu- FF-A ID with bit 15 clear relates to VMs.
883*91f16700Schasinglulu- FF-A ID with bit 15 set related to SPs.
884*91f16700Schasinglulu- FF-A IDs 0, 0xffff, 0x8000 are assigned respectively to the Hypervisor, SPMD
885*91f16700Schasinglulu  and SPMC.
886*91f16700Schasinglulu
887*91f16700SchasingluluThe SPMD returns:
888*91f16700Schasinglulu
889*91f16700Schasinglulu- The default zero value on invocation from the Hypervisor.
890*91f16700Schasinglulu- The ``spmc_id`` value specified in the SPMC manifest on invocation from
891*91f16700Schasinglulu  the SPMC (see `SPMC manifest`_)
892*91f16700Schasinglulu
893*91f16700SchasingluluThis convention helps the SPMC to determine the origin and destination worlds in
894*91f16700Schasingluluan FF-A ABI invocation. In particular the SPMC shall filter unauthorized
895*91f16700Schasinglulutransactions in its world switch routine. It must not be permitted for a VM to
896*91f16700Schasingluluuse a secure FF-A ID as origin world by spoofing:
897*91f16700Schasinglulu
898*91f16700Schasinglulu- A VM-to-SP direct request/response shall set the origin world to be non-secure
899*91f16700Schasinglulu  (FF-A ID bit 15 clear) and destination world to be secure (FF-A ID bit 15
900*91f16700Schasinglulu  set).
901*91f16700Schasinglulu- Similarly, an SP-to-SP direct request/response shall set the FF-A ID bit 15
902*91f16700Schasinglulu  for both origin and destination IDs.
903*91f16700Schasinglulu
904*91f16700SchasingluluAn incoming direct message request arriving at SPMD from NWd is forwarded to
905*91f16700SchasingluluSPMC without a specific check. The SPMC is resumed through eret and "knows" the
906*91f16700Schasinglulumessage is coming from normal world in this specific code path. Thus the origin
907*91f16700Schasingluluendpoint ID must be checked by SPMC for being a normal world ID.
908*91f16700Schasinglulu
909*91f16700SchasingluluAn SP sending a direct message request must have bit 15 set in its origin
910*91f16700Schasingluluendpoint ID and this can be checked by the SPMC when the SP invokes the ABI.
911*91f16700Schasinglulu
912*91f16700SchasingluluThe SPMC shall reject the direct message if the claimed world in origin endpoint
913*91f16700SchasingluluID is not consistent:
914*91f16700Schasinglulu
915*91f16700Schasinglulu-  It is either forwarded by SPMD and thus origin endpoint ID must be a "normal
916*91f16700Schasinglulu   world ID",
917*91f16700Schasinglulu-  or initiated by an SP and thus origin endpoint ID must be a "secure world ID".
918*91f16700Schasinglulu
919*91f16700Schasinglulu
920*91f16700SchasingluluFFA_MSG_SEND_DIRECT_REQ/FFA_MSG_SEND_DIRECT_RESP
921*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
922*91f16700Schasinglulu
923*91f16700SchasingluluThis is a mandatory interface for secure partitions consisting in direct request
924*91f16700Schasingluluand responses with the following rules:
925*91f16700Schasinglulu
926*91f16700Schasinglulu- An SP can send a direct request to another SP.
927*91f16700Schasinglulu- An SP can receive a direct request from another SP.
928*91f16700Schasinglulu- An SP can send a direct response to another SP.
929*91f16700Schasinglulu- An SP cannot send a direct request to an Hypervisor or OS kernel.
930*91f16700Schasinglulu- An Hypervisor or OS kernel can send a direct request to an SP.
931*91f16700Schasinglulu- An SP can send a direct response to an Hypervisor or OS kernel.
932*91f16700Schasinglulu
933*91f16700SchasingluluFFA_NOTIFICATION_BITMAP_CREATE/FFA_NOTIFICATION_BITMAP_DESTROY
934*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
935*91f16700Schasinglulu
936*91f16700SchasingluluThe secure partitions notifications bitmap are statically allocated by the SPMC.
937*91f16700SchasingluluHence, this interface is not to be issued by secure partitions.
938*91f16700Schasinglulu
939*91f16700SchasingluluAt initialization, the SPMC is not aware of VMs/partitions deployed in the
940*91f16700Schasinglulunormal world. Hence, the Hypervisor or OS kernel must use both ABIs for SPMC
941*91f16700Schasingluluto be prepared to handle notifications for the provided VM ID.
942*91f16700Schasinglulu
943*91f16700SchasingluluFFA_NOTIFICATION_BIND/FFA_NOTIFICATION_UNBIND
944*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
945*91f16700Schasinglulu
946*91f16700SchasingluluPair of interfaces to manage permissions to signal notifications. Prior to
947*91f16700Schasingluluhandling notifications, an FF-A endpoint must allow a given sender to signal a
948*91f16700Schasinglulubitmap of notifications.
949*91f16700Schasinglulu
950*91f16700SchasingluluIf the receiver doesn't have notification support enabled in its FF-A manifest,
951*91f16700Schasingluluit won't be able to bind notifications, hence forbidding it to receive any
952*91f16700Schasinglulunotifications.
953*91f16700Schasinglulu
954*91f16700SchasingluluFFA_NOTIFICATION_SET/FFA_NOTIFICATION_GET
955*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
956*91f16700Schasinglulu
957*91f16700SchasingluluFFA_NOTIFICATION_GET retrieves all pending global notifications and
958*91f16700Schasingluluper-vCPU notifications targeted to the current vCPU.
959*91f16700Schasinglulu
960*91f16700SchasingluluHafnium maintains a global count of pending notifications which gets incremented
961*91f16700Schasingluluand decremented when handling FFA_NOTIFICATION_SET and FFA_NOTIFICATION_GET
962*91f16700Schasinglulurespectively. A delayed SRI is triggered if the counter is non-zero when the
963*91f16700SchasingluluSPMC returns to normal world.
964*91f16700Schasinglulu
965*91f16700SchasingluluFFA_NOTIFICATION_INFO_GET
966*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~
967*91f16700Schasinglulu
968*91f16700SchasingluluHafnium maintains a global count of pending notifications whose information
969*91f16700Schasingluluhas been retrieved by this interface. The count is incremented and decremented
970*91f16700Schasingluluwhen handling FFA_NOTIFICATION_INFO_GET and FFA_NOTIFICATION_GET respectively.
971*91f16700SchasingluluIt also tracks notifications whose information has been retrieved individually,
972*91f16700Schasinglulusuch that it avoids duplicating returned information for subsequent calls to
973*91f16700SchasingluluFFA_NOTIFICATION_INFO_GET. For each notification, this state information is
974*91f16700Schasinglulureset when receiver called FFA_NOTIFICATION_GET to retrieve them.
975*91f16700Schasinglulu
976*91f16700SchasingluluFFA_SPM_ID_GET
977*91f16700Schasinglulu~~~~~~~~~~~~~~
978*91f16700Schasinglulu
979*91f16700SchasingluluReturns the FF-A ID allocated to an SPM component which can be one of SPMD
980*91f16700Schasingluluor SPMC.
981*91f16700Schasinglulu
982*91f16700SchasingluluAt initialization, the SPMC queries the SPMD for the SPMC ID, using the
983*91f16700SchasingluluFFA_ID_GET interface, and records it. The SPMC can also query the SPMD ID using
984*91f16700Schasingluluthe FFA_SPM_ID_GET interface at the secure physical FF-A instance.
985*91f16700Schasinglulu
986*91f16700SchasingluluSecure partitions call this interface at the virtual FF-A instance, to which
987*91f16700Schasingluluthe SPMC returns the priorly retrieved SPMC ID.
988*91f16700Schasinglulu
989*91f16700SchasingluluThe Hypervisor or OS kernel can issue the FFA_SPM_ID_GET call handled by the
990*91f16700SchasingluluSPMD, which returns the SPMC ID.
991*91f16700Schasinglulu
992*91f16700SchasingluluFFA_SECONDARY_EP_REGISTER
993*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~
994*91f16700Schasinglulu
995*91f16700SchasingluluWhen the SPMC boots, all secure partitions are initialized on their primary
996*91f16700SchasingluluExecution Context.
997*91f16700Schasinglulu
998*91f16700SchasingluluThe FFA_SECONDARY_EP_REGISTER interface is to be used by a secure partition
999*91f16700Schasinglulufrom its first execution context, to provide the entry point address for
1000*91f16700Schasinglulusecondary execution contexts.
1001*91f16700Schasinglulu
1002*91f16700SchasingluluA secondary EC is first resumed either upon invocation of PSCI_CPU_ON from
1003*91f16700Schasingluluthe NWd or by invocation of FFA_RUN.
1004*91f16700Schasinglulu
1005*91f16700SchasingluluFFA_RX_ACQUIRE/FFA_RX_RELEASE
1006*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1007*91f16700Schasinglulu
1008*91f16700SchasingluluThe RX buffers can be used to pass information to an FF-A endpoint in the
1009*91f16700Schasinglulufollowing scenarios:
1010*91f16700Schasinglulu
1011*91f16700Schasinglulu - When it was targetted by a FFA_MSG_SEND2 invokation from another endpoint.
1012*91f16700Schasinglulu - Return the result of calling ``FFA_PARTITION_INFO_GET``.
1013*91f16700Schasinglulu - In a memory share operation, as part of the ``FFA_MEM_RETRIEVE_RESP``,
1014*91f16700Schasinglulu   with the memory descriptor of the shared memory.
1015*91f16700Schasinglulu
1016*91f16700SchasingluluIf a normal world VM is expected to exchange messages with secure world,
1017*91f16700Schasingluluits RX/TX buffer addresses are forwarded to the SPMC via FFA_RXTX_MAP ABI,
1018*91f16700Schasingluluand are from this moment owned by the SPMC.
1019*91f16700SchasingluluThe hypervisor must call the FFA_RX_ACQUIRE interface before attempting
1020*91f16700Schasingluluto use the RX buffer, in any of the aforementioned scenarios. A successful
1021*91f16700Schasinglulucall to FFA_RX_ACQUIRE transfers ownership of RX buffer to hypervisor, such
1022*91f16700Schasingluluthat it can be safely used.
1023*91f16700Schasinglulu
1024*91f16700SchasingluluThe FFA_RX_RELEASE interface is used after the FF-A endpoint is done with
1025*91f16700Schasingluluprocessing the data received in its RX buffer. If the RX buffer has been
1026*91f16700Schasingluluacquired by the hypervisor, the FFA_RX_RELEASE call must be forwarded to
1027*91f16700Schasingluluthe SPMC to reestablish SPMC's RX ownership.
1028*91f16700Schasinglulu
1029*91f16700SchasingluluAn attempt from an SP to send a message to a normal world VM whose RX buffer
1030*91f16700Schasingluluwas acquired by the hypervisor fails with error code FFA_BUSY, to preserve
1031*91f16700Schasingluluthe RX buffer integrity.
1032*91f16700SchasingluluThe operation could then be conducted after FFA_RX_RELEASE.
1033*91f16700Schasinglulu
1034*91f16700SchasingluluFFA_MSG_SEND2
1035*91f16700Schasinglulu~~~~~~~~~~~~~
1036*91f16700Schasinglulu
1037*91f16700SchasingluluHafnium copies a message from the sender TX buffer into receiver's RX buffer.
1038*91f16700SchasingluluFor messages from SPs to VMs, operation is only possible if the SPMC owns
1039*91f16700Schasingluluthe receiver's RX buffer.
1040*91f16700Schasinglulu
1041*91f16700SchasingluluBoth receiver and sender need to enable support for indirect messaging,
1042*91f16700Schasingluluin their respective partition manifest. The discovery of support
1043*91f16700Schasingluluof such feature can be done via FFA_PARTITION_INFO_GET.
1044*91f16700Schasinglulu
1045*91f16700SchasingluluOn a successful message send, Hafnium pends an RX buffer full framework
1046*91f16700Schasinglulunotification for the receiver, to inform it about a message in the RX buffer.
1047*91f16700Schasinglulu
1048*91f16700SchasingluluThe handling of framework notifications is similar to that of
1049*91f16700Schasingluluglobal notifications. Binding of these is not necessary, as these are
1050*91f16700Schasinglulureserved to be used by the hypervisor or SPMC.
1051*91f16700Schasinglulu
1052*91f16700SchasingluluSPMC-SPMD direct requests/responses
1053*91f16700Schasinglulu-----------------------------------
1054*91f16700Schasinglulu
1055*91f16700SchasingluluImplementation-defined FF-A IDs are allocated to the SPMC and SPMD.
1056*91f16700SchasingluluUsing those IDs in source/destination fields of a direct request/response
1057*91f16700Schasinglulupermits SPMD to SPMC communication and either way.
1058*91f16700Schasinglulu
1059*91f16700Schasinglulu- SPMC to SPMD direct request/response uses SMC conduit.
1060*91f16700Schasinglulu- SPMD to SPMC direct request/response uses ERET conduit.
1061*91f16700Schasinglulu
1062*91f16700SchasingluluThis is used in particular to convey power management messages.
1063*91f16700Schasinglulu
1064*91f16700SchasingluluMemory Sharing
1065*91f16700Schasinglulu--------------
1066*91f16700Schasinglulu
1067*91f16700SchasingluluHafnium implements the following memory sharing interfaces:
1068*91f16700Schasinglulu
1069*91f16700Schasinglulu - ``FFA_MEM_SHARE`` - for shared access between lender and borrower.
1070*91f16700Schasinglulu - ``FFA_MEM_LEND`` - borrower to obtain exclusive access, though lender
1071*91f16700Schasinglulu   retains ownership of the memory.
1072*91f16700Schasinglulu - ``FFA_MEM_DONATE`` - lender permanently relinquishes ownership of memory
1073*91f16700Schasinglulu   to the borrower.
1074*91f16700Schasinglulu
1075*91f16700SchasingluluThe ``FFA_MEM_RETRIEVE_REQ`` interface is for the borrower to request the
1076*91f16700Schasinglulumemory to be mapped into its address space: for S-EL1 partitions the SPM updates
1077*91f16700Schasinglulutheir stage 2 translation regime; for S-EL0 partitions the SPM updates their
1078*91f16700Schasinglulustage 1 translation regime. On a successful call, the SPMC responds back with
1079*91f16700Schasinglulu``FFA_MEM_RETRIEVE_RESP``.
1080*91f16700Schasinglulu
1081*91f16700SchasingluluThe ``FFA_MEM_RELINQUISH`` interface is for when the borrower is done with using
1082*91f16700Schasinglulua memory region.
1083*91f16700Schasinglulu
1084*91f16700SchasingluluThe ``FFA_MEM_RECLAIM`` interface is for the owner of the memory to reestablish
1085*91f16700Schasingluluits ownership and exclusive access to the memory shared.
1086*91f16700Schasinglulu
1087*91f16700SchasingluluThe memory transaction descriptors are transmitted via RX/TX buffers. In
1088*91f16700Schasinglulusituations where the size of the memory transaction descriptor exceeds the
1089*91f16700Schasinglulusize of the RX/TX buffers, Hafnium provides support for fragmented transmission
1090*91f16700Schasingluluof the full transaction descriptor. The ``FFA_MEM_FRAG_RX`` and ``FFA_MEM_FRAG_TX``
1091*91f16700Schasingluluinterfaces are for receiving and transmitting the next fragment, respectively.
1092*91f16700Schasinglulu
1093*91f16700SchasingluluIf lender and borrower(s) are SPs, all memory sharing operations are supported.
1094*91f16700Schasinglulu
1095*91f16700SchasingluluHafnium also supports memory sharing operations between the normal world and the
1096*91f16700Schasinglulusecure world. If there is an SP involved, the SPMC allocates data to track the
1097*91f16700Schasinglulustate of the operation.
1098*91f16700Schasinglulu
1099*91f16700SchasingluluThe SPMC is also the designated allocator for the memory handle. The hypervisor
1100*91f16700Schasingluluor OS kernel has the possibility to rely on the SPMC to maintain the state
1101*91f16700Schasingluluof the operation, thus saving memory.
1102*91f16700SchasingluluA lender SP can only donate NS memory to a borrower from the normal world.
1103*91f16700Schasinglulu
1104*91f16700SchasingluluThe SPMC supports the hypervisor retrieve request, as defined by the FF-A
1105*91f16700Schasingluluv1.1 EAC0 specification, in section 16.4.3. The intent is to aid with operations
1106*91f16700Schasingluluthat the hypervisor must do for a VM retriever. For example, when handling
1107*91f16700Schasingluluan FFA_MEM_RECLAIM, if the hypervisor relies on SPMC to keep the state
1108*91f16700Schasingluluof the operation, the hypervisor retrieve request can be used to obtain
1109*91f16700Schasingluluthat state information, do the necessary validations, and update stage 2
1110*91f16700Schasinglulumemory translation.
1111*91f16700Schasinglulu
1112*91f16700SchasingluluHafnium also supports memory lend and share targetting multiple borrowers.
1113*91f16700SchasingluluThis is the case for a lender SP to multiple SPs, and for a lender VM to
1114*91f16700Schasinglulumultiple endpoints (from both secure world and normal world). If there is
1115*91f16700Schasingluluat least one borrower VM, the hypervisor is in charge of managing its
1116*91f16700Schasinglulustage 2 translation on a successful memory retrieve.
1117*91f16700SchasingluluThe semantics of ``FFA_MEM_DONATE`` implies ownership transmission,
1118*91f16700Schasingluluwhich should target only one partition.
1119*91f16700Schasinglulu
1120*91f16700SchasingluluThe memory share interfaces are backwards compatible with memory transaction
1121*91f16700Schasingluludescriptors from FF-A v1.0. These get translated to FF-A v1.1 descriptors for
1122*91f16700SchasingluluHafnium's internal processing of the operation. If the FF-A version of a
1123*91f16700Schasingluluborrower is v1.0, Hafnium provides FF-A v1.0 compliant memory transaction
1124*91f16700Schasingluludescriptors on memory retrieve response.
1125*91f16700Schasinglulu
1126*91f16700SchasingluluPE MMU configuration
1127*91f16700Schasinglulu--------------------
1128*91f16700Schasinglulu
1129*91f16700SchasingluluWith secure virtualization enabled (``HCR_EL2.VM = 1``) and for S-EL1
1130*91f16700Schasinglulupartitions, two IPA spaces (secure and non-secure) are output from the
1131*91f16700Schasinglulusecure EL1&0 Stage-1 translation.
1132*91f16700SchasingluluThe EL1&0 Stage-2 translation hardware is fed by:
1133*91f16700Schasinglulu
1134*91f16700Schasinglulu- A secure IPA when the SP EL1&0 Stage-1 MMU is disabled.
1135*91f16700Schasinglulu- One of secure or non-secure IPA when the secure EL1&0 Stage-1 MMU is enabled.
1136*91f16700Schasinglulu
1137*91f16700Schasinglulu``VTCR_EL2`` and ``VSTCR_EL2`` provide configuration bits for controlling the
1138*91f16700SchasingluluNS/S IPA translations. The following controls are set up:
1139*91f16700Schasinglulu``VSTCR_EL2.SW = 0`` , ``VSTCR_EL2.SA = 0``, ``VTCR_EL2.NSW = 0``,
1140*91f16700Schasinglulu``VTCR_EL2.NSA = 1``:
1141*91f16700Schasinglulu
1142*91f16700Schasinglulu- Stage-2 translations for the NS IPA space access the NS PA space.
1143*91f16700Schasinglulu- Stage-2 translation table walks for the NS IPA space are to the secure PA space.
1144*91f16700Schasinglulu
1145*91f16700SchasingluluSecure and non-secure IPA regions (rooted to by ``VTTBR_EL2`` and ``VSTTBR_EL2``)
1146*91f16700Schasingluluuse the same set of Stage-2 page tables within a SP.
1147*91f16700Schasinglulu
1148*91f16700SchasingluluThe ``VTCR_EL2/VSTCR_EL2/VTTBR_EL2/VSTTBR_EL2`` virtual address space
1149*91f16700Schasingluluconfiguration is made part of a vCPU context.
1150*91f16700Schasinglulu
1151*91f16700SchasingluluFor S-EL0 partitions with VHE enabled, a single secure EL2&0 Stage-1 translation
1152*91f16700Schasingluluregime is used for both Hafnium and the partition.
1153*91f16700Schasinglulu
1154*91f16700SchasingluluSchedule modes and SP Call chains
1155*91f16700Schasinglulu---------------------------------
1156*91f16700Schasinglulu
1157*91f16700SchasingluluAn SP execution context is said to be in SPMC scheduled mode if CPU cycles are
1158*91f16700Schasingluluallocated to it by SPMC. Correspondingly, an SP execution context is said to be
1159*91f16700Schasingluluin Normal world scheduled mode if CPU cycles are allocated by the normal world.
1160*91f16700Schasinglulu
1161*91f16700SchasingluluA call chain represents all SPs in a sequence of invocations of a direct message
1162*91f16700Schasinglulurequest. When execution on a PE is in the secure state, only a single call chain
1163*91f16700Schasingluluthat runs in the Normal World scheduled mode can exist. FF-A v1.1 spec allows
1164*91f16700Schasingluluany number of call chains to run in the SPMC scheduled mode but the Hafnium
1165*91f16700SchasingluluSPMC restricts the number of call chains in SPMC scheduled mode to only one for
1166*91f16700Schasinglulukeeping the implementation simple.
1167*91f16700Schasinglulu
1168*91f16700SchasingluluPartition runtime models
1169*91f16700Schasinglulu------------------------
1170*91f16700Schasinglulu
1171*91f16700SchasingluluThe runtime model of an endpoint describes the transitions permitted for an
1172*91f16700Schasingluluexecution context between various states. These are the four partition runtime
1173*91f16700Schasinglulumodels supported (refer to `[1]`_ section 7):
1174*91f16700Schasinglulu
1175*91f16700Schasinglulu  - RTM_FFA_RUN: runtime model presented to an execution context that is
1176*91f16700Schasinglulu    allocated CPU cycles through FFA_RUN interface.
1177*91f16700Schasinglulu  - RTM_FFA_DIR_REQ: runtime model presented to an execution context that is
1178*91f16700Schasinglulu    allocated CPU cycles through FFA_MSG_SEND_DIRECT_REQ interface.
1179*91f16700Schasinglulu  - RTM_SEC_INTERRUPT: runtime model presented to an execution context that is
1180*91f16700Schasinglulu    allocated CPU cycles by SPMC to handle a secure interrupt.
1181*91f16700Schasinglulu  - RTM_SP_INIT: runtime model presented to an execution context that is
1182*91f16700Schasinglulu    allocated CPU cycles by SPMC to initialize its state.
1183*91f16700Schasinglulu
1184*91f16700SchasingluluIf an endpoint execution context attempts to make an invalid transition or a
1185*91f16700Schasingluluvalid transition that could lead to a loop in the call chain, SPMC denies the
1186*91f16700Schasinglulutransition with the help of above runtime models.
1187*91f16700Schasinglulu
1188*91f16700SchasingluluInterrupt management
1189*91f16700Schasinglulu--------------------
1190*91f16700Schasinglulu
1191*91f16700SchasingluluGIC ownership
1192*91f16700Schasinglulu~~~~~~~~~~~~~
1193*91f16700Schasinglulu
1194*91f16700SchasingluluThe SPMC owns the GIC configuration. Secure and non-secure interrupts are
1195*91f16700Schasinglulutrapped at S-EL2. The SPMC manages interrupt resources and allocates interrupt
1196*91f16700SchasingluluIDs based on SP manifests. The SPMC acknowledges physical interrupts and injects
1197*91f16700Schasingluluvirtual interrupts by setting the use of vIRQ/vFIQ bits before resuming a SP.
1198*91f16700Schasinglulu
1199*91f16700SchasingluluAbbreviations:
1200*91f16700Schasinglulu
1201*91f16700Schasinglulu  - NS-Int: A non-secure physical interrupt. It requires a switch to the normal
1202*91f16700Schasinglulu    world to be handled if it triggers while execution is in secure world.
1203*91f16700Schasinglulu  - Other S-Int: A secure physical interrupt targeted to an SP different from
1204*91f16700Schasinglulu    the one that is currently running.
1205*91f16700Schasinglulu  - Self S-Int: A secure physical interrupt targeted to the SP that is currently
1206*91f16700Schasinglulu    running.
1207*91f16700Schasinglulu
1208*91f16700SchasingluluNon-secure interrupt handling
1209*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1210*91f16700Schasinglulu
1211*91f16700SchasingluluThis section documents the actions supported in SPMC in response to a non-secure
1212*91f16700Schasingluluinterrupt as per the guidance provided by FF-A v1.1 EAC0 specification.
1213*91f16700SchasingluluAn SP specifies one of the following actions in its partition manifest:
1214*91f16700Schasinglulu
1215*91f16700Schasinglulu  - Non-secure interrupt is signaled.
1216*91f16700Schasinglulu  - Non-secure interrupt is signaled after a managed exit.
1217*91f16700Schasinglulu  - Non-secure interrupt is queued.
1218*91f16700Schasinglulu
1219*91f16700SchasingluluAn SP execution context in a call chain could specify a less permissive action
1220*91f16700Schasingluluthan subsequent SP execution contexts in the same call chain. The less
1221*91f16700Schasinglulupermissive action takes precedence over the more permissive actions specified
1222*91f16700Schasingluluby the subsequent execution contexts. Please refer to FF-A v1.1 EAC0 section
1223*91f16700Schasinglulu8.3.1 for further explanation.
1224*91f16700Schasinglulu
1225*91f16700SchasingluluSecure interrupt handling
1226*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~
1227*91f16700Schasinglulu
1228*91f16700SchasingluluThis section documents the support implemented for secure interrupt handling in
1229*91f16700SchasingluluSPMC as per the guidance provided by FF-A v1.1 EAC0 specification.
1230*91f16700SchasingluluThe following assumptions are made about the system configuration:
1231*91f16700Schasinglulu
1232*91f16700Schasinglulu  - In the current implementation, S-EL1 SPs are expected to use the para
1233*91f16700Schasinglulu    virtualized ABIs for interrupt management rather than accessing the virtual
1234*91f16700Schasinglulu    GIC interface.
1235*91f16700Schasinglulu  - Unless explicitly stated otherwise, this support is applicable only for
1236*91f16700Schasinglulu    S-EL1 SPs managed by SPMC.
1237*91f16700Schasinglulu  - Secure interrupts are configured as G1S or G0 interrupts.
1238*91f16700Schasinglulu  - All physical interrupts are routed to SPMC when running a secure partition
1239*91f16700Schasinglulu    execution context.
1240*91f16700Schasinglulu  - All endpoints with multiple execution contexts have their contexts pinned
1241*91f16700Schasinglulu    to corresponding CPUs. Hence, a secure virtual interrupt cannot be signaled
1242*91f16700Schasinglulu    to a target vCPU that is currently running or blocked on a different
1243*91f16700Schasinglulu    physical CPU.
1244*91f16700Schasinglulu
1245*91f16700SchasingluluA physical secure interrupt could trigger while CPU is executing in normal world
1246*91f16700Schasingluluor secure world.
1247*91f16700SchasingluluThe action of SPMC for a secure interrupt depends on: the state of the target
1248*91f16700Schasingluluexecution context of the SP that is responsible for handling the interrupt;
1249*91f16700Schasingluluwhether the interrupt triggered while execution was in normal world or secure
1250*91f16700Schasingluluworld.
1251*91f16700Schasinglulu
1252*91f16700SchasingluluSecure interrupt signaling mechanisms
1253*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1254*91f16700Schasinglulu
1255*91f16700SchasingluluSignaling refers to the mechanisms used by SPMC to indicate to the SP execution
1256*91f16700Schasinglulucontext that it has a pending virtual interrupt and to further run the SP
1257*91f16700Schasingluluexecution context, such that it can handle the virtual interrupt. SPMC uses
1258*91f16700Schasinglulueither the FFA_INTERRUPT interface with ERET conduit or vIRQ signal for signaling
1259*91f16700Schasingluluto S-EL1 SPs. When normal world execution is preempted by a secure interrupt,
1260*91f16700Schasingluluthe SPMD uses the FFA_INTERRUPT ABI with ERET conduit to signal interrupt to SPMC
1261*91f16700Schasinglulurunning in S-EL2.
1262*91f16700Schasinglulu
1263*91f16700Schasinglulu+-----------+---------+---------------+---------------------------------------+
1264*91f16700Schasinglulu| SP State  | Conduit | Interface and | Description                           |
1265*91f16700Schasinglulu|           |         | parameters    |                                       |
1266*91f16700Schasinglulu+-----------+---------+---------------+---------------------------------------+
1267*91f16700Schasinglulu| WAITING   | ERET,   | FFA_INTERRUPT,| SPMC signals to SP the ID of pending  |
1268*91f16700Schasinglulu|           | vIRQ    | Interrupt ID  | interrupt. It pends vIRQ signal and   |
1269*91f16700Schasinglulu|           |         |               | resumes execution context of SP       |
1270*91f16700Schasinglulu|           |         |               | through ERET.                         |
1271*91f16700Schasinglulu+-----------+---------+---------------+---------------------------------------+
1272*91f16700Schasinglulu| BLOCKED   | ERET,   | FFA_INTERRUPT | SPMC signals to SP that an interrupt  |
1273*91f16700Schasinglulu|           | vIRQ    |               | is pending. It pends vIRQ signal and  |
1274*91f16700Schasinglulu|           |         |               | resumes execution context of SP       |
1275*91f16700Schasinglulu|           |         |               | through ERET.                         |
1276*91f16700Schasinglulu+-----------+---------+---------------+---------------------------------------+
1277*91f16700Schasinglulu| PREEMPTED | vIRQ    | NA            | SPMC pends the vIRQ signal but does   |
1278*91f16700Schasinglulu|           |         |               | not resume execution context of SP.   |
1279*91f16700Schasinglulu+-----------+---------+---------------+---------------------------------------+
1280*91f16700Schasinglulu| RUNNING   | ERET,   | NA            | SPMC pends the vIRQ signal and resumes|
1281*91f16700Schasinglulu|           | vIRQ    |               | execution context of SP through ERET. |
1282*91f16700Schasinglulu+-----------+---------+---------------+---------------------------------------+
1283*91f16700Schasinglulu
1284*91f16700SchasingluluSecure interrupt completion mechanisms
1285*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1286*91f16700Schasinglulu
1287*91f16700SchasingluluA SP signals secure interrupt handling completion to the SPMC through the
1288*91f16700Schasinglulufollowing mechanisms:
1289*91f16700Schasinglulu
1290*91f16700Schasinglulu  - ``FFA_MSG_WAIT`` ABI if it was in WAITING state.
1291*91f16700Schasinglulu  - ``FFA_RUN`` ABI if its was in BLOCKED state.
1292*91f16700Schasinglulu
1293*91f16700SchasingluluThis is a remnant of SPMC implementation based on the FF-A v1.0 specification.
1294*91f16700SchasingluluIn the current implementation, S-EL1 SPs use the para-virtualized HVC interface
1295*91f16700Schasingluluimplemented by SPMC to perform priority drop and interrupt deactivation (SPMC
1296*91f16700Schasingluluconfigures EOImode = 0, i.e. priority drop and deactivation are done together).
1297*91f16700SchasingluluThe SPMC performs checks to deny the state transition upon invocation of
1298*91f16700Schasinglulueither FFA_MSG_WAIT or FFA_RUN interface if the SP didn't perform the
1299*91f16700Schasingluludeactivation of the secure virtual interrupt.
1300*91f16700Schasinglulu
1301*91f16700SchasingluluIf the current SP execution context was preempted by a secure interrupt to be
1302*91f16700Schasingluluhandled by execution context of target SP, SPMC resumes current SP after signal
1303*91f16700Schasinglulucompletion by target SP execution context.
1304*91f16700Schasinglulu
1305*91f16700SchasingluluActions for a secure interrupt triggered while execution is in normal world
1306*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1307*91f16700Schasinglulu
1308*91f16700Schasinglulu+-------------------+----------+-----------------------------------------------+
1309*91f16700Schasinglulu| State of target   | Action   | Description                                   |
1310*91f16700Schasinglulu| execution context |          |                                               |
1311*91f16700Schasinglulu+-------------------+----------+-----------------------------------------------+
1312*91f16700Schasinglulu| WAITING           | Signaled | This starts a new call chain in SPMC scheduled|
1313*91f16700Schasinglulu|                   |          | mode.                                         |
1314*91f16700Schasinglulu+-------------------+----------+-----------------------------------------------+
1315*91f16700Schasinglulu| PREEMPTED         | Queued   | The target execution must have been preempted |
1316*91f16700Schasinglulu|                   |          | by a non-secure interrupt. SPMC queues the    |
1317*91f16700Schasinglulu|                   |          | secure virtual interrupt now. It is signaled  |
1318*91f16700Schasinglulu|                   |          | when the target execution context next enters |
1319*91f16700Schasinglulu|                   |          | the RUNNING state.                            |
1320*91f16700Schasinglulu+-------------------+----------+-----------------------------------------------+
1321*91f16700Schasinglulu| BLOCKED, RUNNING  | NA       | The target execution context is blocked or    |
1322*91f16700Schasinglulu|                   |          | running on a different CPU. This is not       |
1323*91f16700Schasinglulu|                   |          | supported by current SPMC implementation and  |
1324*91f16700Schasinglulu|                   |          | execution hits panic.                         |
1325*91f16700Schasinglulu+-------------------+----------+-----------------------------------------------+
1326*91f16700Schasinglulu
1327*91f16700SchasingluluIf normal world execution was preempted by a secure interrupt, SPMC uses
1328*91f16700SchasingluluFFA_NORMAL_WORLD_RESUME ABI to indicate completion of secure interrupt handling
1329*91f16700Schasingluluand further returns execution to normal world.
1330*91f16700Schasinglulu
1331*91f16700SchasingluluThe following figure describes interrupt handling flow when a secure interrupt
1332*91f16700Schasinglulutriggers while execution is in normal world:
1333*91f16700Schasinglulu
1334*91f16700Schasinglulu.. image:: ../resources/diagrams/ffa-secure-interrupt-handling-nwd.png
1335*91f16700Schasinglulu
1336*91f16700SchasingluluA brief description of the events:
1337*91f16700Schasinglulu
1338*91f16700Schasinglulu  - 1) Secure interrupt triggers while normal world is running.
1339*91f16700Schasinglulu  - 2) FIQ gets trapped to EL3.
1340*91f16700Schasinglulu  - 3) SPMD signals secure interrupt to SPMC at S-EL2 using FFA_INTERRUPT ABI.
1341*91f16700Schasinglulu  - 4) SPMC identifies target vCPU of SP and injects virtual interrupt (pends
1342*91f16700Schasinglulu       vIRQ).
1343*91f16700Schasinglulu  - 5) Assuming SP1 vCPU is in WAITING state, SPMC signals virtual interrupt
1344*91f16700Schasinglulu       using FFA_INTERRUPT with interrupt id as an argument and resumes the SP1
1345*91f16700Schasinglulu       vCPU using ERET in SPMC scheduled mode.
1346*91f16700Schasinglulu  - 6) Execution traps to vIRQ handler in SP1 provided that the virtual
1347*91f16700Schasinglulu       interrupt is not masked i.e., PSTATE.I = 0
1348*91f16700Schasinglulu  - 7) SP1 queries for the pending virtual interrupt id using a paravirtualized
1349*91f16700Schasinglulu       HVC call. SPMC clears the pending virtual interrupt state management
1350*91f16700Schasinglulu       and returns the pending virtual interrupt id.
1351*91f16700Schasinglulu  - 8) SP1 services the virtual interrupt and invokes the paravirtualized
1352*91f16700Schasinglulu       de-activation HVC call. SPMC de-activates the physical interrupt,
1353*91f16700Schasinglulu       clears the fields tracking the secure interrupt and resumes SP1 vCPU.
1354*91f16700Schasinglulu  - 9) SP1 performs secure interrupt completion through FFA_MSG_WAIT ABI.
1355*91f16700Schasinglulu  - 10) SPMC returns control to EL3 using FFA_NORMAL_WORLD_RESUME.
1356*91f16700Schasinglulu  - 11) EL3 resumes normal world execution.
1357*91f16700Schasinglulu
1358*91f16700SchasingluluActions for a secure interrupt triggered while execution is in secure world
1359*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1360*91f16700Schasinglulu
1361*91f16700Schasinglulu+-------------------+----------+------------------------------------------------+
1362*91f16700Schasinglulu| State of target   | Action   | Description                                    |
1363*91f16700Schasinglulu| execution context |          |                                                |
1364*91f16700Schasinglulu+-------------------+----------+------------------------------------------------+
1365*91f16700Schasinglulu| WAITING           | Signaled | This starts a new call chain in SPMC scheduled |
1366*91f16700Schasinglulu|                   |          | mode.                                          |
1367*91f16700Schasinglulu+-------------------+----------+------------------------------------------------+
1368*91f16700Schasinglulu| PREEMPTED by Self | Signaled | The target execution context reenters the      |
1369*91f16700Schasinglulu| S-Int             |          | RUNNING state to handle the secure virtual     |
1370*91f16700Schasinglulu|                   |          | interrupt.                                     |
1371*91f16700Schasinglulu+-------------------+----------+------------------------------------------------+
1372*91f16700Schasinglulu| PREEMPTED by      | Queued   | SPMC queues the secure virtual interrupt now.  |
1373*91f16700Schasinglulu| NS-Int            |          | It is signaled when the target execution       |
1374*91f16700Schasinglulu|                   |          | context next enters the RUNNING state.         |
1375*91f16700Schasinglulu+-------------------+----------+------------------------------------------------+
1376*91f16700Schasinglulu| BLOCKED           | Signaled | Both preempted and target execution contexts   |
1377*91f16700Schasinglulu|                   |          | must have been part of the Normal world        |
1378*91f16700Schasinglulu|                   |          | scheduled call chain. Refer scenario 1 of      |
1379*91f16700Schasinglulu|                   |          | Table 8.4 in the FF-A v1.1 EAC0 spec.          |
1380*91f16700Schasinglulu+-------------------+----------+------------------------------------------------+
1381*91f16700Schasinglulu| RUNNING           | NA       | The target execution context is running on a   |
1382*91f16700Schasinglulu|                   |          | different CPU. This scenario is not supported  |
1383*91f16700Schasinglulu|                   |          | by current SPMC implementation and execution   |
1384*91f16700Schasinglulu|                   |          | hits panic.                                    |
1385*91f16700Schasinglulu+-------------------+----------+------------------------------------------------+
1386*91f16700Schasinglulu
1387*91f16700SchasingluluThe following figure describes interrupt handling flow when a secure interrupt
1388*91f16700Schasinglulutriggers while execution is in secure world. We assume OS kernel sends a direct
1389*91f16700Schasinglulurequest message to SP1. Further, SP1 sends a direct request message to SP2. SP1
1390*91f16700Schasingluluenters BLOCKED state and SPMC resumes SP2.
1391*91f16700Schasinglulu
1392*91f16700Schasinglulu.. image:: ../resources/diagrams/ffa-secure-interrupt-handling-swd.png
1393*91f16700Schasinglulu
1394*91f16700SchasingluluA brief description of the events:
1395*91f16700Schasinglulu
1396*91f16700Schasinglulu  - 1) Secure interrupt triggers while SP2 is running.
1397*91f16700Schasinglulu  - 2) SP2 gets preempted and execution traps to SPMC as IRQ.
1398*91f16700Schasinglulu  - 3) SPMC finds the target vCPU of secure partition responsible for handling
1399*91f16700Schasinglulu       this secure interrupt. In this scenario, it is SP1.
1400*91f16700Schasinglulu  - 4) SPMC pends vIRQ for SP1 and signals through FFA_INTERRUPT interface.
1401*91f16700Schasinglulu       SPMC further resumes SP1 through ERET conduit. Note that SP1 remains in
1402*91f16700Schasinglulu       Normal world schedule mode.
1403*91f16700Schasinglulu  - 6) Execution traps to vIRQ handler in SP1 provided that the virtual
1404*91f16700Schasinglulu       interrupt is not masked i.e., PSTATE.I = 0
1405*91f16700Schasinglulu  - 7) SP1 queries for the pending virtual interrupt id using a paravirtualized
1406*91f16700Schasinglulu       HVC call. SPMC clears the pending virtual interrupt state management
1407*91f16700Schasinglulu       and returns the pending virtual interrupt id.
1408*91f16700Schasinglulu  - 8) SP1 services the virtual interrupt and invokes the paravirtualized
1409*91f16700Schasinglulu       de-activation HVC call. SPMC de-activates the physical interrupt and
1410*91f16700Schasinglulu       clears the fields tracking the secure interrupt and resumes SP1 vCPU.
1411*91f16700Schasinglulu  - 9) Since SP1 direct request completed with FFA_INTERRUPT, it resumes the
1412*91f16700Schasinglulu       direct request to SP2 by invoking FFA_RUN.
1413*91f16700Schasinglulu  - 9) SPMC resumes the pre-empted vCPU of SP2.
1414*91f16700Schasinglulu
1415*91f16700SchasingluluEL3 interrupt handling
1416*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~
1417*91f16700Schasinglulu
1418*91f16700SchasingluluIn GICv3 based systems, EL3 interrupts are configured as Group0 secure
1419*91f16700Schasingluluinterrupts. Execution traps to SPMC when a Group0 interrupt triggers while an
1420*91f16700SchasingluluSP is running. Further, SPMC running at S-EL2 uses FFA_EL3_INTR_HANDLE ABI to
1421*91f16700Schasinglulurequest EL3 platform firmware to handle a pending Group0 interrupt.
1422*91f16700SchasingluluSimilarly, SPMD registers a handler with interrupt management framework to
1423*91f16700Schasingluludelegate handling of Group0 interrupt to the platform if the interrupt triggers
1424*91f16700Schasingluluin normal world.
1425*91f16700Schasinglulu
1426*91f16700Schasinglulu - Platform hook
1427*91f16700Schasinglulu
1428*91f16700Schasinglulu   - plat_spmd_handle_group0_interrupt
1429*91f16700Schasinglulu
1430*91f16700Schasinglulu     SPMD provides platform hook to handle Group0 secure interrupts. In the
1431*91f16700Schasinglulu     current design, SPMD expects the platform not to delegate handling to the
1432*91f16700Schasinglulu     NWd (such as through SDEI) while processing Group0 interrupts.
1433*91f16700Schasinglulu
1434*91f16700SchasingluluPower management
1435*91f16700Schasinglulu----------------
1436*91f16700Schasinglulu
1437*91f16700SchasingluluIn platforms with or without secure virtualization:
1438*91f16700Schasinglulu
1439*91f16700Schasinglulu- The NWd owns the platform PM policy.
1440*91f16700Schasinglulu- The Hypervisor or OS kernel is the component initiating PSCI service calls.
1441*91f16700Schasinglulu- The EL3 PSCI library is in charge of the PM coordination and control
1442*91f16700Schasinglulu  (eventually writing to platform registers).
1443*91f16700Schasinglulu- While coordinating PM events, the PSCI library calls backs into the Secure
1444*91f16700Schasinglulu  Payload Dispatcher for events the latter has statically registered to.
1445*91f16700Schasinglulu
1446*91f16700SchasingluluWhen using the SPMD as a Secure Payload Dispatcher:
1447*91f16700Schasinglulu
1448*91f16700Schasinglulu- A power management event is relayed through the SPD hook to the SPMC.
1449*91f16700Schasinglulu- In the current implementation only cpu on (svc_on_finish) and cpu off
1450*91f16700Schasinglulu  (svc_off) hooks are registered.
1451*91f16700Schasinglulu- The behavior for the cpu on event is described in `Secondary cores boot-up`_.
1452*91f16700Schasinglulu  The SPMC is entered through its secondary physical core entry point.
1453*91f16700Schasinglulu- The cpu off event occurs when the NWd calls PSCI_CPU_OFF. The PM event is
1454*91f16700Schasinglulu  signaled to the SPMC through a power management framework message.
1455*91f16700Schasinglulu  It consists in a SPMD-to-SPMC direct request/response (`SPMC-SPMD direct
1456*91f16700Schasinglulu  requests/responses`_) conveying the event details and SPMC response.
1457*91f16700Schasinglulu  The SPMD performs a synchronous entry into the SPMC. The SPMC is entered and
1458*91f16700Schasinglulu  updates its internal state to reflect the physical core is being turned off.
1459*91f16700Schasinglulu  In the current implementation no SP is resumed as a consequence. This behavior
1460*91f16700Schasinglulu  ensures a minimal support for CPU hotplug e.g. when initiated by the NWd linux
1461*91f16700Schasinglulu  userspace.
1462*91f16700Schasinglulu
1463*91f16700SchasingluluArm architecture extensions for security hardening
1464*91f16700Schasinglulu==================================================
1465*91f16700Schasinglulu
1466*91f16700SchasingluluHafnium supports the following architecture extensions for security hardening:
1467*91f16700Schasinglulu
1468*91f16700Schasinglulu- Pointer authentication (FEAT_PAuth): the extension permits detection of forged
1469*91f16700Schasinglulu  pointers used by ROP type of attacks through the signing of the pointer
1470*91f16700Schasinglulu  value. Hafnium is built with the compiler branch protection option to permit
1471*91f16700Schasinglulu  generation of a pointer authentication code for return addresses (pointer
1472*91f16700Schasinglulu  authentication for instructions). The APIA key is used while Hafnium runs.
1473*91f16700Schasinglulu  A random key is generated at boot time and restored upon entry into Hafnium
1474*91f16700Schasinglulu  at run-time. APIA and other keys (APIB, APDA, APDB, APGA) are saved/restored
1475*91f16700Schasinglulu  in vCPU contexts permitting to enable pointer authentication in VMs/SPs.
1476*91f16700Schasinglulu- Branch Target Identification (FEAT_BTI): the extension permits detection of
1477*91f16700Schasinglulu  unexpected indirect branches used by JOP type of attacks. Hafnium is built
1478*91f16700Schasinglulu  with the compiler branch protection option, inserting land pads at function
1479*91f16700Schasinglulu  prologues that are reached by indirect branch instructions (BR/BLR).
1480*91f16700Schasinglulu  Hafnium code pages are marked as guarded in the EL2 Stage-1 MMU descriptors
1481*91f16700Schasinglulu  such that an indirect branch must always target a landpad. A fault is
1482*91f16700Schasinglulu  triggered otherwise. VMs/SPs can (independently) mark their code pages as
1483*91f16700Schasinglulu  guarded in the EL1&0 Stage-1 translation regime.
1484*91f16700Schasinglulu- Memory Tagging Extension (FEAT_MTE): the option permits detection of out of
1485*91f16700Schasinglulu  bound memory array accesses or re-use of an already freed memory region.
1486*91f16700Schasinglulu  Hafnium enables the compiler option permitting to leverage MTE stack tagging
1487*91f16700Schasinglulu  applied to core stacks. Core stacks are marked as normal tagged memory in the
1488*91f16700Schasinglulu  EL2 Stage-1 translation regime. A synchronous data abort is generated upon tag
1489*91f16700Schasinglulu  check failure on load/stores. A random seed is generated at boot time and
1490*91f16700Schasinglulu  restored upon entry into Hafnium. MTE system registers are saved/restored in
1491*91f16700Schasinglulu  vCPU contexts permitting MTE usage from VMs/SPs.
1492*91f16700Schasinglulu
1493*91f16700SchasingluluSMMUv3 support in Hafnium
1494*91f16700Schasinglulu=========================
1495*91f16700Schasinglulu
1496*91f16700SchasingluluAn SMMU is analogous to an MMU in a CPU. It performs address translations for
1497*91f16700SchasingluluDirect Memory Access (DMA) requests from system I/O devices.
1498*91f16700SchasingluluThe responsibilities of an SMMU include:
1499*91f16700Schasinglulu
1500*91f16700Schasinglulu-  Translation: Incoming DMA requests are translated from bus address space to
1501*91f16700Schasinglulu   system physical address space using translation tables compliant to
1502*91f16700Schasinglulu   Armv8/Armv7 VMSA descriptor format.
1503*91f16700Schasinglulu-  Protection: An I/O device can be prohibited from read, write access to a
1504*91f16700Schasinglulu   memory region or allowed.
1505*91f16700Schasinglulu-  Isolation: Traffic from each individial device can be independently managed.
1506*91f16700Schasinglulu   The devices are differentiated from each other using unique translation
1507*91f16700Schasinglulu   tables.
1508*91f16700Schasinglulu
1509*91f16700SchasingluluThe following diagram illustrates a typical SMMU IP integrated in a SoC with
1510*91f16700Schasingluluseveral I/O devices along with Interconnect and Memory system.
1511*91f16700Schasinglulu
1512*91f16700Schasinglulu.. image:: ../resources/diagrams/MMU-600.png
1513*91f16700Schasinglulu
1514*91f16700SchasingluluSMMU has several versions including SMMUv1, SMMUv2 and SMMUv3. Hafnium provides
1515*91f16700Schasinglulusupport for SMMUv3 driver in both normal and secure world. A brief introduction
1516*91f16700Schasingluluof SMMUv3 functionality and the corresponding software support in Hafnium is
1517*91f16700Schasingluluprovided here.
1518*91f16700Schasinglulu
1519*91f16700SchasingluluSMMUv3 features
1520*91f16700Schasinglulu---------------
1521*91f16700Schasinglulu
1522*91f16700Schasinglulu-  SMMUv3 provides Stage1, Stage2 translation as well as nested (Stage1 + Stage2)
1523*91f16700Schasinglulu   translation support. It can either bypass or abort incoming translations as
1524*91f16700Schasinglulu   well.
1525*91f16700Schasinglulu-  Traffic (memory transactions) from each upstream I/O peripheral device,
1526*91f16700Schasinglulu   referred to as Stream, can be independently managed using a combination of
1527*91f16700Schasinglulu   several memory based configuration structures. This allows the SMMUv3 to
1528*91f16700Schasinglulu   support a large number of streams with each stream assigned to a unique
1529*91f16700Schasinglulu   translation context.
1530*91f16700Schasinglulu-  Support for Armv8.1 VMSA where the SMMU shares the translation tables with
1531*91f16700Schasinglulu   a Processing Element. AArch32(LPAE) and AArch64 translation table format
1532*91f16700Schasinglulu   are supported by SMMUv3.
1533*91f16700Schasinglulu-  SMMUv3 offers non-secure stream support with secure stream support being
1534*91f16700Schasinglulu   optional. Logically, SMMUv3 behaves as if there is an indepdendent SMMU
1535*91f16700Schasinglulu   instance for secure and non-secure stream support.
1536*91f16700Schasinglulu-  It also supports sub-streams to differentiate traffic from a virtualized
1537*91f16700Schasinglulu   peripheral associated with a VM/SP.
1538*91f16700Schasinglulu-  Additionally, SMMUv3.2 provides support for PEs implementing Armv8.4-A
1539*91f16700Schasinglulu   extensions. Consequently, SPM depends on Secure EL2 support in SMMUv3.2
1540*91f16700Schasinglulu   for providing Secure Stage2 translation support to upstream peripheral
1541*91f16700Schasinglulu   devices.
1542*91f16700Schasinglulu
1543*91f16700SchasingluluSMMUv3 Programming Interfaces
1544*91f16700Schasinglulu-----------------------------
1545*91f16700Schasinglulu
1546*91f16700SchasingluluSMMUv3 has three software interfaces that are used by the Hafnium driver to
1547*91f16700Schasingluluconfigure the behaviour of SMMUv3 and manage the streams.
1548*91f16700Schasinglulu
1549*91f16700Schasinglulu-  Memory based data strutures that provide unique translation context for
1550*91f16700Schasinglulu   each stream.
1551*91f16700Schasinglulu-  Memory based circular buffers for command queue and event queue.
1552*91f16700Schasinglulu-  A large number of SMMU configuration registers that are memory mapped during
1553*91f16700Schasinglulu   boot time by Hafnium driver. Except a few registers, all configuration
1554*91f16700Schasinglulu   registers have independent secure and non-secure versions to configure the
1555*91f16700Schasinglulu   behaviour of SMMUv3 for translation of secure and non-secure streams
1556*91f16700Schasinglulu   respectively.
1557*91f16700Schasinglulu
1558*91f16700SchasingluluPeripheral device manifest
1559*91f16700Schasinglulu--------------------------
1560*91f16700Schasinglulu
1561*91f16700SchasingluluCurrently, SMMUv3 driver in Hafnium only supports dependent peripheral devices.
1562*91f16700SchasingluluThese devices are dependent on PE endpoint to initiate and receive memory
1563*91f16700Schasinglulumanagement transactions on their behalf. The acccess to the MMIO regions of
1564*91f16700Schasingluluany such device is assigned to the endpoint during boot. Moreover, SMMUv3 driver
1565*91f16700Schasingluluuses the same stage 2 translations for the device as those used by partition
1566*91f16700Schasinglulumanager on behalf of the PE endpoint. This ensures that the peripheral device
1567*91f16700Schasingluluhas the same visibility of the physical address space as the endpoint. The
1568*91f16700Schasingluludevice node of the corresponding partition manifest (refer to `[1]`_ section 3.2
1569*91f16700Schasinglulu) must specify these additional properties for each peripheral device in the
1570*91f16700Schasinglulusystem :
1571*91f16700Schasinglulu
1572*91f16700Schasinglulu-  smmu-id: This field helps to identify the SMMU instance that this device is
1573*91f16700Schasinglulu   upstream of.
1574*91f16700Schasinglulu-  stream-ids: List of stream IDs assigned to this device.
1575*91f16700Schasinglulu
1576*91f16700Schasinglulu.. code:: shell
1577*91f16700Schasinglulu
1578*91f16700Schasinglulu    smmuv3-testengine {
1579*91f16700Schasinglulu        base-address = <0x00000000 0x2bfe0000>;
1580*91f16700Schasinglulu        pages-count = <32>;
1581*91f16700Schasinglulu        attributes = <0x3>;
1582*91f16700Schasinglulu        smmu-id = <0>;
1583*91f16700Schasinglulu        stream-ids = <0x0 0x1>;
1584*91f16700Schasinglulu        interrupts = <0x2 0x3>, <0x4 0x5>;
1585*91f16700Schasinglulu        exclusive-access;
1586*91f16700Schasinglulu    };
1587*91f16700Schasinglulu
1588*91f16700SchasingluluSMMUv3 driver limitations
1589*91f16700Schasinglulu-------------------------
1590*91f16700Schasinglulu
1591*91f16700SchasingluluThe primary design goal for the Hafnium SMMU driver is to support secure
1592*91f16700Schasinglulustreams.
1593*91f16700Schasinglulu
1594*91f16700Schasinglulu-  Currently, the driver only supports Stage2 translations. No support for
1595*91f16700Schasinglulu   Stage1 or nested translations.
1596*91f16700Schasinglulu-  Supports only AArch64 translation format.
1597*91f16700Schasinglulu-  No support for features such as PCI Express (PASIDs, ATS, PRI), MSI, RAS,
1598*91f16700Schasinglulu   Fault handling, Performance Monitor Extensions, Event Handling, MPAM.
1599*91f16700Schasinglulu-  No support for independent peripheral devices.
1600*91f16700Schasinglulu
1601*91f16700SchasingluluS-EL0 Partition support
1602*91f16700Schasinglulu=======================
1603*91f16700SchasingluluThe SPMC (Hafnium) has limited capability to run S-EL0 FF-A partitions using
1604*91f16700SchasingluluFEAT_VHE (mandatory with ARMv8.1 in non-secure state, and in secure world
1605*91f16700Schasingluluwith ARMv8.4 and FEAT_SEL2).
1606*91f16700Schasinglulu
1607*91f16700SchasingluluS-EL0 partitions are useful for simple partitions that don't require full
1608*91f16700SchasingluluTrusted OS functionality. It is also useful to reduce jitter and cycle
1609*91f16700Schasinglulustealing from normal world since they are more lightweight than VMs.
1610*91f16700Schasinglulu
1611*91f16700SchasingluluS-EL0 partitions are presented, loaded and initialized the same as S-EL1 VMs by
1612*91f16700Schasingluluthe SPMC. They are differentiated primarily by the 'exception-level' property
1613*91f16700Schasingluluand the 'execution-ctx-count' property in the SP manifest. They are host apps
1614*91f16700Schasingluluunder the single EL2&0 Stage-1 translation regime controlled by the SPMC and
1615*91f16700Schasinglulucall into the SPMC through SVCs as opposed to HVCs and SMCs. These partitions
1616*91f16700Schasinglulucan use FF-A defined services (FFA_MEM_PERM_*) to update or change permissions
1617*91f16700Schasinglulufor memory regions.
1618*91f16700Schasinglulu
1619*91f16700SchasingluluS-EL0 partitions are required by the FF-A specification to be UP endpoints,
1620*91f16700Schasinglulucapable of migrating, and the SPMC enforces this requirement. The SPMC allows
1621*91f16700Schasinglulua S-EL0 partition to accept a direct message from secure world and normal world,
1622*91f16700Schasingluluand generate direct responses to them.
1623*91f16700SchasingluluAll S-EL0 partitions must use AArch64. AArch32 S-EL0 partitions are not supported.
1624*91f16700Schasinglulu
1625*91f16700SchasingluluMemory sharing, indirect messaging, and notifications functionality with S-EL0
1626*91f16700Schasinglulupartitions is supported.
1627*91f16700Schasinglulu
1628*91f16700SchasingluluInterrupt handling is not supported with S-EL0 partitions and is work in
1629*91f16700Schasingluluprogress.
1630*91f16700Schasinglulu
1631*91f16700SchasingluluReferences
1632*91f16700Schasinglulu==========
1633*91f16700Schasinglulu
1634*91f16700Schasinglulu.. _[1]:
1635*91f16700Schasinglulu
1636*91f16700Schasinglulu[1] `Arm Firmware Framework for Arm A-profile <https://developer.arm.com/docs/den0077/latest>`__
1637*91f16700Schasinglulu
1638*91f16700Schasinglulu.. _[2]:
1639*91f16700Schasinglulu
1640*91f16700Schasinglulu[2] :ref:`Secure Partition Manager using MM interface<Secure Partition Manager (MM)>`
1641*91f16700Schasinglulu
1642*91f16700Schasinglulu.. _[3]:
1643*91f16700Schasinglulu
1644*91f16700Schasinglulu[3] `Trusted Boot Board Requirements
1645*91f16700SchasingluluClient <https://developer.arm.com/documentation/den0006/d/>`__
1646*91f16700Schasinglulu
1647*91f16700Schasinglulu.. _[4]:
1648*91f16700Schasinglulu
1649*91f16700Schasinglulu[4] https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/lib/el3_runtime/aarch64/context.S#n45
1650*91f16700Schasinglulu
1651*91f16700Schasinglulu.. _[5]:
1652*91f16700Schasinglulu
1653*91f16700Schasinglulu[5] https://git.trustedfirmware.org/TF-A/tf-a-tests.git/tree/spm/cactus/plat/arm/fvp/fdts/cactus.dts
1654*91f16700Schasinglulu
1655*91f16700Schasinglulu.. _[6]:
1656*91f16700Schasinglulu
1657*91f16700Schasinglulu[6] https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
1658*91f16700Schasinglulu
1659*91f16700Schasinglulu.. _[7]:
1660*91f16700Schasinglulu
1661*91f16700Schasinglulu[7] https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/plat/arm/board/fvp/fdts/fvp_spmc_manifest.dts
1662*91f16700Schasinglulu
1663*91f16700Schasinglulu.. _[8]:
1664*91f16700Schasinglulu
1665*91f16700Schasinglulu[8] https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.org/thread/CFQFGU6H2D5GZYMUYGTGUSXIU3OYZP6U/
1666*91f16700Schasinglulu
1667*91f16700Schasinglulu.. _[9]:
1668*91f16700Schasinglulu
1669*91f16700Schasinglulu[9] https://trustedfirmware-a.readthedocs.io/en/latest/design/firmware-design.html#dynamic-configuration-during-cold-boot
1670*91f16700Schasinglulu
1671*91f16700Schasinglulu--------------
1672*91f16700Schasinglulu
1673*91f16700Schasinglulu*Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.*
1674