xref: /rk3399_ARM-atf/docs/components/realm-management-extension.rst (revision 3cfa3497bace3e77fd1020fb125b130756c54355)
1*3cfa3497SZelalem Aweke
2*3cfa3497SZelalem AwekeRealm Management Extension (RME)
3*3cfa3497SZelalem Aweke====================================
4*3cfa3497SZelalem Aweke
5*3cfa3497SZelalem AwekeFEAT_RME (or RME for short) is an Armv9-A extension and is one component of the
6*3cfa3497SZelalem Aweke`Arm Confidential Compute Architecture (Arm CCA)`_. TF-A supports RME starting
7*3cfa3497SZelalem Awekefrom version 2.6. This document provides instructions on how to build and run
8*3cfa3497SZelalem AwekeTF-A with RME.
9*3cfa3497SZelalem Aweke
10*3cfa3497SZelalem AwekeBuilding and running TF-A with RME
11*3cfa3497SZelalem Aweke------------------------------------
12*3cfa3497SZelalem Aweke
13*3cfa3497SZelalem AwekeThis section describes how you can build and run TF-A with RME enabled.
14*3cfa3497SZelalem AwekeWe assume you have all the :ref:`Prerequisites` to build TF-A.
15*3cfa3497SZelalem Aweke
16*3cfa3497SZelalem AwekeTo enable RME, you need to set the ENABLE_RME build flag when building
17*3cfa3497SZelalem AwekeTF-A. Currently, this feature is only supported for the FVP platform.
18*3cfa3497SZelalem Aweke
19*3cfa3497SZelalem AwekeThe following instructions show you how to build and run TF-A with RME
20*3cfa3497SZelalem Awekefor two scenarios: TF-A with TF-A Tests, and four-world execution with
21*3cfa3497SZelalem AwekeHafnium and TF-A Tests. The instructions assume you have already obtained
22*3cfa3497SZelalem AwekeTF-A. You can use the following command to clone TF-A.
23*3cfa3497SZelalem Aweke
24*3cfa3497SZelalem Aweke.. code:: shell
25*3cfa3497SZelalem Aweke
26*3cfa3497SZelalem Aweke git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
27*3cfa3497SZelalem Aweke
28*3cfa3497SZelalem AwekeTo run the tests, you need an FVP model. You can download a model that supports
29*3cfa3497SZelalem AwekeRME from the `Arm Architecture Models website`_. Please select the
30*3cfa3497SZelalem Aweke*Base RevC AEM FVP* model. After extracting the downloaded file, you should be able to
31*3cfa3497SZelalem Awekefind the *FVP_Base_RevC-2xAEMvA* binary. The instructions below have been tested
32*3cfa3497SZelalem Awekewith model version 11.15 revision 18.
33*3cfa3497SZelalem Aweke
34*3cfa3497SZelalem Aweke.. note::
35*3cfa3497SZelalem Aweke
36*3cfa3497SZelalem Aweke ENABLE_RME build option is currently experimental.
37*3cfa3497SZelalem Aweke
38*3cfa3497SZelalem AwekeBuilding TF-A with TF-A Tests
39*3cfa3497SZelalem Aweke********************************************
40*3cfa3497SZelalem AwekeUse the following instructions to build TF-A with `TF-A Tests`_ as the
41*3cfa3497SZelalem Awekenon-secure payload (BL33).
42*3cfa3497SZelalem Aweke
43*3cfa3497SZelalem Aweke**1. Obtain and build TF-A Tests**
44*3cfa3497SZelalem Aweke
45*3cfa3497SZelalem Aweke.. code:: shell
46*3cfa3497SZelalem Aweke
47*3cfa3497SZelalem Aweke git clone https://git.trustedfirmware.org/TF-A/tf-a-tests.git
48*3cfa3497SZelalem Aweke cd tf-a-tests
49*3cfa3497SZelalem Aweke make CROSS_COMPILE=aarch64-none-elf- PLAT=fvp DEBUG=1
50*3cfa3497SZelalem Aweke
51*3cfa3497SZelalem AwekeThis produces a TF-A Tests binary (*tftf.bin*) in the *build/fvp/debug* directory.
52*3cfa3497SZelalem Aweke
53*3cfa3497SZelalem Aweke**2. Build TF-A**
54*3cfa3497SZelalem Aweke
55*3cfa3497SZelalem Aweke.. code:: shell
56*3cfa3497SZelalem Aweke
57*3cfa3497SZelalem Aweke cd trusted-firmware-a
58*3cfa3497SZelalem Aweke make CROSS_COMPILE=aarch64-none-elf- \
59*3cfa3497SZelalem Aweke PLAT=fvp \
60*3cfa3497SZelalem Aweke ENABLE_RME=1 \
61*3cfa3497SZelalem Aweke FVP_HW_CONFIG_DTS=fdts/fvp-base-gicv3-psci-1t.dts \
62*3cfa3497SZelalem Aweke DEBUG=1 \
63*3cfa3497SZelalem Aweke BL33=<path/to/tftf.bin> \
64*3cfa3497SZelalem Aweke all fip
65*3cfa3497SZelalem Aweke
66*3cfa3497SZelalem AwekeThis produces *bl1.bin* and *fip.bin* binaries in the *build/fvp/debug* directory.
67*3cfa3497SZelalem AwekeThe above command also builds a Test Realm Payload (TRP), which is a small test
68*3cfa3497SZelalem Awekepayload that implements Realm Monitor Management (RMM) functionalities and runs
69*3cfa3497SZelalem Awekein the realm world (R-EL2). The TRP binary is packaged in *fip.bin*.
70*3cfa3497SZelalem Aweke
71*3cfa3497SZelalem AwekeFour-world execution with Hafnium and TF-A Tests
72*3cfa3497SZelalem Aweke****************************************************
73*3cfa3497SZelalem AwekeFour-world execution involves software components at each security state: root,
74*3cfa3497SZelalem Awekesecure, realm and non-secure. This section describes how to build TF-A
75*3cfa3497SZelalem Awekewith four-world support. We use TF-A as the root firmware, `Hafnium`_ as the
76*3cfa3497SZelalem Awekesecure component, TRP as the realm-world firmware and TF-A Tests as the
77*3cfa3497SZelalem Awekenon-secure payload.
78*3cfa3497SZelalem Aweke
79*3cfa3497SZelalem AwekeBefore building TF-A, you first need to build the other software components.
80*3cfa3497SZelalem AwekeYou can find instructions on how to get and build TF-A Tests above.
81*3cfa3497SZelalem Aweke
82*3cfa3497SZelalem Aweke**1. Obtain and build Hafnium**
83*3cfa3497SZelalem Aweke
84*3cfa3497SZelalem Aweke.. code:: shell
85*3cfa3497SZelalem Aweke
86*3cfa3497SZelalem Aweke git clone --recurse-submodules https://git.trustedfirmware.org/hafnium/hafnium.git
87*3cfa3497SZelalem Aweke cd hafnium
88*3cfa3497SZelalem Aweke make PROJECT=reference
89*3cfa3497SZelalem Aweke
90*3cfa3497SZelalem AwekeThe Hafnium binary should be located at
91*3cfa3497SZelalem Aweke*out/reference/secure_aem_v8a_fvp_clang/hafnium.bin*
92*3cfa3497SZelalem Aweke
93*3cfa3497SZelalem Aweke**2. Build TF-A**
94*3cfa3497SZelalem Aweke
95*3cfa3497SZelalem AwekeBuild TF-A with RME as well as SPM enabled.
96*3cfa3497SZelalem Aweke
97*3cfa3497SZelalem Aweke.. code:: shell
98*3cfa3497SZelalem Aweke
99*3cfa3497SZelalem Aweke make CROSS_COMPILE=aarch64-none-elf- \
100*3cfa3497SZelalem Aweke PLAT=fvp \
101*3cfa3497SZelalem Aweke ENABLE_RME=1 \
102*3cfa3497SZelalem Aweke FVP_HW_CONFIG_DTS=fdts/fvp-base-gicv3-psci-1t.dts \
103*3cfa3497SZelalem Aweke SPD=spmd \
104*3cfa3497SZelalem Aweke SPMD_SPM_AT_SEL2=1 \
105*3cfa3497SZelalem Aweke BRANCH_PROTECTION=1 \
106*3cfa3497SZelalem Aweke CTX_INCLUDE_PAUTH_REGS=1 \
107*3cfa3497SZelalem Aweke DEBUG=1 \
108*3cfa3497SZelalem Aweke SP_LAYOUT_FILE=<path/to/tf-a-tests>/build/fvp/debug/sp_layout.json> \
109*3cfa3497SZelalem Aweke BL32=<path/to/hafnium.bin> \
110*3cfa3497SZelalem Aweke BL33=<path/to/tftf.bin> \
111*3cfa3497SZelalem Aweke all fip
112*3cfa3497SZelalem Aweke
113*3cfa3497SZelalem AwekeRunning the tests
114*3cfa3497SZelalem Aweke*********************
115*3cfa3497SZelalem AwekeUse the following command to run the tests on FVP. TF-A Tests should boot
116*3cfa3497SZelalem Awekeand run the default tests including RME tests.
117*3cfa3497SZelalem Aweke
118*3cfa3497SZelalem Aweke.. code:: shell
119*3cfa3497SZelalem Aweke
120*3cfa3497SZelalem Aweke FVP_Base_RevC-2xAEMvA \
121*3cfa3497SZelalem Aweke -C bp.flashloader0.fname=<path/to/fip.bin> \
122*3cfa3497SZelalem Aweke -C bp.secureflashloader.fname=<path/to/bl1.bin> \
123*3cfa3497SZelalem Aweke -C bp.refcounter.non_arch_start_at_default=1 \
124*3cfa3497SZelalem Aweke -C bp.refcounter.use_real_time=0 \
125*3cfa3497SZelalem Aweke -C bp.ve_sysregs.exit_on_shutdown=1 \
126*3cfa3497SZelalem Aweke -C cache_state_modelled=1 \
127*3cfa3497SZelalem Aweke -C cluster0.NUM_CORES=4 \
128*3cfa3497SZelalem Aweke -C cluster0.PA_SIZE=48 \
129*3cfa3497SZelalem Aweke -C cluster0.ecv_support_level=2 \
130*3cfa3497SZelalem Aweke -C cluster0.gicv3.cpuintf-mmap-access-level=2 \
131*3cfa3497SZelalem Aweke -C cluster0.gicv3.without-DS-support=1 \
132*3cfa3497SZelalem Aweke -C cluster0.gicv4.mask-virtual-interrupt=1 \
133*3cfa3497SZelalem Aweke -C cluster0.has_arm_v8-6=1 \
134*3cfa3497SZelalem Aweke -C cluster0.has_branch_target_exception=1 \
135*3cfa3497SZelalem Aweke -C cluster0.has_rme=1 \
136*3cfa3497SZelalem Aweke -C cluster0.has_rndr=1 \
137*3cfa3497SZelalem Aweke -C cluster0.has_amu=1 \
138*3cfa3497SZelalem Aweke -C cluster0.has_v8_7_pmu_extension=2 \
139*3cfa3497SZelalem Aweke -C cluster0.max_32bit_el=-1 \
140*3cfa3497SZelalem Aweke -C cluster0.restriction_on_speculative_execution=2 \
141*3cfa3497SZelalem Aweke -C cluster0.restriction_on_speculative_execution_aarch32=2 \
142*3cfa3497SZelalem Aweke -C cluster1.NUM_CORES=4 \
143*3cfa3497SZelalem Aweke -C cluster1.PA_SIZE=48 \
144*3cfa3497SZelalem Aweke -C cluster1.ecv_support_level=2 \
145*3cfa3497SZelalem Aweke -C cluster1.gicv3.cpuintf-mmap-access-level=2 \
146*3cfa3497SZelalem Aweke -C cluster1.gicv3.without-DS-support=1 \
147*3cfa3497SZelalem Aweke -C cluster1.gicv4.mask-virtual-interrupt=1 \
148*3cfa3497SZelalem Aweke -C cluster1.has_arm_v8-6=1 \
149*3cfa3497SZelalem Aweke -C cluster1.has_branch_target_exception=1 \
150*3cfa3497SZelalem Aweke -C cluster1.has_rme=1 \
151*3cfa3497SZelalem Aweke -C cluster1.has_rndr=1 \
152*3cfa3497SZelalem Aweke -C cluster1.has_amu=1 \
153*3cfa3497SZelalem Aweke -C cluster1.has_v8_7_pmu_extension=2 \
154*3cfa3497SZelalem Aweke -C cluster1.max_32bit_el=-1 \
155*3cfa3497SZelalem Aweke -C cluster1.restriction_on_speculative_execution=2 \
156*3cfa3497SZelalem Aweke -C cluster1.restriction_on_speculative_execution_aarch32=2 \
157*3cfa3497SZelalem Aweke -C pci.pci_smmuv3.mmu.SMMU_AIDR=2 \
158*3cfa3497SZelalem Aweke -C pci.pci_smmuv3.mmu.SMMU_IDR0=0x0046123B \
159*3cfa3497SZelalem Aweke -C pci.pci_smmuv3.mmu.SMMU_IDR1=0x00600002 \
160*3cfa3497SZelalem Aweke -C pci.pci_smmuv3.mmu.SMMU_IDR3=0x1714 \
161*3cfa3497SZelalem Aweke -C pci.pci_smmuv3.mmu.SMMU_IDR5=0xFFFF0475 \
162*3cfa3497SZelalem Aweke -C pci.pci_smmuv3.mmu.SMMU_S_IDR1=0xA0000002 \
163*3cfa3497SZelalem Aweke -C pci.pci_smmuv3.mmu.SMMU_S_IDR2=0 \
164*3cfa3497SZelalem Aweke -C pci.pci_smmuv3.mmu.SMMU_S_IDR3=0 \
165*3cfa3497SZelalem Aweke -C bp.pl011_uart0.out_file=uart0.log \
166*3cfa3497SZelalem Aweke -C bp.pl011_uart1.out_file=uart1.log \
167*3cfa3497SZelalem Aweke -C bp.pl011_uart2.out_file=uart2.log \
168*3cfa3497SZelalem Aweke -C pctl.startup=0.0.0.0 \
169*3cfa3497SZelalem Aweke -Q 1000 \
170*3cfa3497SZelalem Aweke "$@"
171*3cfa3497SZelalem Aweke
172*3cfa3497SZelalem AwekeThe bottom of the output from *uart0* should look something like the following.
173*3cfa3497SZelalem Aweke
174*3cfa3497SZelalem Aweke.. code-block:: shell
175*3cfa3497SZelalem Aweke
176*3cfa3497SZelalem Aweke ...
177*3cfa3497SZelalem Aweke
178*3cfa3497SZelalem Aweke > Test suite 'FF-A Interrupt'
179*3cfa3497SZelalem Aweke                                                                Passed
180*3cfa3497SZelalem Aweke > Test suite 'SMMUv3 tests'
181*3cfa3497SZelalem Aweke                                                                Passed
182*3cfa3497SZelalem Aweke > Test suite 'PMU Leakage'
183*3cfa3497SZelalem Aweke                                                                Passed
184*3cfa3497SZelalem Aweke > Test suite 'DebugFS'
185*3cfa3497SZelalem Aweke                                                                Passed
186*3cfa3497SZelalem Aweke > Test suite 'Realm payload tests'
187*3cfa3497SZelalem Aweke                                                                Passed
188*3cfa3497SZelalem Aweke ...
189*3cfa3497SZelalem Aweke
190*3cfa3497SZelalem Aweke
191*3cfa3497SZelalem Aweke.. _Arm Confidential Compute Architecture (Arm CCA): https://www.arm.com/why-arm/architecture/security-features/arm-confidential-compute-architecture
192*3cfa3497SZelalem Aweke.. _Arm Architecture Models website: https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms/arm-ecosystem-models
193*3cfa3497SZelalem Aweke.. _TF-A Tests: https://trustedfirmware-a-tests.readthedocs.io/en/latest
194*3cfa3497SZelalem Aweke.. _Hafnium: https://www.trustedfirmware.org/projects/hafnium
195