xref: /rk3399_ARM-atf/docs/components/rmm-el3-comms-spec.rst (revision 24804eeb334e17a34f7e755eda420cd83079f40b)
169447290SJavier Almansa SobrinoRMM-EL3 Communication interface
269447290SJavier Almansa Sobrino*******************************
369447290SJavier Almansa Sobrino
469447290SJavier Almansa SobrinoThis document defines the communication interface between RMM and EL3.
569447290SJavier Almansa SobrinoThere are two parts in this interface: the boot interface and the runtime
669447290SJavier Almansa Sobrinointerface.
769447290SJavier Almansa Sobrino
869447290SJavier Almansa SobrinoThe Boot Interface defines the ABI between EL3 and RMM when the CPU enters
969447290SJavier Almansa SobrinoR-EL2 for the first time after boot. The cold boot interface defines the ABI
1069447290SJavier Almansa Sobrinofor the cold boot path and the warm boot interface defines the same for the
1169447290SJavier Almansa Sobrinowarm path.
1269447290SJavier Almansa Sobrino
1369447290SJavier Almansa SobrinoThe RMM-EL3 runtime interface defines the ABI for EL3 services which can be
1469447290SJavier Almansa Sobrinoinvoked by RMM as well as the register save-restore convention when handling an
1569447290SJavier Almansa SobrinoSMC call from NS.
1669447290SJavier Almansa Sobrino
1769447290SJavier Almansa SobrinoThe below sections discuss these interfaces more in detail.
1869447290SJavier Almansa Sobrino
1969447290SJavier Almansa Sobrino.. _rmm_el3_ifc_versioning:
2069447290SJavier Almansa Sobrino
2169447290SJavier Almansa SobrinoRMM-EL3 Interface versioning
2269447290SJavier Almansa Sobrino____________________________
2369447290SJavier Almansa Sobrino
2469447290SJavier Almansa SobrinoThe RMM Boot and Runtime Interface uses a version number to check
2569447290SJavier Almansa Sobrinocompatibility with the register arguments passed as part of Boot Interface and
2669447290SJavier Almansa SobrinoRMM-EL3 runtime interface.
2769447290SJavier Almansa Sobrino
2869447290SJavier Almansa SobrinoThe Boot Manifest, discussed later in section :ref:`rmm_el3_boot_manifest`,
2969447290SJavier Almansa Sobrinouses a separate version number but with the same scheme.
3069447290SJavier Almansa Sobrino
3169447290SJavier Almansa SobrinoThe version number is a 32-bit type with the following fields:
3269447290SJavier Almansa Sobrino
3369447290SJavier Almansa Sobrino.. csv-table::
3469447290SJavier Almansa Sobrino   :header: "Bits", "Value"
3569447290SJavier Almansa Sobrino
3669447290SJavier Almansa Sobrino   [0:15],``VERSION_MINOR``
3769447290SJavier Almansa Sobrino   [16:30],``VERSION_MAJOR``
3869447290SJavier Almansa Sobrino   [31],RES0
3969447290SJavier Almansa Sobrino
4069447290SJavier Almansa SobrinoThe version numbers are sequentially increased and the rules for updating them
4169447290SJavier Almansa Sobrinoare explained below:
4269447290SJavier Almansa Sobrino
4369447290SJavier Almansa Sobrino  - ``VERSION_MAJOR``: This value is increased when changes break
4469447290SJavier Almansa Sobrino    compatibility with previous versions. If the changes
4569447290SJavier Almansa Sobrino    on the ABI are compatible with the previous one, ``VERSION_MAJOR``
4669447290SJavier Almansa Sobrino    remains unchanged.
4769447290SJavier Almansa Sobrino
4869447290SJavier Almansa Sobrino  - ``VERSION_MINOR``: This value is increased on any change that is backwards
4969447290SJavier Almansa Sobrino    compatible with the previous version. When ``VERSION_MAJOR`` is increased,
5069447290SJavier Almansa Sobrino    ``VERSION_MINOR`` must be set to 0.
5169447290SJavier Almansa Sobrino
5269447290SJavier Almansa Sobrino  - ``RES0``: Bit 31 of the version number is reserved 0 as to maintain
5369447290SJavier Almansa Sobrino    consistency with the versioning schemes used in other parts of RMM.
5469447290SJavier Almansa Sobrino
55*00e62ff9SJuan Pablo CondeThis document specifies the 0.8 version of Boot Interface ABI and RMM-EL3
56f801fdc2STushar Khandelwalservices specification and the 0.5 version of the Boot Manifest.
5769447290SJavier Almansa Sobrino
5869447290SJavier Almansa Sobrino.. _rmm_el3_boot_interface:
5969447290SJavier Almansa Sobrino
6069447290SJavier Almansa SobrinoRMM Boot Interface
6169447290SJavier Almansa Sobrino__________________
6269447290SJavier Almansa Sobrino
6369447290SJavier Almansa SobrinoThis section deals with the Boot Interface part of the specification.
6469447290SJavier Almansa Sobrino
6569447290SJavier Almansa SobrinoOne of the goals of the Boot Interface is to allow EL3 firmware to pass
6669447290SJavier Almansa Sobrinodown into RMM certain platform specific information dynamically. This allows
6769447290SJavier Almansa SobrinoRMM to be less platform dependent and be more generic across platform
6869447290SJavier Almansa Sobrinovariations. It also allows RMM to be decoupled from the other boot loader
6969447290SJavier Almansa Sobrinoimages in the boot sequence and remain agnostic of any particular format used
7069447290SJavier Almansa Sobrinofor configuration files.
7169447290SJavier Almansa Sobrino
7269447290SJavier Almansa SobrinoThe Boot Interface ABI defines a set of register conventions and
7369447290SJavier Almansa Sobrinoalso a memory based manifest file to pass information from EL3 to RMM. The
741db295cfSAlexeiFedorovBoot Manifest and the associated platform data in it can be dynamically created
7569447290SJavier Almansa Sobrinoby EL3 and there is no restriction on how the data can be obtained (e.g by DTB,
7669447290SJavier Almansa Sobrinohoblist or other).
7769447290SJavier Almansa Sobrino
7869447290SJavier Almansa SobrinoThe register convention and the manifest are versioned separately to manage
7969447290SJavier Almansa Sobrinofuture enhancements and compatibility.
8069447290SJavier Almansa Sobrino
8169447290SJavier Almansa SobrinoRMM completes the boot by issuing the ``RMM_BOOT_COMPLETE`` SMC (0xC40001CF)
8269447290SJavier Almansa Sobrinoback to EL3. After the RMM has finished the boot process, it can only be
8369447290SJavier Almansa Sobrinoentered from EL3 as part of RMI handling.
8469447290SJavier Almansa Sobrino
8569447290SJavier Almansa SobrinoIf RMM returns an error during boot (in any CPU), then RMM must not be entered
8669447290SJavier Almansa Sobrinofrom any CPU.
8769447290SJavier Almansa Sobrino
8869447290SJavier Almansa Sobrino.. _rmm_cold_boot_interface:
8969447290SJavier Almansa Sobrino
9069447290SJavier Almansa SobrinoCold Boot Interface
9169447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~
9269447290SJavier Almansa Sobrino
9369447290SJavier Almansa SobrinoDuring cold boot RMM expects the following register values:
9469447290SJavier Almansa Sobrino
9569447290SJavier Almansa Sobrino.. csv-table::
9669447290SJavier Almansa Sobrino   :header: "Register", "Value"
9769447290SJavier Almansa Sobrino   :widths: 1, 5
9869447290SJavier Almansa Sobrino
9969447290SJavier Almansa Sobrino   x0,Linear index of this PE. This index starts from 0 and must be less than the maximum number of CPUs to be supported at runtime (see x2).
10069447290SJavier Almansa Sobrino   x1,Version for this Boot Interface as defined in :ref:`rmm_el3_ifc_versioning`.
10169447290SJavier Almansa Sobrino   x2,Maximum number of CPUs to be supported at runtime. RMM should ensure that it can support this maximum number.
1021db295cfSAlexeiFedorov   x3,Base address for the shared buffer used for communication between EL3 firmware and RMM. This buffer must be of 4KB size (1 page). The Boot Manifest must be present at the base of this shared buffer during cold boot.
103745c129aSAndre Przywara   x4,"Activation token. Should be set to 0 on the initial boot of the system. For a subsequent warm boot or when using Live Firmware Activation, the activation token should be set to the value returned by RMM for this CPU during the initial boot (in x2)."
10469447290SJavier Almansa Sobrino
105dc0ca64eSJavier Almansa SobrinoDuring cold boot, EL3 firmware needs to allocate a 4KB page that will be
10669447290SJavier Almansa Sobrinopassed to RMM in x3. This memory will be used as shared buffer for communication
10769447290SJavier Almansa Sobrinobetween EL3 and RMM. It must be assigned to Realm world and must be mapped with
10869447290SJavier Almansa SobrinoNormal memory attributes (IWB-OWB-ISH) at EL3. At boot, this memory will be
10969447290SJavier Almansa Sobrinoused to populate the Boot Manifest. Since the Boot Manifest can be accessed by
11069447290SJavier Almansa SobrinoRMM prior to enabling its MMU, EL3 must ensure that proper cache maintenance
11169447290SJavier Almansa Sobrinooperations are performed after the Boot Manifest is populated.
11269447290SJavier Almansa Sobrino
11369447290SJavier Almansa SobrinoEL3 should also ensure that this shared buffer is always available for use by RMM
11469447290SJavier Almansa Sobrinoduring the lifetime of the system and that it can be used for runtime
11569447290SJavier Almansa Sobrinocommunication between RMM and EL3. For example, when RMM invokes attestation
11669447290SJavier Almansa Sobrinoservice commands in EL3, this buffer can be used to exchange data between RMM
11769447290SJavier Almansa Sobrinoand EL3. It is also allowed for RMM to invoke runtime services provided by EL3
11869447290SJavier Almansa Sobrinoutilizing this buffer during the boot phase, prior to return back to EL3 via
11969447290SJavier Almansa SobrinoRMM_BOOT_COMPLETE SMC.
12069447290SJavier Almansa Sobrino
12169447290SJavier Almansa SobrinoRMM should map this memory page into its Stage 1 page-tables using Normal
12269447290SJavier Almansa Sobrinomemory attributes.
12369447290SJavier Almansa Sobrino
12469447290SJavier Almansa SobrinoDuring runtime, it is the RMM which initiates any communication with EL3. If that
12569447290SJavier Almansa Sobrinocommunication requires the use of the shared area, it is expected that RMM needs
12669447290SJavier Almansa Sobrinoto do the necessary concurrency protection to prevent the use of the same buffer
12769447290SJavier Almansa Sobrinoby other PEs.
12869447290SJavier Almansa Sobrino
12969447290SJavier Almansa SobrinoThe following sequence diagram shows how a generic EL3 Firmware would boot RMM.
13069447290SJavier Almansa Sobrino
13169447290SJavier Almansa Sobrino.. image:: ../resources/diagrams/rmm_cold_boot_generic.png
13269447290SJavier Almansa Sobrino
13369447290SJavier Almansa SobrinoWarm Boot Interface
13469447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~
13569447290SJavier Almansa Sobrino
13669447290SJavier Almansa SobrinoAt warm boot, RMM is already initialized and only some per-CPU initialization
13769447290SJavier Almansa Sobrinois still pending. The only argument that is required by RMM at this stage is
13869447290SJavier Almansa Sobrinothe CPU Id, which will be passed through register x0 whilst x1 to x3 are RES0.
13969447290SJavier Almansa SobrinoThis is summarized in the following table:
14069447290SJavier Almansa Sobrino
14169447290SJavier Almansa Sobrino.. csv-table::
14269447290SJavier Almansa Sobrino   :header: "Register", "Value"
14369447290SJavier Almansa Sobrino   :widths: 1, 5
14469447290SJavier Almansa Sobrino
14569447290SJavier Almansa Sobrino   x0,Linear index of this PE. This index starts from 0 and must be less than the maximum number of CPUs to be supported at runtime (see x2).
146745c129aSAndre Przywara   x1,"Activation token. Should be set to 0 on the initial boot of the system. For a subsequent warm boot or when using Live Firmware Activation, the activation token should be set to the value returned by RMM for this CPU during the initial boot (in x2)."
147745c129aSAndre Przywara   x2 - x3,RES0
14869447290SJavier Almansa Sobrino
14969447290SJavier Almansa SobrinoBoot error handling and return values
15069447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15169447290SJavier Almansa Sobrino
15269447290SJavier Almansa SobrinoAfter boot up and initialization, RMM returns control back to EL3 through a
153745c129aSAndre Przywara``RMM_BOOT_COMPLETE`` SMC call. The first argument of this SMC call will
154745c129aSAndre Przywarabe returned in x1 and it will encode a signed integer with the error reason.
155745c129aSAndre Przywarax2 will contain the per-CPU activation token, which is an opaque value that
156745c129aSAndre Przywarashould be passed back to RMM when doing Live Firmware Activations or on a
157745c129aSAndre Przywarasubsequent warm boot.
158745c129aSAndre PrzywaraThe following table describes possible values for the error code in x1:
15969447290SJavier Almansa Sobrino
16069447290SJavier Almansa Sobrino.. csv-table::
16169447290SJavier Almansa Sobrino   :header: "Error code", "Description", "ID"
16269447290SJavier Almansa Sobrino   :widths: 2 4 1
16369447290SJavier Almansa Sobrino
16469447290SJavier Almansa Sobrino   ``E_RMM_BOOT_SUCCESS``,Boot successful,0
16569447290SJavier Almansa Sobrino   ``E_RMM_BOOT_ERR_UNKNOWN``,Unknown error,-1
16669447290SJavier Almansa Sobrino   ``E_RMM_BOOT_VERSION_NOT_VALID``,Boot Interface version reported by EL3 is not supported by RMM,-2
167ca99680cSJavier Almansa Sobrino   ``E_RMM_BOOT_CPUS_OUT_OF_RANGE``,Number of CPUs reported by EL3 larger than maximum supported by RMM,-3
168ca99680cSJavier Almansa Sobrino   ``E_RMM_BOOT_CPU_ID_OUT_OF_RANGE``,Current CPU Id is higher or equal than the number of CPUs supported by RMM,-4
16969447290SJavier Almansa Sobrino   ``E_RMM_BOOT_INVALID_SHARED_BUFFER``,Invalid pointer to shared memory area,-5
1701db295cfSAlexeiFedorov   ``E_RMM_BOOT_MANIFEST_VERSION_NOT_SUPPORTED``,Version reported by the Boot Manifest not supported by RMM,-6
1711db295cfSAlexeiFedorov   ``E_RMM_BOOT_MANIFEST_DATA_ERROR``,Error parsing core Boot Manifest,-7
17269447290SJavier Almansa Sobrino
17369447290SJavier Almansa SobrinoFor any error detected in RMM during cold or warm boot, RMM will return back to
17469447290SJavier Almansa SobrinoEL3 using ``RMM_BOOT_COMPLETE`` SMC with an appropriate error code. It is
17569447290SJavier Almansa Sobrinoexpected that EL3 will take necessary action to disable Realm world for further
17669447290SJavier Almansa Sobrinoentry from NS Host on receiving an error. This will be done across all the PEs
17769447290SJavier Almansa Sobrinoin the system so as to present a symmetric view to the NS Host. Any further
17869447290SJavier Almansa Sobrinowarm boot by any PE should not enter RMM using the warm boot interface.
17969447290SJavier Almansa Sobrino
18069447290SJavier Almansa Sobrino.. _rmm_el3_boot_manifest:
18169447290SJavier Almansa Sobrino
18269447290SJavier Almansa SobrinoBoot Manifest
18369447290SJavier Almansa Sobrino~~~~~~~~~~~~~
18469447290SJavier Almansa Sobrino
1851db295cfSAlexeiFedorovDuring cold boot, EL3 Firmware passes a memory Boot Manifest to RMM containing
18669447290SJavier Almansa Sobrinoplatform information.
18769447290SJavier Almansa Sobrino
1881db295cfSAlexeiFedorovThis Boot Manifest is versioned independently of the Boot Interface, to help
1891db295cfSAlexeiFedorovevolve the former independent of the latter.
190bef44f60SAlexeiFedorovThe current version for the Boot Manifest is ``v0.4`` and the rules explained
19169447290SJavier Almansa Sobrinoin :ref:`rmm_el3_ifc_versioning` apply on this version as well.
19269447290SJavier Almansa Sobrino
193bef44f60SAlexeiFedorovThe Boot Manifest v0.4 has the following fields:
19469447290SJavier Almansa Sobrino
195bef44f60SAlexeiFedorov   - version : Version of the Manifest (v0.4)
1961db295cfSAlexeiFedorov   - plat_data : Pointer to the platform specific data and not specified by this
1971db295cfSAlexeiFedorov     document. These data are optional and can be NULL.
1981db295cfSAlexeiFedorov   - plat_dram : Structure encoding the NS DRAM information on the platform. This
19988f7c87bSHarry Moulton     field is optional and platform can choose to zero out this structure if
2001db295cfSAlexeiFedorov     RMM does not need EL3 to send this information during the boot.
20188f7c87bSHarry Moulton   - plat_console : Structure encoding the list of consoles for RMM use on the
20288f7c87bSHarry Moulton     platform. This field is optional and platform can choose to not populate
20388f7c87bSHarry Moulton     the console list if this is not needed by the RMM for this platform.
20469447290SJavier Almansa Sobrino
2051db295cfSAlexeiFedorovFor the current version of the Boot Manifest, the core manifest contains a pointer
2061db295cfSAlexeiFedorovto the platform data. EL3 must ensure that the whole Boot Manifest, including
2071db295cfSAlexeiFedorovthe platform data, if available, fits inside the RMM EL3 shared buffer.
20869447290SJavier Almansa Sobrino
2091db295cfSAlexeiFedorovFor the data structure specification of Boot Manifest, refer to
21069447290SJavier Almansa Sobrino:ref:`rmm_el3_manifest_struct`
21169447290SJavier Almansa Sobrino
21269447290SJavier Almansa Sobrino.. _runtime_services_and_interface:
21369447290SJavier Almansa Sobrino
214e50fedbcSJavier Almansa SobrinoRMM-EL3 Runtime Interface
21569447290SJavier Almansa Sobrino__________________________
21669447290SJavier Almansa Sobrino
21769447290SJavier Almansa SobrinoThis section defines the RMM-EL3 runtime interface which specifies the ABI for
21869447290SJavier Almansa SobrinoEL3 services expected by RMM at runtime as well as the register save and
21969447290SJavier Almansa Sobrinorestore convention between EL3 and RMM as part of RMI call handling. It is
22069447290SJavier Almansa Sobrinoimportant to note that RMM is allowed to invoke EL3-RMM runtime interface
22169447290SJavier Almansa Sobrinoservices during the boot phase as well. The EL3 runtime service handling must
22269447290SJavier Almansa Sobrinonot result in a world switch to another world unless specified. Both the RMM
22369447290SJavier Almansa Sobrinoand EL3 are allowed to make suitable optimizations based on this assumption.
22469447290SJavier Almansa Sobrino
22569447290SJavier Almansa SobrinoIf the interface requires the use of memory, then the memory references should
22669447290SJavier Almansa Sobrinobe within the shared buffer communicated as part of the boot interface. See
22769447290SJavier Almansa Sobrino:ref:`rmm_cold_boot_interface` for properties of this shared buffer which both
22869447290SJavier Almansa SobrinoEL3 and RMM must adhere to.
22969447290SJavier Almansa Sobrino
23069447290SJavier Almansa SobrinoRMM-EL3 runtime service return codes
23169447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23269447290SJavier Almansa Sobrino
23369447290SJavier Almansa SobrinoThe return codes from EL3 to RMM is a 32 bit signed integer which encapsulates
23469447290SJavier Almansa Sobrinoerror condition as described in the following table:
23569447290SJavier Almansa Sobrino
23669447290SJavier Almansa Sobrino.. csv-table::
23769447290SJavier Almansa Sobrino   :header: "Error code", "Description", "ID"
23869447290SJavier Almansa Sobrino   :widths: 2 4 1
23969447290SJavier Almansa Sobrino
24069447290SJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected,0
24169447290SJavier Almansa Sobrino   ``E_RMM_UNK``,Unknown/Generic error,-1
24269447290SJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,The value of an address used as argument was invalid,-2
24369447290SJavier Almansa Sobrino   ``E_RMM_BAD_PAS``,Incorrect PAS,-3
24469447290SJavier Almansa Sobrino   ``E_RMM_NOMEM``,Not enough memory to perform an operation,-4
24569447290SJavier Almansa Sobrino   ``E_RMM_INVAL``,The value of an argument was invalid,-5
24642cf6026SJuan Pablo Conde   ``E_RMM_AGAIN``,The resource is busy. Try again.,-6
24769447290SJavier Almansa Sobrino
24869447290SJavier Almansa SobrinoIf multiple failure conditions are detected in an RMM to EL3 command, then EL3
24969447290SJavier Almansa Sobrinois allowed to return an error code corresponding to any of the failure
25069447290SJavier Almansa Sobrinoconditions.
25169447290SJavier Almansa Sobrino
25269447290SJavier Almansa SobrinoRMM-EL3 runtime services
25369447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~~~~~~
25469447290SJavier Almansa Sobrino
25569447290SJavier Almansa SobrinoThe following table summarizes the RMM runtime services that need to be
25669447290SJavier Almansa Sobrinoimplemented by EL3 Firmware.
25769447290SJavier Almansa Sobrino
25869447290SJavier Almansa Sobrino.. csv-table::
25969447290SJavier Almansa Sobrino   :header: "FID", "Command"
26069447290SJavier Almansa Sobrino   :widths: 2 5
26169447290SJavier Almansa Sobrino
262e50fedbcSJavier Almansa Sobrino   0xC400018F,``RMM_RMI_REQ_COMPLETE``
263e50fedbcSJavier Almansa Sobrino   0xC40001B0,``RMM_GTSI_DELEGATE``
264e50fedbcSJavier Almansa Sobrino   0xC40001B1,``RMM_GTSI_UNDELEGATE``
26569447290SJavier Almansa Sobrino   0xC40001B2,``RMM_ATTEST_GET_REALM_KEY``
26669447290SJavier Almansa Sobrino   0xC40001B3,``RMM_ATTEST_GET_PLAT_TOKEN``
267b226357bSRaghu Krishnamurthy   0xC40001B4,``RMM_EL3_FEATURES``
268b226357bSRaghu Krishnamurthy   0xC40001B5,``RMM_EL3_TOKEN_SIGN``
269745c129aSAndre Przywara   0xC40001B6,``RMM_MECID_KEY_UPDATE``
270745c129aSAndre Przywara   0xC40001B7,``RMM_IDE_KEY_PROG``
271745c129aSAndre Przywara   0xC40001B8,``RMM_IDE_KEY_SET_GO``
272745c129aSAndre Przywara   0xC40001B9,``RMM_IDE_KEY_SET_STOP``
273745c129aSAndre Przywara   0xC40001BA,``RMM_IDE_KM_PULL_RESPONSE``
274745c129aSAndre Przywara   0xC40001BB,``RMM_RESERVE_MEMORY``
27569447290SJavier Almansa Sobrino
276e50fedbcSJavier Almansa SobrinoRMM_RMI_REQ_COMPLETE command
277e50fedbcSJavier Almansa Sobrino============================
278e50fedbcSJavier Almansa Sobrino
279e50fedbcSJavier Almansa SobrinoNotifies the completion of an RMI call to the Non-Secure world.
280e50fedbcSJavier Almansa Sobrino
281e50fedbcSJavier Almansa SobrinoThis call is the only function currently in RMM-EL3 runtime interface which
282e50fedbcSJavier Almansa Sobrinoresults in a world switch to NS. This call is the reply to the original RMI
283e50fedbcSJavier Almansa Sobrinocall and it is forwarded by EL3 to the NS world.
284e50fedbcSJavier Almansa Sobrino
285e50fedbcSJavier Almansa SobrinoFID
286e50fedbcSJavier Almansa Sobrino---
287e50fedbcSJavier Almansa Sobrino
288e50fedbcSJavier Almansa Sobrino``0xC400018F``
289e50fedbcSJavier Almansa Sobrino
290e50fedbcSJavier Almansa SobrinoInput values
291e50fedbcSJavier Almansa Sobrino------------
292e50fedbcSJavier Almansa Sobrino
293e50fedbcSJavier Almansa Sobrino.. csv-table::
294e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
295e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 1 5
296e50fedbcSJavier Almansa Sobrino
297e50fedbcSJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
298e50fedbcSJavier Almansa Sobrino   err_code,x1,[63:0],RmiCommandReturnCode,Error code returned by the RMI service invoked by NS World. See Realm Management Monitor specification for more info
299e50fedbcSJavier Almansa Sobrino
300e50fedbcSJavier Almansa SobrinoOutput values
301e50fedbcSJavier Almansa Sobrino-------------
302e50fedbcSJavier Almansa Sobrino
303e50fedbcSJavier Almansa SobrinoThis call does not return.
304e50fedbcSJavier Almansa Sobrino
305e50fedbcSJavier Almansa SobrinoFailure conditions
306e50fedbcSJavier Almansa Sobrino------------------
307e50fedbcSJavier Almansa Sobrino
308e50fedbcSJavier Almansa SobrinoSince this call does not return to RMM, there is no failure condition which
309e50fedbcSJavier Almansa Sobrinocan be notified back to RMM.
310e50fedbcSJavier Almansa Sobrino
311e50fedbcSJavier Almansa SobrinoRMM_GTSI_DELEGATE command
312e50fedbcSJavier Almansa Sobrino=========================
313e50fedbcSJavier Almansa Sobrino
314e50fedbcSJavier Almansa SobrinoDelegate a memory granule by changing its PAS from Non-Secure to Realm.
315e50fedbcSJavier Almansa Sobrino
316e50fedbcSJavier Almansa SobrinoFID
317e50fedbcSJavier Almansa Sobrino---
318e50fedbcSJavier Almansa Sobrino
319e50fedbcSJavier Almansa Sobrino``0xC40001B0``
320e50fedbcSJavier Almansa Sobrino
321e50fedbcSJavier Almansa SobrinoInput values
322e50fedbcSJavier Almansa Sobrino------------
323e50fedbcSJavier Almansa Sobrino
324e50fedbcSJavier Almansa Sobrino.. csv-table::
325e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
326e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 1 5
327e50fedbcSJavier Almansa Sobrino
328e50fedbcSJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
329e50fedbcSJavier Almansa Sobrino   base_pa,x1,[63:0],Address,PA of the start of the granule to be delegated
330e50fedbcSJavier Almansa Sobrino
331e50fedbcSJavier Almansa SobrinoOutput values
332e50fedbcSJavier Almansa Sobrino-------------
333e50fedbcSJavier Almansa Sobrino
334e50fedbcSJavier Almansa Sobrino.. csv-table::
335e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
336e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 2 4
337e50fedbcSJavier Almansa Sobrino
338e50fedbcSJavier Almansa Sobrino   Result,x0,[63:0],Error Code,Command return status
339e50fedbcSJavier Almansa Sobrino
340e50fedbcSJavier Almansa SobrinoFailure conditions
341e50fedbcSJavier Almansa Sobrino------------------
342e50fedbcSJavier Almansa Sobrino
343e50fedbcSJavier Almansa SobrinoThe table below shows all the possible error codes returned in ``Result`` upon
344e50fedbcSJavier Almansa Sobrinoa failure. The errors are ordered by condition check.
345e50fedbcSJavier Almansa Sobrino
346e50fedbcSJavier Almansa Sobrino.. csv-table::
347e50fedbcSJavier Almansa Sobrino   :header: "ID", "Condition"
348e50fedbcSJavier Almansa Sobrino   :widths: 1 5
349e50fedbcSJavier Almansa Sobrino
350e50fedbcSJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,``PA`` does not correspond to a valid granule address
351e50fedbcSJavier Almansa Sobrino   ``E_RMM_BAD_PAS``,The granule pointed by ``PA`` does not belong to Non-Secure PAS
352e50fedbcSJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected
353e50fedbcSJavier Almansa Sobrino
354e50fedbcSJavier Almansa SobrinoRMM_GTSI_UNDELEGATE command
355e50fedbcSJavier Almansa Sobrino===========================
356e50fedbcSJavier Almansa Sobrino
357e50fedbcSJavier Almansa SobrinoUndelegate a memory granule by changing its PAS from Realm to Non-Secure.
358e50fedbcSJavier Almansa Sobrino
359e50fedbcSJavier Almansa SobrinoFID
360e50fedbcSJavier Almansa Sobrino---
361e50fedbcSJavier Almansa Sobrino
362e50fedbcSJavier Almansa Sobrino``0xC40001B1``
363e50fedbcSJavier Almansa Sobrino
364e50fedbcSJavier Almansa SobrinoInput values
365e50fedbcSJavier Almansa Sobrino------------
366e50fedbcSJavier Almansa Sobrino
367e50fedbcSJavier Almansa Sobrino.. csv-table::
368e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
369e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 1 5
370e50fedbcSJavier Almansa Sobrino
371e50fedbcSJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
372e50fedbcSJavier Almansa Sobrino   base_pa,x1,[63:0],Address,PA of the start of the granule to be undelegated
373e50fedbcSJavier Almansa Sobrino
374e50fedbcSJavier Almansa SobrinoOutput values
375e50fedbcSJavier Almansa Sobrino-------------
376e50fedbcSJavier Almansa Sobrino
377e50fedbcSJavier Almansa Sobrino.. csv-table::
378e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
379e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 2 4
380e50fedbcSJavier Almansa Sobrino
381e50fedbcSJavier Almansa Sobrino   Result,x0,[63:0],Error Code,Command return status
382e50fedbcSJavier Almansa Sobrino
383e50fedbcSJavier Almansa SobrinoFailure conditions
384e50fedbcSJavier Almansa Sobrino------------------
385e50fedbcSJavier Almansa Sobrino
386e50fedbcSJavier Almansa SobrinoThe table below shows all the possible error codes returned in ``Result`` upon
387e50fedbcSJavier Almansa Sobrinoa failure. The errors are ordered by condition check.
388e50fedbcSJavier Almansa Sobrino
389e50fedbcSJavier Almansa Sobrino.. csv-table::
390e50fedbcSJavier Almansa Sobrino   :header: "ID", "Condition"
391e50fedbcSJavier Almansa Sobrino   :widths: 1 5
392e50fedbcSJavier Almansa Sobrino
393e50fedbcSJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,``PA`` does not correspond to a valid granule address
394e50fedbcSJavier Almansa Sobrino   ``E_RMM_BAD_PAS``,The granule pointed by ``PA`` does not belong to Realm PAS
395e50fedbcSJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected
396e50fedbcSJavier Almansa Sobrino
39769447290SJavier Almansa SobrinoRMM_ATTEST_GET_REALM_KEY command
39869447290SJavier Almansa Sobrino================================
39969447290SJavier Almansa Sobrino
40069447290SJavier Almansa SobrinoRetrieve the Realm Attestation Token Signing key from EL3.
40169447290SJavier Almansa Sobrino
40269447290SJavier Almansa SobrinoFID
40369447290SJavier Almansa Sobrino---
40469447290SJavier Almansa Sobrino
40569447290SJavier Almansa Sobrino``0xC40001B2``
40669447290SJavier Almansa Sobrino
40769447290SJavier Almansa SobrinoInput values
40869447290SJavier Almansa Sobrino------------
40969447290SJavier Almansa Sobrino
41069447290SJavier Almansa Sobrino.. csv-table::
41169447290SJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
41269447290SJavier Almansa Sobrino   :widths: 1 1 1 1 5
41369447290SJavier Almansa Sobrino
41469447290SJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
41569447290SJavier Almansa Sobrino   buf_pa,x1,[63:0],Address,PA where the Realm Attestation Key must be stored by EL3. The PA must belong to the shared buffer
41669447290SJavier Almansa Sobrino   buf_size,x2,[63:0],Size,Size in bytes of the Realm Attestation Key buffer. ``bufPa + bufSize`` must lie within the shared buffer
41769447290SJavier Almansa Sobrino   ecc_curve,x3,[63:0],Enum,Type of the elliptic curve to which the requested attestation key belongs to. See :ref:`ecc_curves`
41869447290SJavier Almansa Sobrino
41969447290SJavier Almansa SobrinoOutput values
42069447290SJavier Almansa Sobrino-------------
42169447290SJavier Almansa Sobrino
42269447290SJavier Almansa Sobrino.. csv-table::
42369447290SJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
42469447290SJavier Almansa Sobrino   :widths: 1 1 1 1 5
42569447290SJavier Almansa Sobrino
42669447290SJavier Almansa Sobrino   Result,x0,[63:0],Error Code,Command return status
42769447290SJavier Almansa Sobrino   keySize,x1,[63:0],Size,Size of the Realm Attestation Key
42869447290SJavier Almansa Sobrino
42969447290SJavier Almansa SobrinoFailure conditions
43069447290SJavier Almansa Sobrino------------------
43169447290SJavier Almansa Sobrino
43269447290SJavier Almansa SobrinoThe table below shows all the possible error codes returned in ``Result`` upon
43369447290SJavier Almansa Sobrinoa failure. The errors are ordered by condition check.
43469447290SJavier Almansa Sobrino
43569447290SJavier Almansa Sobrino.. csv-table::
43669447290SJavier Almansa Sobrino   :header: "ID", "Condition"
43769447290SJavier Almansa Sobrino   :widths: 1 5
43869447290SJavier Almansa Sobrino
43969447290SJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,``PA`` is outside the shared buffer
44069447290SJavier Almansa Sobrino   ``E_RMM_INVAL``,``PA + BSize`` is outside the shared buffer
44169447290SJavier Almansa Sobrino   ``E_RMM_INVAL``,``Curve`` is not one of the listed in :ref:`ecc_curves`
44269447290SJavier Almansa Sobrino   ``E_RMM_UNK``,An unknown error occurred whilst processing the command
44369447290SJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected
44469447290SJavier Almansa Sobrino
44569447290SJavier Almansa Sobrino.. _ecc_curves:
44669447290SJavier Almansa Sobrino
44769447290SJavier Almansa SobrinoSupported ECC Curves
44869447290SJavier Almansa Sobrino--------------------
44969447290SJavier Almansa Sobrino
45069447290SJavier Almansa Sobrino.. csv-table::
45169447290SJavier Almansa Sobrino   :header: "ID", "Curve"
45269447290SJavier Almansa Sobrino   :widths: 1 5
45369447290SJavier Almansa Sobrino
45469447290SJavier Almansa Sobrino   0,ECC SECP384R1
45569447290SJavier Almansa Sobrino
45669447290SJavier Almansa SobrinoRMM_ATTEST_GET_PLAT_TOKEN command
45769447290SJavier Almansa Sobrino=================================
45869447290SJavier Almansa Sobrino
45942cf6026SJuan Pablo CondeRetrieve the Platform Token from EL3. If the entire token does not fit in the
46042cf6026SJuan Pablo Condebuffer, EL3 returns a hunk of the token (via ``tokenHunkSize`` parameter) and
46142cf6026SJuan Pablo Condeindicates the remaining bytes that are pending retrieval (via ``remainingSize``
46242cf6026SJuan Pablo Condeparameter). The challenge object for the platform token must be populated in
46342cf6026SJuan Pablo Condethe buffer for the first call of this command and the size of the object is
46442cf6026SJuan Pablo Condeindicated by ``c_size`` parameter. Subsequent calls to retrieve remaining hunks of
46542cf6026SJuan Pablo Condethe token must be made with ``c_size`` as 0.
46642cf6026SJuan Pablo Conde
46742cf6026SJuan Pablo CondeIf ``c_size`` is not 0, this command could cause regeneration of platform token
46842cf6026SJuan Pablo Condeand will return token hunk corresponding to beginning of the token.
46942cf6026SJuan Pablo Conde
47042cf6026SJuan Pablo CondeIt is valid for the calls of this command to return ``E_RMM_AGAIN`` error,
47142cf6026SJuan Pablo Condewhich is an indication to the caller to retry this command again. Depending on the
47242cf6026SJuan Pablo Condeplatform, this mechanism can be used to implement queuing to HES, if HES is
47342cf6026SJuan Pablo Condeinvolved in platform token generation.
47469447290SJavier Almansa Sobrino
47569447290SJavier Almansa SobrinoFID
47669447290SJavier Almansa Sobrino---
47769447290SJavier Almansa Sobrino
47869447290SJavier Almansa Sobrino``0xC40001B3``
47969447290SJavier Almansa Sobrino
48069447290SJavier Almansa SobrinoInput values
48169447290SJavier Almansa Sobrino------------
48269447290SJavier Almansa Sobrino
48369447290SJavier Almansa Sobrino.. csv-table::
48469447290SJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
48569447290SJavier Almansa Sobrino   :widths: 1 1 1 1 5
48669447290SJavier Almansa Sobrino
48769447290SJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
48842cf6026SJuan Pablo Conde   buf_pa,x1,[63:0],Address,"PA of the platform attestation token. The challenge object must be passed in this buffer for the first call of this command. Any subsequent calls, if required to retrieve the full token, should not have this object. The PA must belong to the shared buffer."
48969447290SJavier Almansa Sobrino   buf_size,x2,[63:0],Size,Size in bytes of the platform attestation token buffer. ``bufPa + bufSize`` must lie within the shared buffer
49042cf6026SJuan Pablo Conde   c_size,x3,[63:0],Size,"Size in bytes of the challenge object. It corresponds to the size of one of the defined SHA algorithms. Any subsequent calls, if required to retrieve the full token, should set this size to 0."
49169447290SJavier Almansa Sobrino
49269447290SJavier Almansa SobrinoOutput values
49369447290SJavier Almansa Sobrino-------------
49469447290SJavier Almansa Sobrino
49569447290SJavier Almansa Sobrino.. csv-table::
49669447290SJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
49769447290SJavier Almansa Sobrino   :widths: 1 1 1 1 5
49869447290SJavier Almansa Sobrino
49969447290SJavier Almansa Sobrino   Result,x0,[63:0],Error Code,Command return status
50042cf6026SJuan Pablo Conde   tokenHunkSize,x1,[63:0],Size,Size of the platform token hunk retrieved
50142cf6026SJuan Pablo Conde   remainingSize,x2,[63:0],Size,Remaining bytes of the token that are pending retrieval
50269447290SJavier Almansa Sobrino
50369447290SJavier Almansa SobrinoFailure conditions
50469447290SJavier Almansa Sobrino------------------
50569447290SJavier Almansa Sobrino
50669447290SJavier Almansa SobrinoThe table below shows all the possible error codes returned in ``Result`` upon
50769447290SJavier Almansa Sobrinoa failure. The errors are ordered by condition check.
50869447290SJavier Almansa Sobrino
50969447290SJavier Almansa Sobrino.. csv-table::
51069447290SJavier Almansa Sobrino   :header: "ID", "Condition"
51169447290SJavier Almansa Sobrino   :widths: 1 5
51269447290SJavier Almansa Sobrino
51342cf6026SJuan Pablo Conde   ``E_RMM_AGAIN``,Resource for Platform token retrieval is busy. Try again.
51469447290SJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,``PA`` is outside the shared buffer
51569447290SJavier Almansa Sobrino   ``E_RMM_INVAL``,``PA + BSize`` is outside the shared buffer
51642cf6026SJuan Pablo Conde   ``E_RMM_INVAL``,``CSize`` does not represent the size of a supported SHA algorithm for the first call to this command
51742cf6026SJuan Pablo Conde   ``E_RMM_INVAL``,``CSize`` is not 0 for subsequent calls to retrieve remaining hunks of the token
51869447290SJavier Almansa Sobrino   ``E_RMM_UNK``,An unknown error occurred whilst processing the command
51969447290SJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected
52069447290SJavier Almansa Sobrino
521b226357bSRaghu KrishnamurthyRMM_EL3_FEATURES command
522b226357bSRaghu Krishnamurthy========================
523b226357bSRaghu Krishnamurthy
524b226357bSRaghu KrishnamurthyThis command provides a mechanism to discover features and ABIs supported by the
525b226357bSRaghu KrishnamurthyRMM-EL3 interface, for a given version. This command is helpful when there are
526b226357bSRaghu Krishnamurthyplatform specific optional RMM-EL3 interfaces and features exposed by vendor
527b226357bSRaghu Krishnamurthyspecific EL3 firmware, and a generic RMM that can modify its behavior based on
528b226357bSRaghu Krishnamurthydiscovery of EL3 features.
529b226357bSRaghu Krishnamurthy
530b226357bSRaghu KrishnamurthyThe features can be discovered by specifying the feature register index that
531b226357bSRaghu Krishnamurthyhas fields defined to indicate presence or absence of features and other
532b226357bSRaghu Krishnamurthyrelevant information. The feature register index is specified in the
533b226357bSRaghu Krishnamurthy``feat_reg_idx`` parameter. Each feature register is a 64 bit register.
534b226357bSRaghu Krishnamurthy
535b226357bSRaghu KrishnamurthyThis command is available from v0.4 of the RMM-EL3 interface.
536b226357bSRaghu Krishnamurthy
537b226357bSRaghu KrishnamurthyThe following is the register definition for feature register index 0 for
538b226357bSRaghu Krishnamurthyv0.4 of the interface:
539b226357bSRaghu Krishnamurthy
540b226357bSRaghu KrishnamurthyRMM-EL3 Feature Resister 0
541b226357bSRaghu Krishnamurthy--------------------------
542b226357bSRaghu Krishnamurthy
543b226357bSRaghu Krishnamurthy.. code-block:: none
544b226357bSRaghu Krishnamurthy
545b226357bSRaghu Krishnamurthy    63      32      31      16       15      8       7       1       0
546b226357bSRaghu Krishnamurthy    +-------+-------+-------+-------+-------+-------+-------+-------+
547b226357bSRaghu Krishnamurthy    |       |       |       |       |       |       |       |       |
548b226357bSRaghu Krishnamurthy    |       |       |       |       |       |       |       |       |
549b226357bSRaghu Krishnamurthy    +-------+-------+-------+-------+-------+-------+-------+-------+
550b226357bSRaghu Krishnamurthy                                                             ^
551b226357bSRaghu Krishnamurthy                                                             |
552b226357bSRaghu Krishnamurthy                                                 RMMD_EL3_TOKEN_SIGN
553b226357bSRaghu Krishnamurthy
554b226357bSRaghu Krishnamurthy**Bit Fields:**
555b226357bSRaghu Krishnamurthy
556b226357bSRaghu Krishnamurthy- **Bit 0**: `RMMD_EL3_TOKEN_SIGN`
557b226357bSRaghu Krishnamurthy    - When set to 1, the `RMMD_EL3_TOKEN_SIGN` feature is enabled.
558b226357bSRaghu Krishnamurthy    - When cleared (0), the feature is disabled.
559b226357bSRaghu Krishnamurthy- **Bits [1:63]**: Reserved (must be zero)
560b226357bSRaghu Krishnamurthy
561b226357bSRaghu KrishnamurthyFID
562b226357bSRaghu Krishnamurthy---
563b226357bSRaghu Krishnamurthy
564b226357bSRaghu Krishnamurthy``0xC40001B4``
565b226357bSRaghu Krishnamurthy
566b226357bSRaghu Krishnamurthy
567b226357bSRaghu KrishnamurthyInput values
568b226357bSRaghu Krishnamurthy------------
569b226357bSRaghu Krishnamurthy
570b226357bSRaghu Krishnamurthy.. csv-table:: Input values for RMM_EL3_FEATURES
571b226357bSRaghu Krishnamurthy   :header: "Name", "Register", "Field", "Type", "Description"
572b226357bSRaghu Krishnamurthy   :widths: 1 1 1 1 5
573b226357bSRaghu Krishnamurthy
574b226357bSRaghu Krishnamurthy   fid,x0,[63:0],UInt64,Command FID
575b226357bSRaghu Krishnamurthy   feat_reg_idx,x1,[63:0],UInt64, "Feature register index. For v0.4, a value of 0 is the only
576b226357bSRaghu Krishnamurthy   acceptable value"
577b226357bSRaghu Krishnamurthy
578b226357bSRaghu Krishnamurthy
579b226357bSRaghu KrishnamurthyOutput values
580b226357bSRaghu Krishnamurthy-------------
581b226357bSRaghu Krishnamurthy
582b226357bSRaghu Krishnamurthy.. csv-table:: Output values for RMM_EL3_FEATURES
583b226357bSRaghu Krishnamurthy   :header: "Name", "Register", "Field", "Type", "Description"
584b226357bSRaghu Krishnamurthy   :widths: 1 1 1 1 5
585b226357bSRaghu Krishnamurthy
586b226357bSRaghu Krishnamurthy   Result,x0,[63:0],Error Code,Command return status
587b226357bSRaghu Krishnamurthy   feat_reg,x1,[63:0],Value,Value of the register as defined above
588b226357bSRaghu Krishnamurthy
589b226357bSRaghu KrishnamurthyFailure conditions
590b226357bSRaghu Krishnamurthy------------------
591b226357bSRaghu Krishnamurthy
592b226357bSRaghu KrishnamurthyThe table below shows all the possible error codes returned in ``Result`` upon
593b226357bSRaghu Krishnamurthya failure. The errors are ordered by condition check.
594b226357bSRaghu Krishnamurthy
595b226357bSRaghu Krishnamurthy.. csv-table:: Failure conditions for RMM_EL3_FEATURES
596b226357bSRaghu Krishnamurthy   :header: "ID", "Condition"
597b226357bSRaghu Krishnamurthy   :widths: 1 5
598b226357bSRaghu Krishnamurthy
599b226357bSRaghu Krishnamurthy   ``E_RMM_INVAL``,``feat_reg_idx`` is out of valid range
600b226357bSRaghu Krishnamurthy   ``E_RMM_UNK``,"if the SMC is not present, if interface version is <0.4"
601b226357bSRaghu Krishnamurthy   ``E_RMM_OK``,No errors detected
602b226357bSRaghu Krishnamurthy
603b226357bSRaghu KrishnamurthyRMM_EL3_TOKEN_SIGN command
604b226357bSRaghu Krishnamurthy==========================
605b226357bSRaghu Krishnamurthy
606b226357bSRaghu KrishnamurthyThis command is an optional command that can be discovered using the RMM_EL3_FEATURES command.
607b226357bSRaghu KrishnamurthyThis command is used to send requests related to realm attestation token signing requests to EL3.
608b226357bSRaghu KrishnamurthyThe command supports 3 opcodes:
609b226357bSRaghu Krishnamurthy
610b226357bSRaghu Krishnamurthy   - RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP
611b226357bSRaghu Krishnamurthy   - RMM_EL3_TOKEN_SIGN_PULL_RESP_OP
612b226357bSRaghu Krishnamurthy   - RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP
613b226357bSRaghu Krishnamurthy
614b226357bSRaghu KrishnamurthyThe above opcodes can be used to send realm attestation token signing requests to EL3 and get their
615b226357bSRaghu Krishnamurthyresponse, so that the realm attestation token can be constructed.
616b226357bSRaghu Krishnamurthy
617b226357bSRaghu KrishnamurthyThis command is useful when the RMM may not have access to the private portion of the realm
618b226357bSRaghu Krishnamurthyattestation key and needs signing services from EL3 or CCA HES, or other platform specific
619b226357bSRaghu Krishnamurthymechanisms to perform signing.
620b226357bSRaghu Krishnamurthy
621b226357bSRaghu KrishnamurthyThe RMM-EL3 interface for this command is modeled as two separate queues, one for signing requests
622b226357bSRaghu Krishnamurthyand one for retrieving the signed responses. It is possible that the queue in EL3 is full or EL3 is busy and
623b226357bSRaghu Krishnamurthyunable to service the RMM requests, in which case the RMM is expected to retry the push operation
624b226357bSRaghu Krishnamurthyfor requests and pop operation for responses.
625b226357bSRaghu Krishnamurthy
626b226357bSRaghu KrishnamurthyFID
627b226357bSRaghu Krishnamurthy---
628b226357bSRaghu Krishnamurthy
629b226357bSRaghu Krishnamurthy``0xC40001B5``
630b226357bSRaghu Krishnamurthy
631b226357bSRaghu KrishnamurthyInput values
632b226357bSRaghu Krishnamurthy------------
633b226357bSRaghu Krishnamurthy
634b226357bSRaghu Krishnamurthy.. csv-table:: Input values for RMM_EL3_TOKEN_SIGN
635b226357bSRaghu Krishnamurthy   :header: "Name", "Register", "Field", "Type", "Description"
636b226357bSRaghu Krishnamurthy   :widths: 1 1 1 1 5
637b226357bSRaghu Krishnamurthy
638b226357bSRaghu Krishnamurthy   fid,x0,[63:0],UInt64,Command FID
639b226357bSRaghu Krishnamurthy   opcode,x1,[63:0],UInt64,"
640b226357bSRaghu Krishnamurthy   Opcode that is one of:
641b226357bSRaghu Krishnamurthy
642b226357bSRaghu Krishnamurthy    - RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP: 0x1 -
643b226357bSRaghu Krishnamurthy      Opcode to push a token signing request to EL3 using struct el3_token_sign_request as described above
644b226357bSRaghu Krishnamurthy    - RMM_EL3_TOKEN_SIGN_PULL_RESP_OP: 0x2 -
645b226357bSRaghu Krishnamurthy      Opcode to pull a token signing response from EL3 using struct el3_token_sign_response as described above
646b226357bSRaghu Krishnamurthy    - RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP: 0x3 -
647b226357bSRaghu Krishnamurthy      Opcode to get the realm attestation public key
648b226357bSRaghu Krishnamurthy
649b226357bSRaghu Krishnamurthy   "
650b226357bSRaghu Krishnamurthy   buf_pa,x2,[63:0],Address,"PA where the request structure is stored for the opcode RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP, the response structure needs to be populated for the opcode RMM_EL3_TOKEN_SIGN_PULL_RESP_OP, or where the public key must be populated for the opcode RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP. The PA must belong to the RMM-EL3 shared buffer"
651b226357bSRaghu Krishnamurthy   buf_size,x3,[63:0],Size,Size in bytes of the input buffer in ``buf_pa``. ``buf_pa + buf_size`` must lie within the shared buffer
652b226357bSRaghu Krishnamurthy   ecc_curve,x4,[63:0],Enum,Type of the elliptic curve to which the requested attestation key belongs to. See :ref:`ecc_curves`. This parameter is valid on for the opcode RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP
653b226357bSRaghu Krishnamurthy
654b226357bSRaghu KrishnamurthyOutput values
655b226357bSRaghu Krishnamurthy-------------
656b226357bSRaghu Krishnamurthy
657b226357bSRaghu Krishnamurthy.. csv-table:: Output values for RMM_EL3_TOKEN_SIGN
658b226357bSRaghu Krishnamurthy   :header: "Name", "Register", "Field", "Type", "Description"
659b226357bSRaghu Krishnamurthy   :widths: 1 1 1 1 5
660b226357bSRaghu Krishnamurthy
661b226357bSRaghu Krishnamurthy   Result,x0,[63:0],Error Code,Command return status. Valid for all opcodes listed in input values
662b226357bSRaghu Krishnamurthy   retval1,x1,[63:0],Value, "If opcode is RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP, then returns length of
663b226357bSRaghu Krishnamurthy   public key returned. Otherwise, reserved"
664b226357bSRaghu Krishnamurthy
665b226357bSRaghu Krishnamurthy
666b226357bSRaghu KrishnamurthyFailure conditions
667b226357bSRaghu Krishnamurthy------------------
668b226357bSRaghu Krishnamurthy
669b226357bSRaghu KrishnamurthyThe table below shows all the possible error codes returned in ``Result`` upon
670b226357bSRaghu Krishnamurthya failure. The errors are ordered by condition check.
671b226357bSRaghu Krishnamurthy
672b226357bSRaghu Krishnamurthy.. csv-table:: Failure conditions for RMM_EL3_TOKEN_SIGN
673b226357bSRaghu Krishnamurthy   :header: "ID", "Condition"
674b226357bSRaghu Krishnamurthy   :widths: 1 5
675b226357bSRaghu Krishnamurthy
676b226357bSRaghu Krishnamurthy   ``E_RMM_INVAL``,"if opcode is invalid or buffer address and length passed to the EL3 are not in valid range
677b226357bSRaghu Krishnamurthy   corresponding to the RMM-EL3 shared buffer, or if the curve used for opcode
678b226357bSRaghu Krishnamurthy   RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP is not the ECC P384 curve"
679b226357bSRaghu Krishnamurthy   ``E_RMM_UNK``,"if the SMC is not present, if interface version is <0.4"
680b226357bSRaghu Krishnamurthy   ``E_RMM_AGAIN``,"For opcode RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP, if the request is not queued since
681b226357bSRaghu Krishnamurthy   the EL3 queue is full, or if the response is not ready yet, for other opcodes"
682b226357bSRaghu Krishnamurthy   ``E_RMM_OK``,No errors detected
683b226357bSRaghu Krishnamurthy
684*00e62ff9SJuan Pablo CondeRMM_MEC_REFRESH command
685*00e62ff9SJuan Pablo Conde=======================
686f801fdc2STushar Khandelwal
687f801fdc2STushar KhandelwalThis command updates the tweak for the encryption key/programs a new encryption key
688f801fdc2STushar Khandelwalassociated with a given MECID. After the execution of this command, all memory
689f801fdc2STushar Khandelwalaccesses associated with the MECID are encrypted/decrypted using the new key.
690*00e62ff9SJuan Pablo CondeThis command is available from v0.8 of the RMM-EL3 interface.
691f801fdc2STushar Khandelwal
692f801fdc2STushar KhandelwalFID
693f801fdc2STushar Khandelwal---
694f801fdc2STushar Khandelwal
695f801fdc2STushar Khandelwal``0xC40001B6``
696f801fdc2STushar Khandelwal
697f801fdc2STushar KhandelwalInput values
698f801fdc2STushar Khandelwal------------
699f801fdc2STushar Khandelwal
700*00e62ff9SJuan Pablo Conde.. csv-table:: Input values for RMM_MEC_REFRESH
701f801fdc2STushar Khandelwal   :header: "Name", "Register", "Field", "Type", "Description"
702f801fdc2STushar Khandelwal   :widths: 1 1 1 1 5
703f801fdc2STushar Khandelwal
704f801fdc2STushar Khandelwal   fid,x0,[63:0],UInt64,Command FID
705*00e62ff9SJuan Pablo Conde   mecid,x1,[47:32],UInt64, "mecid is a 16-bit value between 0 and 65,535 that identifies the MECID for which the encryption key is to be updated. Value has to be a valid MECID as per field MECIDWidthm1 read from MECIDR_EL2. Bits [63:16] must be 0."
706*00e62ff9SJuan Pablo Conde   mecid,x1,[31:1],UInt64, "Reserved, MBZ"
707*00e62ff9SJuan Pablo Conde   reason,x1,[0],UInt64, "reason is a single bit field used to indicate the reason for the MEC refresh. Values are: 0 (Realm creation), 1 (Realm destruction)."
708f801fdc2STushar Khandelwal
709f801fdc2STushar KhandelwalOutput values
710f801fdc2STushar Khandelwal-------------
711f801fdc2STushar Khandelwal
712*00e62ff9SJuan Pablo Conde.. csv-table:: Output values for RMM_MEC_REFRESH
713f801fdc2STushar Khandelwal   :header: "Name", "Register", "Field", "Type", "Description"
714f801fdc2STushar Khandelwal   :widths: 1 1 1 1 5
715f801fdc2STushar Khandelwal
716*00e62ff9SJuan Pablo Conde   Result,x0,[63:0],Error Code,"Command return status. Valid for all opcodes listed in input values"
717f801fdc2STushar Khandelwal
718f801fdc2STushar Khandelwal
719f801fdc2STushar KhandelwalFailure conditions
720f801fdc2STushar Khandelwal------------------
721f801fdc2STushar Khandelwal
722f801fdc2STushar KhandelwalThe table below shows all the possible error codes returned in ``Result`` upon
723f801fdc2STushar Khandelwala failure. The errors are ordered by condition check.
724f801fdc2STushar Khandelwal
725*00e62ff9SJuan Pablo Conde.. csv-table:: Failure conditions for RMM_MEC_REFRESH
726f801fdc2STushar Khandelwal   :header: "ID", "Condition"
727f801fdc2STushar Khandelwal   :widths: 1 5
728f801fdc2STushar Khandelwal
729*00e62ff9SJuan Pablo Conde   ``E_RMM_INVAL``, "If a field in the x1 register is incorrectly encoded or if MECID is invalid (larger than the common MECID width, determined by MECIDR_EL2.MECIDWidthm1 + 1 or by other system components, whichever is lower)"
730*00e62ff9SJuan Pablo Conde   ``E_RMM_UNK``, "An unknown error occurred whilst processing the command, FEAT_MEC is not present in hardware or the SMC is not present if the version is < 0.8."
731*00e62ff9SJuan Pablo Conde   ``E_RMM_OK``, "No errors detected"
732f801fdc2STushar Khandelwal
7330616bf03SSona MathewRMM_IDE_KEY_PROG command
7340616bf03SSona Mathew=========================
7350616bf03SSona Mathew
7360616bf03SSona MathewSet the key/IV info at Root port for an IDE stream as part of Device Assignment flow. This
7370616bf03SSona Mathewcommand is available from v0.6 of the RMM-EL3 interface.
7380616bf03SSona Mathew
7390616bf03SSona MathewPlease refer to `IDE-KM RFC <https://github.com/TF-RMM/tf-rmm/wiki/RFC:-EL3-RMM-IDE-KM-Interface>`_
7400616bf03SSona Mathewfor description of the IDE setup sequence and how this will be invoked by RMM.
7410616bf03SSona Mathew
7420616bf03SSona MathewThe key is 256 bits and IV is 96 bits. The caller needs
7430616bf03SSona Mathewto call this SMC to program this key to the Rx, Tx ports and for each sub-stream
7440616bf03SSona Mathewcorresponding to a single keyset.
7450616bf03SSona Mathew
7460616bf03SSona MathewFID
7470616bf03SSona Mathew---
7480616bf03SSona Mathew
7490616bf03SSona Mathew``0xC40001B7``
7500616bf03SSona Mathew
7510616bf03SSona MathewInput values
7520616bf03SSona Mathew------------
7530616bf03SSona Mathew
7540616bf03SSona Mathew.. csv-table:: Input values for RMM_IDE_KEY_PROG
7550616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
7560616bf03SSona Mathew   :widths: 1 1 1 1 5
7570616bf03SSona Mathew
7580616bf03SSona Mathew   fid,x0,[63:0],UInt64,Command FID
7590616bf03SSona Mathew   ecam_address,x1,[63:0],UInt64,Used to identify the root complex(RC)
7600616bf03SSona Mathew   rp_id,x2,[63:0],UInt64,Used to identify the root port within the root complex(RC)
761c0fa892aSSona Mathew   "Keyset[12]:
762c0fa892aSSona Mathew   Dir[11]:
763c0fa892aSSona Mathew   Substream[10:8]:
764c0fa892aSSona Mathew   StreamID[7:0]",x3,[63:0],UInt64,IDE selective stream informationKey set: can be 0 or 1unused bits MBZ.
7650616bf03SSona Mathew   KeqQW0,x4,[63:0],UInt64,Quad word of key [63:0]
7660616bf03SSona Mathew   KeqQW1,x5,[63:0],UInt64,Quad word of key [127:64]
7670616bf03SSona Mathew   KeqQW2,x6,[63:0],UInt64,Quad word of key [191:128]
7680616bf03SSona Mathew   KeqQW3,x7,[63:0],UInt64,Quad word of key [255:192]
7690616bf03SSona Mathew   IFVQW0,x8,[63:0],UInt64,Quad word of IV [63:0]
7700616bf03SSona Mathew   IFVQW1,x9,[63:0],UInt64,Quad word of IV [95:64]
7710616bf03SSona Mathew   request_id,x10,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
7720616bf03SSona Mathew   cookie,x11,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
7730616bf03SSona Mathew
7740616bf03SSona Mathew
7750616bf03SSona MathewOutput values
7760616bf03SSona Mathew-------------
7770616bf03SSona Mathew
7780616bf03SSona Mathew.. csv-table:: Output values for RMM_IDE_KEY_PROG
7790616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
780c0fa892aSSona Mathew   :widths: 1 1 1 1 5
7810616bf03SSona Mathew
7820616bf03SSona Mathew   Result,x0,[63:0],Error Code,Command return status
7830616bf03SSona Mathew
7840616bf03SSona MathewFailure conditions
7850616bf03SSona Mathew------------------
7860616bf03SSona Mathew
7870616bf03SSona MathewThe table below shows all the possible error codes returned in ``Result`` upon
7880616bf03SSona Mathewa failure. The errors are ordered by condition check.
7890616bf03SSona Mathew
7900616bf03SSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KEY_PROG
7910616bf03SSona Mathew   :header: "ID", "Condition"
7920616bf03SSona Mathew   :widths: 1 5
7930616bf03SSona Mathew
794c0fa892aSSona Mathew   ``E_RMM_OK``,The Key programming is successful.
795c0fa892aSSona Mathew   ``E_RMM_FAULT``,The Key programming is not successful.
796c0fa892aSSona Mathew   ``E_RMM_INVAL``,The Key programming arguments are incorrect.
797c0fa892aSSona Mathew   ``E_RMM_UNK``,Unknown error or the SMC is not present if the version is < 0.6.
7980616bf03SSona Mathew   ``E_RMM_AGAIN``,Returned only for non-blocking mode. IDE-KM interface is busy or request is full. Retry required.
7990616bf03SSona Mathew   ``E_RMM_INPROGRESS``,Returned only for non-blocking mode. The caller must issue RMM_IDE_KM_PULL_RESPONSE SMC to pull the response.
8000616bf03SSona Mathew
8010616bf03SSona Mathew
8020616bf03SSona MathewRMM_IDE_KEY_SET_GO command
8030616bf03SSona Mathew==========================
8040616bf03SSona Mathew
8050616bf03SSona MathewActivate the IDE stream at Root Port once the keys have been programmed as part of
8060616bf03SSona MathewDevice Assignment flow. This command is available from v0.6 of the RMM-EL3 interface.
8070616bf03SSona Mathew
8080616bf03SSona MathewPlease refer to `IDE-KM RFC <https://github.com/TF-RMM/tf-rmm/wiki/RFC:-EL3-RMM-IDE-KM-Interface>`_
8090616bf03SSona Mathewfor description of the IDE setup sequence and info on how this will be invoked by RMM.
8100616bf03SSona Mathew
8110616bf03SSona MathewThe caller(RMM) needs to ensure the EL3_IDE_KEY_PROG() call had succeeded prior to this call.
8120616bf03SSona Mathew
8130616bf03SSona MathewFID
8140616bf03SSona Mathew---
8150616bf03SSona Mathew
8160616bf03SSona Mathew``0xC40001B8``
8170616bf03SSona Mathew
8180616bf03SSona MathewInput values
8190616bf03SSona Mathew------------
8200616bf03SSona Mathew
8210616bf03SSona Mathew.. csv-table:: Input values for RMM_IDE_KEY_SET_GO
8220616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
8230616bf03SSona Mathew   :widths: 1 1 1 1 5
8240616bf03SSona Mathew
8250616bf03SSona Mathew   fid,x0,[63:0],UInt64,Command FID
8260616bf03SSona Mathew   ecam_address,x1,[63:0],UInt64,Used to identify the root complex(RC)
8270616bf03SSona Mathew   rp_id,x2,[63:0],UInt64,Used to identify the root port within the root complex(RC)
828c0fa892aSSona Mathew   "Keyset[12]:
829c0fa892aSSona Mathew   Dir[11]:
830c0fa892aSSona Mathew   Substream[10:8]:
831c0fa892aSSona Mathew   StreamID[7:0]",x3,[63:0],UInt64,IDE selective stream information. Key set can be 0 or 1. Unused bits MBZ.
8320616bf03SSona Mathew   request_id,x4,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
8330616bf03SSona Mathew   cookie,x5,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
8340616bf03SSona Mathew
8350616bf03SSona Mathew
8360616bf03SSona MathewOutput values
8370616bf03SSona Mathew-------------
8380616bf03SSona Mathew
8390616bf03SSona Mathew.. csv-table:: Output values for RMM_IDE_KEY_SET_GO
8400616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
841c0fa892aSSona Mathew   :widths: 1 1 1 1 5
8420616bf03SSona Mathew
8430616bf03SSona Mathew   Result,x0,[63:0],Error Code,Command return status
8440616bf03SSona Mathew
8450616bf03SSona MathewFailure conditions
8460616bf03SSona Mathew------------------
8470616bf03SSona Mathew
8480616bf03SSona MathewThe table below shows all the possible error codes returned in ``Result`` upon
8490616bf03SSona Mathewa failure. The errors are ordered by condition check.
8500616bf03SSona Mathew
8510616bf03SSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KEY_SET_GO
8520616bf03SSona Mathew   :header: "ID", "Condition"
8530616bf03SSona Mathew   :widths: 1 5
8540616bf03SSona Mathew
855c0fa892aSSona Mathew   ``E_RMM_OK``,The Key set go is successful.
856c0fa892aSSona Mathew   ``E_RMM_FAULT``,The Key set go is not successful.
857c0fa892aSSona Mathew   ``E_RMM_INVAL``,Incorrect arguments.
8580616bf03SSona Mathew   ``E_RMM_UNK``,Unknown error or the SMC is not present if the version is < 0.6.
8590616bf03SSona Mathew   ``E_RMM_AGAIN``,Returned only for non-blocking mode. IDE-KM interface is busy or request is full. Retry required.
8600616bf03SSona Mathew   ``E_RMM_INPROGRESS``,Returned only for non-blocking mode. The caller must issue RMM_IDE_KM_PULL_RESPONSE SMC to pull the response.
8610616bf03SSona Mathew
8620616bf03SSona Mathew
8630616bf03SSona MathewRMM_IDE_KEY_SET_STOP command
8640616bf03SSona Mathew============================
8650616bf03SSona Mathew
8660616bf03SSona MathewDeactivate the IDE stream at Root Port as part of Device Assignment flow. This command is
8670616bf03SSona Mathewavailable from v0.6 of the RMM-EL3 interface.
8680616bf03SSona Mathew
8690616bf03SSona MathewPlease refer to `IDE-KM RFC <https://github.com/TF-RMM/tf-rmm/wiki/RFC:-EL3-RMM-IDE-KM-Interface>`_
8700616bf03SSona Mathewfor description of the IDE setup sequence and info on how this will be invoked by RMM.
8710616bf03SSona Mathew
8720616bf03SSona MathewThis SMC is used to tear down an IDE Stream.
8730616bf03SSona Mathew
8740616bf03SSona MathewFID
8750616bf03SSona Mathew---
8760616bf03SSona Mathew
8770616bf03SSona Mathew``0xC40001B9``
8780616bf03SSona Mathew
8790616bf03SSona MathewInput values
8800616bf03SSona Mathew------------
8810616bf03SSona Mathew
8820616bf03SSona Mathew.. csv-table:: Input values for RMM_IDE_KEY_SET_STOP
8830616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
8840616bf03SSona Mathew   :widths: 1 1 1 1 5
8850616bf03SSona Mathew
8860616bf03SSona Mathew   fid,x0,[63:0],UInt64,Command FID
8870616bf03SSona Mathew   ecam_address,x1,[63:0],UInt64,Used to identify the root complex(RC)
8880616bf03SSona Mathew   rp_id,x2,[63:0],UInt64,Used to identify the root port within the root complex(RC)
889c0fa892aSSona Mathew   "Keyset[12]:
890c0fa892aSSona Mathew   Dir[11]:
891c0fa892aSSona Mathew   Substream[10:8]:
892c0fa892aSSona Mathew   StreamID[7:0]",x3,[63:0],UInt64,IDE selective stream information. Key set can be 0 or 1. Unused bits MBZ.
8930616bf03SSona Mathew   request_id,x4,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
8940616bf03SSona Mathew   cookie,x5,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
8950616bf03SSona Mathew
8960616bf03SSona Mathew
8970616bf03SSona MathewOutput values
8980616bf03SSona Mathew-------------
8990616bf03SSona Mathew
9000616bf03SSona Mathew.. csv-table:: Output values for RMM_IDE_KEY_SET_STOP
9010616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
902c0fa892aSSona Mathew   :widths: 1 1 1 1 5
9030616bf03SSona Mathew
9040616bf03SSona Mathew   Result,x0,[63:0],Error Code,Command return status
9050616bf03SSona Mathew
9060616bf03SSona MathewFailure conditions
9070616bf03SSona Mathew------------------
9080616bf03SSona Mathew
9090616bf03SSona MathewThe table below shows all the possible error codes returned in ``Result`` upon
9100616bf03SSona Mathewa failure. The errors are ordered by condition check.
9110616bf03SSona Mathew
9120616bf03SSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KEY_SET_STOP
9130616bf03SSona Mathew   :header: "ID", "Condition"
9140616bf03SSona Mathew   :widths: 1 5
9150616bf03SSona Mathew
916c0fa892aSSona Mathew   ``E_RMM_OK``,The Key set stop is successful.
917c0fa892aSSona Mathew   ``E_RMM_FAULT``,The Key set stop is not successful.
918c0fa892aSSona Mathew   ``E_RMM_INVAL``,Incorrect arguments.
9190616bf03SSona Mathew   ``E_RMM_UNK``,Unknown error or the SMC is not present if the version is < 0.6.
9200616bf03SSona Mathew   ``E_RMM_AGAIN``,Returned only for non-blocking mode. IDE-KM interface is busy or request is full. Retry required.
9210616bf03SSona Mathew   ``E_RMM_INPROGRESS``,Returned only for non-blocking mode. The caller must issue RMM_IDE_KM_PULL_RESPONSE SMC to pull the response.
9220616bf03SSona Mathew
9230616bf03SSona Mathew
9240616bf03SSona MathewRMM_IDE_KM_PULL_RESPONSE command
9250616bf03SSona Mathew================================
9260616bf03SSona Mathew
9270616bf03SSona MathewRetrieve the response from Root Port to a previous non-blocking IDE-KM SMC request as part of
9280616bf03SSona MathewDevice Assignment flow. This command is available from v0.6 of the RMM-EL3 interface.
9290616bf03SSona Mathew
9300616bf03SSona MathewPlease refer to `IDE-KM RFC <https://github.com/TF-RMM/tf-rmm/wiki/RFC:-EL3-RMM-IDE-KM-Interface>`_
9310616bf03SSona Mathewfor description of the IDE setup sequence and info on how this will be invoked by RMM.
9320616bf03SSona Mathew
9330616bf03SSona MathewThe response from this call could correspond to any of the last pending requests and the
9340616bf03SSona MathewRMM needs to identify the request and populate the response. For blocking calls, this SMC
9350616bf03SSona Mathewalways returns E_RMM_UNK.
9360616bf03SSona Mathew
9370616bf03SSona MathewFID
9380616bf03SSona Mathew---
9390616bf03SSona Mathew
9400616bf03SSona Mathew``0xC40001BA``
9410616bf03SSona Mathew
9420616bf03SSona MathewInput values
9430616bf03SSona Mathew------------
9440616bf03SSona Mathew
9450616bf03SSona Mathew.. csv-table:: Input values for RMM_IDE_KM_PULL_RESPONSE
9460616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
9470616bf03SSona Mathew   :widths: 1 1 1 1 5
9480616bf03SSona Mathew
9490616bf03SSona Mathew   fid,x0,[63:0],UInt64,Command FID
9500616bf03SSona Mathew   ecam_address,x1,[63:0],UInt64,Used to identify the root complex(RC)
9510616bf03SSona Mathew   rp_id,x2,[63:0],UInt64,Used to identify the root port within the root complex(RC)
9520616bf03SSona Mathew
9530616bf03SSona Mathew
9540616bf03SSona MathewOutput values
9550616bf03SSona Mathew-------------
9560616bf03SSona Mathew
9570616bf03SSona Mathew.. csv-table:: Output values for RMM_IDE_KM_PULL_RESPONSE
9580616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
959c0fa892aSSona Mathew   :widths: 1 1 1 1 5
9600616bf03SSona Mathew
9610616bf03SSona Mathew   Result,x0,[63:0],Error Code,Command return status
9620616bf03SSona Mathew   Result,x1,[63:0],Error Code,Retrieved response corresponding to previous IDE_KM requests.
9630616bf03SSona Mathew   Result,x2,[63:0],value,passthrough from requested SMC
9640616bf03SSona Mathew   Result,x3,[63:0],value,passthrough from requested SMC
9650616bf03SSona Mathew
9660616bf03SSona MathewFailure conditions
9670616bf03SSona Mathew------------------
9680616bf03SSona Mathew
9690616bf03SSona MathewThe table below shows all the possible error codes returned in ``Result`` upon
9700616bf03SSona Mathewa failure. The errors are ordered by condition check.
9710616bf03SSona Mathew
972c0fa892aSSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KM_PULL_RESPONSE(x0)
9730616bf03SSona Mathew   :header: "ID", "Condition"
9740616bf03SSona Mathew   :widths: 1 5
9750616bf03SSona Mathew
976c0fa892aSSona Mathew   ``E_RMM_OK``,Response is retrieved successfully.
977c0fa892aSSona Mathew   ``E_RMM_INVAL``,Arguments to pull response SMC is not correct.
9780616bf03SSona Mathew   ``E_RMM_UNK``,Unknown error or the SMC is not present if the version is < 0.6.
979c0fa892aSSona Mathew   ``E_RMM_AGAIN``,IDE-KM response queue is empty and no response is available.
9800616bf03SSona Mathew
981c0fa892aSSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KM_PULL_RESPONSE(x1)
982c0fa892aSSona Mathew   :header: "ID", "Condition"
983c0fa892aSSona Mathew   :widths: 1 5
984c0fa892aSSona Mathew
985c0fa892aSSona Mathew   ``E_RMM_OK``,The previous request was successful.
986c0fa892aSSona Mathew   ``E_RMM_FAULT``,The previous request was not successful.
987c0fa892aSSona Mathew   ``E_RMM_INVAL``,Arguments to previous request were incorrect.
988c0fa892aSSona Mathew   ``E_RMM_UNK``,Previous request returned unknown error.
9890616bf03SSona Mathew
990745c129aSAndre PrzywaraRMM_RESERVE_MEMORY command
991745c129aSAndre Przywara==========================
992745c129aSAndre Przywara
993745c129aSAndre PrzywaraThis command is used to reserve memory for the RMM, during RMM boot time.
994745c129aSAndre PrzywaraThis is not a fully featured dynamic memory allocator, since reservations cannot
995745c129aSAndre Przywarabe freed again, and they must happen during the cold/warm boot phase of RMM.
996745c129aSAndre PrzywaraHowever it allows to size data structures in RMM based on runtime decisions,
997745c129aSAndre Przywarafor instance depending on the number of cores or the amount of memory installed.
998745c129aSAndre PrzywaraThis command is available from v0.7 of the RMM-EL3 interface.
999745c129aSAndre Przywara
1000745c129aSAndre PrzywaraFID
1001745c129aSAndre Przywara---
1002745c129aSAndre Przywara
1003745c129aSAndre Przywara``0xC40001BB``
1004745c129aSAndre Przywara
1005745c129aSAndre PrzywaraInput values
1006745c129aSAndre Przywara------------
1007745c129aSAndre Przywara
1008745c129aSAndre Przywara.. csv-table:: Input values for RMM_RESERVE_MEMORY
1009745c129aSAndre Przywara   :header: "Name", "Register", "Field", "Type", "Description"
1010745c129aSAndre Przywara   :widths: 1 1 1 1 5
1011745c129aSAndre Przywara
1012745c129aSAndre Przywara   fid,x0,[63:0],UInt64,Command FID
1013745c129aSAndre Przywara   size,x1,[63:0],Size,"required size of the memory region, in bytes"
1014745c129aSAndre Przywara   args,x2,[63:56],UInt64,"alignment requirement, in bits. A value of 16 would return a 64 KB aligned base address."
1015745c129aSAndre Przywara   args,x2,[55:32],UInt64,reserved
1016745c129aSAndre Przywara   args,x2,[31:1],UInt64,"flags (reserved)"
1017745c129aSAndre Przywara   args,x2,[0],UInt64,"flags: local CPU: Determines whether the reservation should be taken from a pool close to the calling CPU."
1018745c129aSAndre Przywara
1019745c129aSAndre PrzywaraOutput values
1020745c129aSAndre Przywara-------------
1021745c129aSAndre Przywara
1022745c129aSAndre Przywara.. csv-table:: Output values for RMM_RESERVE_MEMORY
1023745c129aSAndre Przywara   :header: "Name", "Register", "Field", "Type", "Description"
1024745c129aSAndre Przywara   :widths: 1 1 1 1 5
1025745c129aSAndre Przywara
1026745c129aSAndre Przywara   Result,x0,[63:0],Error Code,Command return status.
1027745c129aSAndre Przywara   address,x1,[63:0],Address, "Physical address of the reserved memory area."
1028745c129aSAndre Przywara
1029745c129aSAndre Przywara
1030745c129aSAndre PrzywaraFailure conditions
1031745c129aSAndre Przywara------------------
1032745c129aSAndre Przywara
1033745c129aSAndre PrzywaraThe table below shows all the possible error codes returned in ``Result`` upon
1034745c129aSAndre Przywaraa failure. The errors are ordered by condition check.
1035745c129aSAndre Przywara
1036745c129aSAndre Przywara.. csv-table:: Failure conditions for RMM_RESERVE_MEMORY
1037745c129aSAndre Przywara   :header: "ID", "Condition"
1038745c129aSAndre Przywara   :widths: 1 5
1039745c129aSAndre Przywara
1040745c129aSAndre Przywara   ``E_RMM_INVAL``,"unrecognised flag bit"
1041*00e62ff9SJuan Pablo Conde   ``E_RMM_UNK``,"if the SMC is not present, if interface version is <0.7"
1042745c129aSAndre Przywara   ``E_RMM_NOMEM``,"size of region is larger than the available memory"
1043745c129aSAndre Przywara   ``E_RMM_OK``,No errors detected
1044745c129aSAndre Przywara
104569447290SJavier Almansa SobrinoRMM-EL3 world switch register save restore convention
104669447290SJavier Almansa Sobrino_____________________________________________________
104769447290SJavier Almansa Sobrino
104869447290SJavier Almansa SobrinoAs part of NS world switch, EL3 is expected to maintain a register context
104969447290SJavier Almansa Sobrinospecific to each world and will save and restore the registers
105069447290SJavier Almansa Sobrinoappropriately. This section captures the contract between EL3 and RMM on the
105169447290SJavier Almansa Sobrinoregister set to be saved and restored.
105269447290SJavier Almansa Sobrino
105369447290SJavier Almansa SobrinoEL3 must maintain a separate register context for the following:
105469447290SJavier Almansa Sobrino
105569447290SJavier Almansa Sobrino   #. General purpose registers (x0-x30) and ``sp_el0``, ``sp_el2`` stack pointers
105669447290SJavier Almansa Sobrino   #. EL2 system register context for all enabled features by EL3. These include system registers with the ``_EL2`` prefix. The EL2 physical and virtual timer registers must not be included in this.
105769447290SJavier Almansa Sobrino
10588e51cccaSAlexeiFedorovAs part of SMC forwarding between the NS world and Realm world, EL3 allows x0-x7 to be passed
10598e51cccaSAlexeiFedorovas arguments to Realm and x0-x4 to be used for return arguments back to Non Secure.
10608e51cccaSAlexeiFedorovAs per SMCCCv1.2, x4 must be preserved if not being used as return argument by the SMC function
10618e51cccaSAlexeiFedorovand it is the responsibility of RMM to preserve this or use this as a return argument.
10628e51cccaSAlexeiFedorovEL3 will always copy x0-x4 from Realm context to NS Context.
106369447290SJavier Almansa Sobrino
106413cc1aa7SShruti GuptaEL3 must save and restore the following as part of world switch:
106513cc1aa7SShruti Gupta   #. EL2 system registers with the exception of ``zcr_el2`` register.
106613cc1aa7SShruti Gupta   #. PAuth key registers (APIA, APIB, APDA, APDB, APGA).
106713cc1aa7SShruti Gupta
106869447290SJavier Almansa SobrinoEL3 will not save some registers as mentioned in the below list. It is the
106969447290SJavier Almansa Sobrinoresponsibility of RMM to ensure that these are appropriately saved if the
107069447290SJavier Almansa SobrinoRealm World makes use of them:
107169447290SJavier Almansa Sobrino
107269447290SJavier Almansa Sobrino   #. FP/SIMD registers
107369447290SJavier Almansa Sobrino   #. SVE registers
107469447290SJavier Almansa Sobrino   #. SME registers
107513cc1aa7SShruti Gupta   #. EL1/0 registers with the exception of PAuth key registers as mentioned above.
107613cc1aa7SShruti Gupta   #. zcr_el2 register.
107769447290SJavier Almansa Sobrino
107813cc1aa7SShruti GuptaIt is essential that EL3 honors this contract to maintain the Confidentiality and integrity
107913cc1aa7SShruti Guptaof the Realm world.
10808e51cccaSAlexeiFedorov
108169447290SJavier Almansa SobrinoSMCCC v1.3 allows NS world to specify whether SVE context is in use. In this
108269447290SJavier Almansa Sobrinocase, RMM could choose to not save the incoming SVE context but must ensure
108369447290SJavier Almansa Sobrinoto clear SVE registers if they have been used in Realm World. The same applies
108469447290SJavier Almansa Sobrinoto SME registers.
108569447290SJavier Almansa Sobrino
108669447290SJavier Almansa SobrinoTypes
108769447290SJavier Almansa Sobrino_____
108869447290SJavier Almansa Sobrino
108969447290SJavier Almansa Sobrino.. _rmm_el3_manifest_struct:
109069447290SJavier Almansa Sobrino
1091dc0ca64eSJavier Almansa SobrinoRMM-EL3 Boot Manifest structure
1092dc0ca64eSJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109369447290SJavier Almansa Sobrino
109490552c61SAlexeiFedorovThe RMM-EL3 Boot Manifest v0.5 structure contains platform boot information passed
109590552c61SAlexeiFedorovfrom EL3 to RMM. The size of the Boot Manifest is 160 bytes.
109669447290SJavier Almansa Sobrino
109769447290SJavier Almansa SobrinoThe members of the RMM-EL3 Boot Manifest structure are shown in the following
109869447290SJavier Almansa Sobrinotable:
109969447290SJavier Almansa Sobrino
110090552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
11011db295cfSAlexeiFedorov|        Name       | Offset |       Type        |                 Description                  |
110290552c61SAlexeiFedorov+===================+========+===================+==============================================+
11031db295cfSAlexeiFedorov| version           |   0    |      uint32_t     | Boot Manifest version                        |
110490552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
11051db295cfSAlexeiFedorov| padding           |   4    |      uint32_t     | Reserved, set to 0                           |
110690552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
110790552c61SAlexeiFedorov| plat_data         |   8    |      uint64_t     | Pointer to Platform Data section             |
110890552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
1109bef44f60SAlexeiFedorov| plat_dram         |   16   |    memory_info    | NS DRAM Layout Info structure                |
111090552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
111188f7c87bSHarry Moulton| plat_console      |   40   |   console_list    | List of consoles available to RMM            |
111290552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
1113bef44f60SAlexeiFedorov| plat_ncoh_region  |   64   |    memory_info    | Device non-coherent ranges Info structure    |
111490552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
1115bef44f60SAlexeiFedorov| plat_coh_region   |   88   |    memory_info    | Device coherent ranges Info structure        |
111690552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
111790552c61SAlexeiFedorov| plat_smmu         |   112  |     smmu_list     | List of SMMUs available to RMM               |
111890552c61SAlexeiFedorov|                   |        |                   | (from Boot Manifest v0.5)                    |
111990552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
112090552c61SAlexeiFedorov| plat_root_complex |   136  | root_complex_list | List of PCIe root complexes available to RMM |
112190552c61SAlexeiFedorov|                   |        |                   | (from Boot Manifest v0.5)                    |
112290552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
112369447290SJavier Almansa Sobrino
1124bef44f60SAlexeiFedorov.. _memory_info_struct:
11251db295cfSAlexeiFedorov
1126bef44f60SAlexeiFedorovMemory Info structure
112790552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~
11281db295cfSAlexeiFedorov
1129bef44f60SAlexeiFedorovMemory Info structure contains information about platform memory layout.
1130bef44f60SAlexeiFedorovThe members of this structure are shown in the table below:
11311db295cfSAlexeiFedorov
113290552c61SAlexeiFedorov+-----------+--------+---------------+----------------------------------------+
11331db295cfSAlexeiFedorov|   Name    | Offset |     Type      |              Description               |
113490552c61SAlexeiFedorov+===========+========+===============+========================================+
1135bef44f60SAlexeiFedorov| num_banks |   0    |    uint64_t   | Number of memory banks/device regions  |
113690552c61SAlexeiFedorov+-----------+--------+---------------+----------------------------------------+
1137bef44f60SAlexeiFedorov| banks     |   8    | memory_bank * | Pointer to 'memory_bank'[] array       |
113890552c61SAlexeiFedorov+-----------+--------+---------------+----------------------------------------+
11391db295cfSAlexeiFedorov| checksum  |   16   |    uint64_t   | Checksum                               |
114090552c61SAlexeiFedorov+-----------+--------+---------------+----------------------------------------+
11411db295cfSAlexeiFedorov
11421db295cfSAlexeiFedorovChecksum is calculated as two's complement sum of 'num_banks', 'banks' pointer
1143bef44f60SAlexeiFedorovand memory banks data array pointed by it.
11441db295cfSAlexeiFedorov
1145bef44f60SAlexeiFedorov.. _memory_bank_struct:
11461db295cfSAlexeiFedorov
1147bef44f60SAlexeiFedorovMemory Bank/Device region structure
1148bef44f60SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11491db295cfSAlexeiFedorov
1150bef44f60SAlexeiFedorovMemory Bank structure contains information about each memory bank/device region:
11511db295cfSAlexeiFedorov
115290552c61SAlexeiFedorov+------+--------+----------+--------------------------------------------+
11531db295cfSAlexeiFedorov| Name | Offset |   Type   |                Description                 |
115490552c61SAlexeiFedorov+======+========+==========+============================================+
115590552c61SAlexeiFedorov| base |   0    | uint64_t | Base address                               |
115690552c61SAlexeiFedorov+------+--------+----------+--------------------------------------------+
1157bef44f60SAlexeiFedorov| size |   8    | uint64_t | Size of memory bank/device region in bytes |
115890552c61SAlexeiFedorov+------+--------+----------+--------------------------------------------+
11591db295cfSAlexeiFedorov
116088f7c87bSHarry Moulton.. _console_list_struct:
11611db295cfSAlexeiFedorov
116288f7c87bSHarry MoultonConsole List structure
116388f7c87bSHarry Moulton~~~~~~~~~~~~~~~~~~~~~~
116488f7c87bSHarry Moulton
116588f7c87bSHarry MoultonConsole List structure contains information about the available consoles for RMM.
116688f7c87bSHarry MoultonThe members of this structure are shown in the table below:
116788f7c87bSHarry Moulton
116890552c61SAlexeiFedorov+--------------+--------+----------------+-----------------------------------+
116988f7c87bSHarry Moulton|   Name       | Offset |     Type       |           Description             |
117090552c61SAlexeiFedorov+==============+========+================+===================================+
117188f7c87bSHarry Moulton| num_consoles |   0    |   uint64_t     | Number of consoles                |
117290552c61SAlexeiFedorov+--------------+--------+----------------+-----------------------------------+
117388f7c87bSHarry Moulton| consoles     |   8    | console_info * | Pointer to 'console_info'[] array |
117490552c61SAlexeiFedorov+--------------+--------+----------------+-----------------------------------+
117588f7c87bSHarry Moulton| checksum     |   16   |   uint64_t     | Checksum                          |
117690552c61SAlexeiFedorov+--------------+--------+----------------+-----------------------------------+
117788f7c87bSHarry Moulton
117888f7c87bSHarry MoultonChecksum is calculated as two's complement sum of 'num_consoles', 'consoles'
117988f7c87bSHarry Moultonpointer and the consoles array pointed by it.
118088f7c87bSHarry Moulton
118188f7c87bSHarry Moulton.. _console_info_struct:
118288f7c87bSHarry Moulton
118388f7c87bSHarry MoultonConsole Info structure
118488f7c87bSHarry Moulton~~~~~~~~~~~~~~~~~~~~~~
118588f7c87bSHarry Moulton
118688f7c87bSHarry MoultonConsole Info structure contains information about each Console available to RMM.
118788f7c87bSHarry Moulton
118890552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
118988f7c87bSHarry Moulton|   Name    | Offset |   Type   |             Description              |
119090552c61SAlexeiFedorov+===========+========+==========+======================================+
119190552c61SAlexeiFedorov| base      |   0    | uint64_t | Console Base address                 |
119290552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
119388f7c87bSHarry Moulton| map_pages |   8    | uint64_t | Num of pages to map for console MMIO |
119490552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
1195bef44f60SAlexeiFedorov| name      |   16   | char[8]  | Name of console                      |
119690552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
1197bef44f60SAlexeiFedorov| clk_in_hz |   24   | uint64_t | UART clock (in Hz) for console       |
119890552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
119988f7c87bSHarry Moulton| baud_rate |   32   | uint64_t | Baud rate                            |
120090552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
120188f7c87bSHarry Moulton| flags     |   40   | uint64_t | Additional flags (RES0)              |
120290552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
120390552c61SAlexeiFedorov
120490552c61SAlexeiFedorov.. _smmu_list_struct:
120590552c61SAlexeiFedorov
120690552c61SAlexeiFedorovSMMU List structure
120790552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~
120890552c61SAlexeiFedorov
120990552c61SAlexeiFedorovSMMU List structure contains information about SMMUs available for RMM.
121090552c61SAlexeiFedorovThe members of this structure are shown in the table below:
121190552c61SAlexeiFedorov
121290552c61SAlexeiFedorov+-----------+--------+-------------+--------------------------------+
121390552c61SAlexeiFedorov|    Name   | Offset |     Type    |          Description           |
121490552c61SAlexeiFedorov+===========+========+=============+================================+
121590552c61SAlexeiFedorov| num_smmus |   0    |   uint64_t  | Number of SMMUs                |
121690552c61SAlexeiFedorov+-----------+--------+-------------+--------------------------------+
121790552c61SAlexeiFedorov| smmus     |   8    | smmu_info * | Pointer to 'smmu_info'[] array |
121890552c61SAlexeiFedorov+-----------+--------+-------------+--------------------------------+
121990552c61SAlexeiFedorov| checksum  |   16   |   uint64_t  | Checksum                       |
122090552c61SAlexeiFedorov+-----------+--------+-------------+--------------------------------+
122190552c61SAlexeiFedorov
122290552c61SAlexeiFedorov.. _smmu_info_struct:
122390552c61SAlexeiFedorov
122490552c61SAlexeiFedorovSMMU Info structure
122590552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~
122690552c61SAlexeiFedorov
122790552c61SAlexeiFedorovSMMU Info structure contains information about each SMMU available to RMM.
122890552c61SAlexeiFedorov
122990552c61SAlexeiFedorov+-------------+--------+----------+-------------------------------+
123090552c61SAlexeiFedorov|    Name     | Offset |   Type   |          Description          |
123190552c61SAlexeiFedorov+=============+========+==========+===============================+
123290552c61SAlexeiFedorov| smmu_base   |   0    | uint64_t | SMMU Base address             |
123390552c61SAlexeiFedorov+-------------+--------+----------+-------------------------------+
123490552c61SAlexeiFedorov| smmu_r_base |   8    | uint64_t | SMMU Realm Pages base address |
123590552c61SAlexeiFedorov+-------------+--------+----------+-------------------------------+
123690552c61SAlexeiFedorov
123790552c61SAlexeiFedorov.. _root_complex_list_struct:
123890552c61SAlexeiFedorov
123990552c61SAlexeiFedorovRoot Complex List structure
124090552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~~~~
124190552c61SAlexeiFedorov
124290552c61SAlexeiFedorovRoot Complex List structure contains information about PCIe root complexes available for RMM.
124390552c61SAlexeiFedorovThe members of this structure are shown in the table below.
124490552c61SAlexeiFedorov
124590552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
124690552c61SAlexeiFedorov|       Name       | Offset |        Type         |           Description               |
124790552c61SAlexeiFedorov+==================+========+=====================+=====================================+
124890552c61SAlexeiFedorov| num_root_complex |   0    |      uint64_t       | Number of root complexes            |
124990552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
125090552c61SAlexeiFedorov| rc_info_version  |   8    |      uint32_t       | Root Complex Info structure version |
125190552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
125290552c61SAlexeiFedorov| padding          |   12   |      uint32_t       | Reserved, set to 0                  |
125390552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
125490552c61SAlexeiFedorov| root_complex     |   16   | root_complex_info * | Pointer to 'root_complex'[] array   |
125590552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
125690552c61SAlexeiFedorov| checksum         |   24   |      uint64_t       | Checksum                            |
125790552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
125890552c61SAlexeiFedorov
125990552c61SAlexeiFedorovThe checksum calculation of Root Complex List structure includes all data structures
126090552c61SAlexeiFedorovreferenced by 'root_complex_info' pointer.
126190552c61SAlexeiFedorov
126290552c61SAlexeiFedorov.. _root_complex_info_struct:
126390552c61SAlexeiFedorov
126490552c61SAlexeiFedorovRoot Complex Info structure
126590552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~~~~
126690552c61SAlexeiFedorov
126790552c61SAlexeiFedorovRoot Complex Info structure contains information about each PCIe root complex available to RMM.
126890552c61SAlexeiFedorovThe table below describes the members of this structure as per v0.1.
126990552c61SAlexeiFedorov
127090552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
127190552c61SAlexeiFedorov|    Name         | Offset |       Type       |               Description           |
127290552c61SAlexeiFedorov+=================+========+==================+=====================================+
127390552c61SAlexeiFedorov| ecam_base       |   0    |     uint64_t     | PCIe ECAM Base address              |
127490552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
127590552c61SAlexeiFedorov| segment         |   8    |     uint8_t      | PCIe segment identifier             |
127690552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
127790552c61SAlexeiFedorov| padding[3]      |   9    |     uint8_t      | Reserved, set to 0                  |
127890552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
127990552c61SAlexeiFedorov| num_root_ports  |   12   |     uint32_t     | Number of root ports                |
128090552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
128190552c61SAlexeiFedorov| root_ports      |   16   | root_port_info * | Pointer to 'root_port_info'[] array |
128290552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
128390552c61SAlexeiFedorov
128490552c61SAlexeiFedorovThe Root Complex Info structure version uses the same numbering scheme as described in
128590552c61SAlexeiFedorov:ref:`rmm_el3_ifc_versioning`.
128690552c61SAlexeiFedorov
128790552c61SAlexeiFedorov.. _root_port_info_struct:
128890552c61SAlexeiFedorov
128990552c61SAlexeiFedorovRoot Port Info structure
129090552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~
129190552c61SAlexeiFedorov
129290552c61SAlexeiFedorovRoot Complex Info structure contains information about each root port in PCIe root complex.
129390552c61SAlexeiFedorov
129490552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
129590552c61SAlexeiFedorov|      Name        | Offset |       Type         |              Description              |
129690552c61SAlexeiFedorov+==================+========+====================+=======================================+
129790552c61SAlexeiFedorov| root_port_id     |   0    |     uint16_t       | Root Port identifier                  |
129890552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
129990552c61SAlexeiFedorov| padding          |   2    |     uint16_t       | Reserved, set to 0                    |
130090552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
130190552c61SAlexeiFedorov| num_bdf_mappings |   4    |     uint32_t       | Number of BDF mappings                |
130290552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
130390552c61SAlexeiFedorov| bdf_mappings     |   8    | bdf_mapping_info * | Pointer to 'bdf_mapping_info'[] array |
130490552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
130590552c61SAlexeiFedorov
130690552c61SAlexeiFedorov.. _bdf_mapping_info_struct:
130790552c61SAlexeiFedorov
130890552c61SAlexeiFedorovBDF Mapping Info structure
130990552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~~~
131090552c61SAlexeiFedorov
131190552c61SAlexeiFedorovBDF Mapping Info structure contains information about each Device-Bus-Function (BDF) mapping
131290552c61SAlexeiFedorovfor PCIe root port.
131390552c61SAlexeiFedorov
131490552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
131590552c61SAlexeiFedorov|     Name     | Offset |   Type   |                     Description                      |
131690552c61SAlexeiFedorov+==============+========+==========+======================================================+
131790552c61SAlexeiFedorov| mapping_base |   0    | uint16_t | Base of BDF mapping (inclusive)                      |
131890552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
131990552c61SAlexeiFedorov| mapping_top  |   2    | uint16_t | Top of BDF mapping (exclusive)                       |
132090552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
132190552c61SAlexeiFedorov| mapping_off  |   4    | uint16_t | Mapping offset, as per Arm Base System Architecture: |
132290552c61SAlexeiFedorov|              |        |          | StreamID = RequesterID[N-1:0] + (1<<N)*Constant_B    |
132390552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
132490552c61SAlexeiFedorov| smmu_idx     |   6    | uint16_t | SMMU index in 'smmu_info'[] array                    |
132590552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
13261db295cfSAlexeiFedorov
1327b226357bSRaghu Krishnamurthy.. _el3_token_sign_request_struct:
1328b226357bSRaghu Krishnamurthy
1329b226357bSRaghu KrishnamurthyEL3 Token Sign Request structure
1330b226357bSRaghu Krishnamurthy~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1331b226357bSRaghu Krishnamurthy
1332bef44f60SAlexeiFedorovThis structure represents a realm attestation token signing request.
1333b226357bSRaghu Krishnamurthy
1334b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1335b226357bSRaghu Krishnamurthy|   Name      | Offset |     Type      |               Description               |
1336b226357bSRaghu Krishnamurthy+=============+========+===============+=========================================+
1337b226357bSRaghu Krishnamurthy| sig_alg_id  |   0    |   uint32_t    | Algorithm idenfier for the sign request.|
1338b226357bSRaghu Krishnamurthy|             |        |               | - 0x0: ECC SECP384R1 (ECDSA)            |
1339b226357bSRaghu Krishnamurthy|             |        |               | - Other values reserved                 |
1340b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1341b226357bSRaghu Krishnamurthy| rec_granule |   8    |   uint64_t    | Identifier used by RMM to associate     |
1342b226357bSRaghu Krishnamurthy|             |        |               | a signing request to a realm. Must not  |
1343b226357bSRaghu Krishnamurthy|             |        |               | be interpreted or modified.             |
1344b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1345b226357bSRaghu Krishnamurthy| req_ticket  |   16   |   uint64_t    | Value used by RMM to associate request  |
1346b226357bSRaghu Krishnamurthy|             |        |               | and responses. Must not be interpreted  |
1347b226357bSRaghu Krishnamurthy|             |        |               | or modified.                            |
1348b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1349b226357bSRaghu Krishnamurthy| hash_alg_id |   24   |   uint32_t    | Hash algorithm for data in `hash_buf`   |
1350b226357bSRaghu Krishnamurthy|             |        |               | - 0x1: SHA2-384                         |
1351b226357bSRaghu Krishnamurthy|             |        |               | - All other values reserved.            |
1352b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1353b226357bSRaghu Krishnamurthy| hash_buf    |   32   |   uint8_t[]   | TBS (to-be-signed) Hash of length       |
1354b226357bSRaghu Krishnamurthy|             |        |               | defined by hash algorithm `hash_alg_id` |
1355b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1356b226357bSRaghu Krishnamurthy
1357b226357bSRaghu Krishnamurthy.. _el3_token_sign_response_struct:
1358b226357bSRaghu Krishnamurthy
1359b226357bSRaghu KrishnamurthyEL3 Token Sign Response structure
1360b226357bSRaghu Krishnamurthy~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1361b226357bSRaghu Krishnamurthy
1362b226357bSRaghu KrishnamurthyThis structure represents a realm attestation token signing response.
1363b226357bSRaghu Krishnamurthy
1364b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1365b226357bSRaghu Krishnamurthy|   Name        | Offset |     Type      |               Description               |
1366b226357bSRaghu Krishnamurthy+===============+========+===============+=========================================+
1367b226357bSRaghu Krishnamurthy| rec_granule   |   0    |   uint64_t    | Identifier used by RMM to associate     |
1368b226357bSRaghu Krishnamurthy|               |        |               | a signing request to a realm. Must not  |
1369b226357bSRaghu Krishnamurthy|               |        |               | be interpreted or modified.             |
1370b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1371b226357bSRaghu Krishnamurthy| req_ticket    |   8    |   uint64_t    | Value used by RMM to associate request  |
1372b226357bSRaghu Krishnamurthy|               |        |               | and responses. Must not be interpreted  |
1373b226357bSRaghu Krishnamurthy|               |        |               | or modified.                            |
1374b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1375b226357bSRaghu Krishnamurthy| sig_len       |   16   |   uint16_t    | Length of the `signature_buf` field     |
1376b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1377b226357bSRaghu Krishnamurthy| signature_buf |   18   |   uint8_t[]   | Signature                               |
1378b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1379