xref: /rk3399_ARM-atf/docs/components/realm-management-extension.rst (revision a7233c1a9559e99c7316afd69f7f9544ae1cf977)
13cfa3497SZelalem Aweke
23cfa3497SZelalem AwekeRealm Management Extension (RME)
33cfa3497SZelalem Aweke====================================
43cfa3497SZelalem Aweke
53cfa3497SZelalem AwekeFEAT_RME (or RME for short) is an Armv9-A extension and is one component of the
63cfa3497SZelalem Aweke`Arm Confidential Compute Architecture (Arm CCA)`_. TF-A supports RME starting
77446c266SZelalem Awekefrom version 2.6. This chapter discusses the changes to TF-A to support RME and
87446c266SZelalem Awekeprovides instructions on how to build and run TF-A with RME.
97446c266SZelalem Aweke
107446c266SZelalem AwekeRME support in TF-A
117446c266SZelalem Aweke---------------------
127446c266SZelalem Aweke
137446c266SZelalem AwekeThe following diagram shows an Arm CCA software architecture with TF-A as the
147446c266SZelalem AwekeEL3 firmware. In the Arm CCA architecture there are two additional security
157446c266SZelalem Awekestates and address spaces: ``Root`` and ``Realm``. TF-A firmware runs in the
16d9c976b0SSoby MathewRoot world. In the realm world, a Realm Management Monitor firmware (`RMM`_)
177446c266SZelalem Awekemanages the execution of Realm VMs and their interaction with the hypervisor.
187446c266SZelalem Aweke
197446c266SZelalem Aweke.. image:: ../resources/diagrams/arm-cca-software-arch.png
207446c266SZelalem Aweke
217446c266SZelalem AwekeRME is the hardware extension to support Arm CCA. To support RME, various
227446c266SZelalem Awekechanges have been introduced to TF-A. We discuss those changes below.
237446c266SZelalem Aweke
247446c266SZelalem AwekeChanges to translation tables library
257446c266SZelalem Aweke***************************************
267446c266SZelalem AwekeRME adds Root and Realm Physical address spaces. To support this, two new
277446c266SZelalem Awekememory type macros, ``MT_ROOT`` and ``MT_REALM``, have been added to the
287446c266SZelalem Aweke:ref:`Translation (XLAT) Tables Library`. These macros are used to configure
297446c266SZelalem Awekememory regions as Root or Realm respectively.
307446c266SZelalem Aweke
317446c266SZelalem Aweke.. note::
327446c266SZelalem Aweke
337446c266SZelalem Aweke Only version 2 of the translation tables library supports the new memory
347446c266SZelalem Aweke types.
357446c266SZelalem Aweke
367446c266SZelalem AwekeChanges to context management
377446c266SZelalem Aweke*******************************
38b5f120b5SBoyan KaratotevA new CPU context for the Realm world has been added. The existing can be used
39b5f120b5SBoyan Karatotevto manage Realm context.
407446c266SZelalem Aweke
417446c266SZelalem AwekeBoot flow changes
427446c266SZelalem Aweke*******************
437446c266SZelalem AwekeIn a typical TF-A boot flow, BL2 runs at Secure-EL1. However when RME is
447446c266SZelalem Awekeenabled, TF-A runs in the Root world at EL3. Therefore, the boot flow is
457446c266SZelalem Awekemodified to run BL2 at EL3 when RME is enabled. In addition to this, a
46d9c976b0SSoby MathewRealm-world firmware (`RMM`_) is loaded by BL2 in the Realm physical address
477446c266SZelalem Awekespace.
487446c266SZelalem Aweke
497446c266SZelalem AwekeThe boot flow when RME is enabled looks like the following:
507446c266SZelalem Aweke
517446c266SZelalem Aweke1. BL1 loads and executes BL2 at EL3
527446c266SZelalem Aweke2. BL2 loads images including RMM
537446c266SZelalem Aweke3. BL2 transfers control to BL31
547446c266SZelalem Aweke4. BL31 initializes SPM (if SPM is enabled)
557446c266SZelalem Aweke5. BL31 initializes RMM
567446c266SZelalem Aweke6. BL31 transfers control to Normal-world software
577446c266SZelalem Aweke
587446c266SZelalem AwekeGranule Protection Tables (GPT) library
597446c266SZelalem Aweke*****************************************
607446c266SZelalem AwekeIsolation between the four physical address spaces is enforced by a process
617446c266SZelalem Awekecalled Granule Protection Check (GPC) performed by the MMU downstream any
627446c266SZelalem Awekeaddress translation. GPC makes use of Granule Protection Table (GPT) in the
637446c266SZelalem AwekeRoot world that describes the physical address space assignment of every
647446c266SZelalem Awekepage (granule). A GPT library that provides APIs to initialize GPTs and to
657446c266SZelalem Aweketransition granules between different physical address spaces has been added.
667446c266SZelalem AwekeMore information about the GPT library can be found in the
677446c266SZelalem Aweke:ref:`Granule Protection Tables Library` chapter.
687446c266SZelalem Aweke
697446c266SZelalem AwekeRMM Dispatcher (RMMD)
707446c266SZelalem Aweke************************
717446c266SZelalem AwekeRMMD is a new standard runtime service that handles the switch to the Realm
72d9c976b0SSoby Mathewworld. It initializes the `RMM`_ and handles Realm Management Interface (RMI)
73d9c976b0SSoby MathewSMC calls from Non-secure.
747446c266SZelalem Aweke
75d9c976b0SSoby MathewThere is a contract between `RMM`_ and RMMD that defines the arguments that the
7669447290SJavier Almansa Sobrinoformer needs to take in order to initialize and also the possible return values.
77d9c976b0SSoby MathewThis contract is defined in the `RMM`_ Boot Interface, which can be found at
7869447290SJavier Almansa Sobrino:ref:`rmm_el3_boot_interface`.
7969447290SJavier Almansa Sobrino
8069447290SJavier Almansa SobrinoThere is also a specification of the runtime services provided by TF-A
81d9c976b0SSoby Mathewto `RMM`_. This can be found at :ref:`runtime_services_and_interface`.
8269447290SJavier Almansa Sobrino
837446c266SZelalem AwekeTest Realm Payload (TRP)
847446c266SZelalem Aweke*************************
857446c266SZelalem AwekeTRP is a small test payload that runs at R-EL2 and implements a subset of
867446c266SZelalem Awekethe Realm Management Interface (RMI) commands to primarily test EL3 firmware
877446c266SZelalem Awekeand the interface between R-EL2 and EL3. When building TF-A with RME enabled,
88d9c976b0SSoby Mathewif the path to an RMM image is not provided, TF-A builds the TRP by default
89d9c976b0SSoby Mathewand uses it as the R-EL2 payload.
903cfa3497SZelalem Aweke
913cfa3497SZelalem AwekeBuilding and running TF-A with RME
92d9c976b0SSoby Mathew----------------------------------
933cfa3497SZelalem Aweke
94*8063b7f5SOlivier DeprezThe recommended procedure for building and running an RME enabled reference
95*8063b7f5SOlivier Deprezplatform is by the use of `Shrinkwrap`_.
963cfa3497SZelalem Aweke
97*8063b7f5SOlivier DeprezThe tool offers examples of Three-worlds and Four-worlds configurations for
98*8063b7f5SOlivier Deprezrunning on the *FVP_Base_RevC-2xAEMvA* model.
993cfa3497SZelalem Aweke
100*8063b7f5SOlivier Deprez- Three-world execution: this is the configuration to use if Secure
101*8063b7f5SOlivier Deprez  world functionality is not needed.
1023cfa3497SZelalem Aweke
103*8063b7f5SOlivier Deprez- Four-world execution: this is the configuration to use if both Secure
104*8063b7f5SOlivier Deprez  and Realm world functionality is needed.
10599d9ce8aSShruti Gupta
106*8063b7f5SOlivier DeprezTF-A is tested with the following software entities in each world as listed below:
10799d9ce8aSShruti Gupta
108*8063b7f5SOlivier Deprez  - NS Host (RME capable Linux),
109*8063b7f5SOlivier Deprez  - EL3 Root (TF-A)
110*8063b7f5SOlivier Deprez  - R-EL2 (`RMM`_)
111*8063b7f5SOlivier Deprez  - S-EL2 (`SPM`_ / Hafnium) in a 4-worlds configuration
1123cfa3497SZelalem Aweke
113*8063b7f5SOlivier DeprezAdditionally, the TF-RMM project documentation has the specific `Shrinkwrap guide`_.
1143cfa3497SZelalem Aweke
115*8063b7f5SOlivier DeprezTF-A CI pipeline includes coverage for building TF-A along with TF-RMM and SPM/Hafnium
116*8063b7f5SOlivier Deprezfor running 3 worlds and 4 worlds configurations. In those cases, the normal world payload
117*8063b7f5SOlivier Deprezand test suite originates from TF-a-tests project.
1183cfa3497SZelalem Aweke
1193cfa3497SZelalem Aweke.. _Arm Confidential Compute Architecture (Arm CCA): https://www.arm.com/why-arm/architecture/security-features/arm-confidential-compute-architecture
120*8063b7f5SOlivier Deprez.. _SPM: https://www.trustedfirmware.org/projects/hafnium/
121d9c976b0SSoby Mathew.. _RMM: https://www.trustedfirmware.org/projects/tf-rmm/
122*8063b7f5SOlivier Deprez.. _Shrinkwrap: https://shrinkwrap.docs.arm.com/en/latest/
123*8063b7f5SOlivier Deprez.. _Shrinkwrap guide: https://tf-rmm.readthedocs.io/en/latest/getting_started/building-with-shrinkwrap.html
124