xref: /rk3399_ARM-atf/docs/components/rmm-el3-comms-spec.rst (revision 0616bf0307fd62c445db6892e1145ed746ae334e)
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*0616bf03SSona MathewThis document specifies the 0.6 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.
10369447290SJavier Almansa Sobrino
104dc0ca64eSJavier Almansa SobrinoDuring cold boot, EL3 firmware needs to allocate a 4KB page that will be
10569447290SJavier Almansa Sobrinopassed to RMM in x3. This memory will be used as shared buffer for communication
10669447290SJavier Almansa Sobrinobetween EL3 and RMM. It must be assigned to Realm world and must be mapped with
10769447290SJavier Almansa SobrinoNormal memory attributes (IWB-OWB-ISH) at EL3. At boot, this memory will be
10869447290SJavier Almansa Sobrinoused to populate the Boot Manifest. Since the Boot Manifest can be accessed by
10969447290SJavier Almansa SobrinoRMM prior to enabling its MMU, EL3 must ensure that proper cache maintenance
11069447290SJavier Almansa Sobrinooperations are performed after the Boot Manifest is populated.
11169447290SJavier Almansa Sobrino
11269447290SJavier Almansa SobrinoEL3 should also ensure that this shared buffer is always available for use by RMM
11369447290SJavier Almansa Sobrinoduring the lifetime of the system and that it can be used for runtime
11469447290SJavier Almansa Sobrinocommunication between RMM and EL3. For example, when RMM invokes attestation
11569447290SJavier Almansa Sobrinoservice commands in EL3, this buffer can be used to exchange data between RMM
11669447290SJavier Almansa Sobrinoand EL3. It is also allowed for RMM to invoke runtime services provided by EL3
11769447290SJavier Almansa Sobrinoutilizing this buffer during the boot phase, prior to return back to EL3 via
11869447290SJavier Almansa SobrinoRMM_BOOT_COMPLETE SMC.
11969447290SJavier Almansa Sobrino
12069447290SJavier Almansa SobrinoRMM should map this memory page into its Stage 1 page-tables using Normal
12169447290SJavier Almansa Sobrinomemory attributes.
12269447290SJavier Almansa Sobrino
12369447290SJavier Almansa SobrinoDuring runtime, it is the RMM which initiates any communication with EL3. If that
12469447290SJavier Almansa Sobrinocommunication requires the use of the shared area, it is expected that RMM needs
12569447290SJavier Almansa Sobrinoto do the necessary concurrency protection to prevent the use of the same buffer
12669447290SJavier Almansa Sobrinoby other PEs.
12769447290SJavier Almansa Sobrino
12869447290SJavier Almansa SobrinoThe following sequence diagram shows how a generic EL3 Firmware would boot RMM.
12969447290SJavier Almansa Sobrino
13069447290SJavier Almansa Sobrino.. image:: ../resources/diagrams/rmm_cold_boot_generic.png
13169447290SJavier Almansa Sobrino
13269447290SJavier Almansa SobrinoWarm Boot Interface
13369447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~
13469447290SJavier Almansa Sobrino
13569447290SJavier Almansa SobrinoAt warm boot, RMM is already initialized and only some per-CPU initialization
13669447290SJavier Almansa Sobrinois still pending. The only argument that is required by RMM at this stage is
13769447290SJavier Almansa Sobrinothe CPU Id, which will be passed through register x0 whilst x1 to x3 are RES0.
13869447290SJavier Almansa SobrinoThis is summarized in the following table:
13969447290SJavier Almansa Sobrino
14069447290SJavier Almansa Sobrino.. csv-table::
14169447290SJavier Almansa Sobrino   :header: "Register", "Value"
14269447290SJavier Almansa Sobrino   :widths: 1, 5
14369447290SJavier Almansa Sobrino
14469447290SJavier 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).
14569447290SJavier Almansa Sobrino   x1 - x3,RES0
14669447290SJavier Almansa Sobrino
14769447290SJavier Almansa SobrinoBoot error handling and return values
14869447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14969447290SJavier Almansa Sobrino
15069447290SJavier Almansa SobrinoAfter boot up and initialization, RMM returns control back to EL3 through a
15169447290SJavier Almansa Sobrino``RMM_BOOT_COMPLETE`` SMC call. The only argument of this SMC call will
15269447290SJavier Almansa Sobrinobe returned in x1 and it will encode a signed integer with the error reason
15369447290SJavier Almansa Sobrinoas per the following table:
15469447290SJavier Almansa Sobrino
15569447290SJavier Almansa Sobrino.. csv-table::
15669447290SJavier Almansa Sobrino   :header: "Error code", "Description", "ID"
15769447290SJavier Almansa Sobrino   :widths: 2 4 1
15869447290SJavier Almansa Sobrino
15969447290SJavier Almansa Sobrino   ``E_RMM_BOOT_SUCCESS``,Boot successful,0
16069447290SJavier Almansa Sobrino   ``E_RMM_BOOT_ERR_UNKNOWN``,Unknown error,-1
16169447290SJavier Almansa Sobrino   ``E_RMM_BOOT_VERSION_NOT_VALID``,Boot Interface version reported by EL3 is not supported by RMM,-2
162ca99680cSJavier Almansa Sobrino   ``E_RMM_BOOT_CPUS_OUT_OF_RANGE``,Number of CPUs reported by EL3 larger than maximum supported by RMM,-3
163ca99680cSJavier 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
16469447290SJavier Almansa Sobrino   ``E_RMM_BOOT_INVALID_SHARED_BUFFER``,Invalid pointer to shared memory area,-5
1651db295cfSAlexeiFedorov   ``E_RMM_BOOT_MANIFEST_VERSION_NOT_SUPPORTED``,Version reported by the Boot Manifest not supported by RMM,-6
1661db295cfSAlexeiFedorov   ``E_RMM_BOOT_MANIFEST_DATA_ERROR``,Error parsing core Boot Manifest,-7
16769447290SJavier Almansa Sobrino
16869447290SJavier Almansa SobrinoFor any error detected in RMM during cold or warm boot, RMM will return back to
16969447290SJavier Almansa SobrinoEL3 using ``RMM_BOOT_COMPLETE`` SMC with an appropriate error code. It is
17069447290SJavier Almansa Sobrinoexpected that EL3 will take necessary action to disable Realm world for further
17169447290SJavier Almansa Sobrinoentry from NS Host on receiving an error. This will be done across all the PEs
17269447290SJavier Almansa Sobrinoin the system so as to present a symmetric view to the NS Host. Any further
17369447290SJavier Almansa Sobrinowarm boot by any PE should not enter RMM using the warm boot interface.
17469447290SJavier Almansa Sobrino
17569447290SJavier Almansa Sobrino.. _rmm_el3_boot_manifest:
17669447290SJavier Almansa Sobrino
17769447290SJavier Almansa SobrinoBoot Manifest
17869447290SJavier Almansa Sobrino~~~~~~~~~~~~~
17969447290SJavier Almansa Sobrino
1801db295cfSAlexeiFedorovDuring cold boot, EL3 Firmware passes a memory Boot Manifest to RMM containing
18169447290SJavier Almansa Sobrinoplatform information.
18269447290SJavier Almansa Sobrino
1831db295cfSAlexeiFedorovThis Boot Manifest is versioned independently of the Boot Interface, to help
1841db295cfSAlexeiFedorovevolve the former independent of the latter.
185bef44f60SAlexeiFedorovThe current version for the Boot Manifest is ``v0.4`` and the rules explained
18669447290SJavier Almansa Sobrinoin :ref:`rmm_el3_ifc_versioning` apply on this version as well.
18769447290SJavier Almansa Sobrino
188bef44f60SAlexeiFedorovThe Boot Manifest v0.4 has the following fields:
18969447290SJavier Almansa Sobrino
190bef44f60SAlexeiFedorov   - version : Version of the Manifest (v0.4)
1911db295cfSAlexeiFedorov   - plat_data : Pointer to the platform specific data and not specified by this
1921db295cfSAlexeiFedorov     document. These data are optional and can be NULL.
1931db295cfSAlexeiFedorov   - plat_dram : Structure encoding the NS DRAM information on the platform. This
19488f7c87bSHarry Moulton     field is optional and platform can choose to zero out this structure if
1951db295cfSAlexeiFedorov     RMM does not need EL3 to send this information during the boot.
19688f7c87bSHarry Moulton   - plat_console : Structure encoding the list of consoles for RMM use on the
19788f7c87bSHarry Moulton     platform. This field is optional and platform can choose to not populate
19888f7c87bSHarry Moulton     the console list if this is not needed by the RMM for this platform.
19969447290SJavier Almansa Sobrino
2001db295cfSAlexeiFedorovFor the current version of the Boot Manifest, the core manifest contains a pointer
2011db295cfSAlexeiFedorovto the platform data. EL3 must ensure that the whole Boot Manifest, including
2021db295cfSAlexeiFedorovthe platform data, if available, fits inside the RMM EL3 shared buffer.
20369447290SJavier Almansa Sobrino
2041db295cfSAlexeiFedorovFor the data structure specification of Boot Manifest, refer to
20569447290SJavier Almansa Sobrino:ref:`rmm_el3_manifest_struct`
20669447290SJavier Almansa Sobrino
20769447290SJavier Almansa Sobrino.. _runtime_services_and_interface:
20869447290SJavier Almansa Sobrino
209e50fedbcSJavier Almansa SobrinoRMM-EL3 Runtime Interface
21069447290SJavier Almansa Sobrino__________________________
21169447290SJavier Almansa Sobrino
21269447290SJavier Almansa SobrinoThis section defines the RMM-EL3 runtime interface which specifies the ABI for
21369447290SJavier Almansa SobrinoEL3 services expected by RMM at runtime as well as the register save and
21469447290SJavier Almansa Sobrinorestore convention between EL3 and RMM as part of RMI call handling. It is
21569447290SJavier Almansa Sobrinoimportant to note that RMM is allowed to invoke EL3-RMM runtime interface
21669447290SJavier Almansa Sobrinoservices during the boot phase as well. The EL3 runtime service handling must
21769447290SJavier Almansa Sobrinonot result in a world switch to another world unless specified. Both the RMM
21869447290SJavier Almansa Sobrinoand EL3 are allowed to make suitable optimizations based on this assumption.
21969447290SJavier Almansa Sobrino
22069447290SJavier Almansa SobrinoIf the interface requires the use of memory, then the memory references should
22169447290SJavier Almansa Sobrinobe within the shared buffer communicated as part of the boot interface. See
22269447290SJavier Almansa Sobrino:ref:`rmm_cold_boot_interface` for properties of this shared buffer which both
22369447290SJavier Almansa SobrinoEL3 and RMM must adhere to.
22469447290SJavier Almansa Sobrino
22569447290SJavier Almansa SobrinoRMM-EL3 runtime service return codes
22669447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22769447290SJavier Almansa Sobrino
22869447290SJavier Almansa SobrinoThe return codes from EL3 to RMM is a 32 bit signed integer which encapsulates
22969447290SJavier Almansa Sobrinoerror condition as described in the following table:
23069447290SJavier Almansa Sobrino
23169447290SJavier Almansa Sobrino.. csv-table::
23269447290SJavier Almansa Sobrino   :header: "Error code", "Description", "ID"
23369447290SJavier Almansa Sobrino   :widths: 2 4 1
23469447290SJavier Almansa Sobrino
23569447290SJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected,0
23669447290SJavier Almansa Sobrino   ``E_RMM_UNK``,Unknown/Generic error,-1
23769447290SJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,The value of an address used as argument was invalid,-2
23869447290SJavier Almansa Sobrino   ``E_RMM_BAD_PAS``,Incorrect PAS,-3
23969447290SJavier Almansa Sobrino   ``E_RMM_NOMEM``,Not enough memory to perform an operation,-4
24069447290SJavier Almansa Sobrino   ``E_RMM_INVAL``,The value of an argument was invalid,-5
24142cf6026SJuan Pablo Conde   ``E_RMM_AGAIN``,The resource is busy. Try again.,-6
24269447290SJavier Almansa Sobrino
24369447290SJavier Almansa SobrinoIf multiple failure conditions are detected in an RMM to EL3 command, then EL3
24469447290SJavier Almansa Sobrinois allowed to return an error code corresponding to any of the failure
24569447290SJavier Almansa Sobrinoconditions.
24669447290SJavier Almansa Sobrino
24769447290SJavier Almansa SobrinoRMM-EL3 runtime services
24869447290SJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~~~~~~
24969447290SJavier Almansa Sobrino
25069447290SJavier Almansa SobrinoThe following table summarizes the RMM runtime services that need to be
25169447290SJavier Almansa Sobrinoimplemented by EL3 Firmware.
25269447290SJavier Almansa Sobrino
25369447290SJavier Almansa Sobrino.. csv-table::
25469447290SJavier Almansa Sobrino   :header: "FID", "Command"
25569447290SJavier Almansa Sobrino   :widths: 2 5
25669447290SJavier Almansa Sobrino
257e50fedbcSJavier Almansa Sobrino   0xC400018F,``RMM_RMI_REQ_COMPLETE``
258e50fedbcSJavier Almansa Sobrino   0xC40001B0,``RMM_GTSI_DELEGATE``
259e50fedbcSJavier Almansa Sobrino   0xC40001B1,``RMM_GTSI_UNDELEGATE``
26069447290SJavier Almansa Sobrino   0xC40001B2,``RMM_ATTEST_GET_REALM_KEY``
26169447290SJavier Almansa Sobrino   0xC40001B3,``RMM_ATTEST_GET_PLAT_TOKEN``
262b226357bSRaghu Krishnamurthy   0xC40001B4,``RMM_EL3_FEATURES``
263b226357bSRaghu Krishnamurthy   0xC40001B5,``RMM_EL3_TOKEN_SIGN``
26469447290SJavier Almansa Sobrino
265e50fedbcSJavier Almansa SobrinoRMM_RMI_REQ_COMPLETE command
266e50fedbcSJavier Almansa Sobrino============================
267e50fedbcSJavier Almansa Sobrino
268e50fedbcSJavier Almansa SobrinoNotifies the completion of an RMI call to the Non-Secure world.
269e50fedbcSJavier Almansa Sobrino
270e50fedbcSJavier Almansa SobrinoThis call is the only function currently in RMM-EL3 runtime interface which
271e50fedbcSJavier Almansa Sobrinoresults in a world switch to NS. This call is the reply to the original RMI
272e50fedbcSJavier Almansa Sobrinocall and it is forwarded by EL3 to the NS world.
273e50fedbcSJavier Almansa Sobrino
274e50fedbcSJavier Almansa SobrinoFID
275e50fedbcSJavier Almansa Sobrino---
276e50fedbcSJavier Almansa Sobrino
277e50fedbcSJavier Almansa Sobrino``0xC400018F``
278e50fedbcSJavier Almansa Sobrino
279e50fedbcSJavier Almansa SobrinoInput values
280e50fedbcSJavier Almansa Sobrino------------
281e50fedbcSJavier Almansa Sobrino
282e50fedbcSJavier Almansa Sobrino.. csv-table::
283e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
284e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 1 5
285e50fedbcSJavier Almansa Sobrino
286e50fedbcSJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
287e50fedbcSJavier 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
288e50fedbcSJavier Almansa Sobrino
289e50fedbcSJavier Almansa SobrinoOutput values
290e50fedbcSJavier Almansa Sobrino-------------
291e50fedbcSJavier Almansa Sobrino
292e50fedbcSJavier Almansa SobrinoThis call does not return.
293e50fedbcSJavier Almansa Sobrino
294e50fedbcSJavier Almansa SobrinoFailure conditions
295e50fedbcSJavier Almansa Sobrino------------------
296e50fedbcSJavier Almansa Sobrino
297e50fedbcSJavier Almansa SobrinoSince this call does not return to RMM, there is no failure condition which
298e50fedbcSJavier Almansa Sobrinocan be notified back to RMM.
299e50fedbcSJavier Almansa Sobrino
300e50fedbcSJavier Almansa SobrinoRMM_GTSI_DELEGATE command
301e50fedbcSJavier Almansa Sobrino=========================
302e50fedbcSJavier Almansa Sobrino
303e50fedbcSJavier Almansa SobrinoDelegate a memory granule by changing its PAS from Non-Secure to Realm.
304e50fedbcSJavier Almansa Sobrino
305e50fedbcSJavier Almansa SobrinoFID
306e50fedbcSJavier Almansa Sobrino---
307e50fedbcSJavier Almansa Sobrino
308e50fedbcSJavier Almansa Sobrino``0xC40001B0``
309e50fedbcSJavier Almansa Sobrino
310e50fedbcSJavier Almansa SobrinoInput values
311e50fedbcSJavier Almansa Sobrino------------
312e50fedbcSJavier Almansa Sobrino
313e50fedbcSJavier Almansa Sobrino.. csv-table::
314e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
315e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 1 5
316e50fedbcSJavier Almansa Sobrino
317e50fedbcSJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
318e50fedbcSJavier Almansa Sobrino   base_pa,x1,[63:0],Address,PA of the start of the granule to be delegated
319e50fedbcSJavier Almansa Sobrino
320e50fedbcSJavier Almansa SobrinoOutput values
321e50fedbcSJavier Almansa Sobrino-------------
322e50fedbcSJavier Almansa Sobrino
323e50fedbcSJavier Almansa Sobrino.. csv-table::
324e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
325e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 2 4
326e50fedbcSJavier Almansa Sobrino
327e50fedbcSJavier Almansa Sobrino   Result,x0,[63:0],Error Code,Command return status
328e50fedbcSJavier Almansa Sobrino
329e50fedbcSJavier Almansa SobrinoFailure conditions
330e50fedbcSJavier Almansa Sobrino------------------
331e50fedbcSJavier Almansa Sobrino
332e50fedbcSJavier Almansa SobrinoThe table below shows all the possible error codes returned in ``Result`` upon
333e50fedbcSJavier Almansa Sobrinoa failure. The errors are ordered by condition check.
334e50fedbcSJavier Almansa Sobrino
335e50fedbcSJavier Almansa Sobrino.. csv-table::
336e50fedbcSJavier Almansa Sobrino   :header: "ID", "Condition"
337e50fedbcSJavier Almansa Sobrino   :widths: 1 5
338e50fedbcSJavier Almansa Sobrino
339e50fedbcSJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,``PA`` does not correspond to a valid granule address
340e50fedbcSJavier Almansa Sobrino   ``E_RMM_BAD_PAS``,The granule pointed by ``PA`` does not belong to Non-Secure PAS
341e50fedbcSJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected
342e50fedbcSJavier Almansa Sobrino
343e50fedbcSJavier Almansa SobrinoRMM_GTSI_UNDELEGATE command
344e50fedbcSJavier Almansa Sobrino===========================
345e50fedbcSJavier Almansa Sobrino
346e50fedbcSJavier Almansa SobrinoUndelegate a memory granule by changing its PAS from Realm to Non-Secure.
347e50fedbcSJavier Almansa Sobrino
348e50fedbcSJavier Almansa SobrinoFID
349e50fedbcSJavier Almansa Sobrino---
350e50fedbcSJavier Almansa Sobrino
351e50fedbcSJavier Almansa Sobrino``0xC40001B1``
352e50fedbcSJavier Almansa Sobrino
353e50fedbcSJavier Almansa SobrinoInput values
354e50fedbcSJavier Almansa Sobrino------------
355e50fedbcSJavier Almansa Sobrino
356e50fedbcSJavier Almansa Sobrino.. csv-table::
357e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
358e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 1 5
359e50fedbcSJavier Almansa Sobrino
360e50fedbcSJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
361e50fedbcSJavier Almansa Sobrino   base_pa,x1,[63:0],Address,PA of the start of the granule to be undelegated
362e50fedbcSJavier Almansa Sobrino
363e50fedbcSJavier Almansa SobrinoOutput values
364e50fedbcSJavier Almansa Sobrino-------------
365e50fedbcSJavier Almansa Sobrino
366e50fedbcSJavier Almansa Sobrino.. csv-table::
367e50fedbcSJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
368e50fedbcSJavier Almansa Sobrino   :widths: 1 1 1 2 4
369e50fedbcSJavier Almansa Sobrino
370e50fedbcSJavier Almansa Sobrino   Result,x0,[63:0],Error Code,Command return status
371e50fedbcSJavier Almansa Sobrino
372e50fedbcSJavier Almansa SobrinoFailure conditions
373e50fedbcSJavier Almansa Sobrino------------------
374e50fedbcSJavier Almansa Sobrino
375e50fedbcSJavier Almansa SobrinoThe table below shows all the possible error codes returned in ``Result`` upon
376e50fedbcSJavier Almansa Sobrinoa failure. The errors are ordered by condition check.
377e50fedbcSJavier Almansa Sobrino
378e50fedbcSJavier Almansa Sobrino.. csv-table::
379e50fedbcSJavier Almansa Sobrino   :header: "ID", "Condition"
380e50fedbcSJavier Almansa Sobrino   :widths: 1 5
381e50fedbcSJavier Almansa Sobrino
382e50fedbcSJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,``PA`` does not correspond to a valid granule address
383e50fedbcSJavier Almansa Sobrino   ``E_RMM_BAD_PAS``,The granule pointed by ``PA`` does not belong to Realm PAS
384e50fedbcSJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected
385e50fedbcSJavier Almansa Sobrino
38669447290SJavier Almansa SobrinoRMM_ATTEST_GET_REALM_KEY command
38769447290SJavier Almansa Sobrino================================
38869447290SJavier Almansa Sobrino
38969447290SJavier Almansa SobrinoRetrieve the Realm Attestation Token Signing key from EL3.
39069447290SJavier Almansa Sobrino
39169447290SJavier Almansa SobrinoFID
39269447290SJavier Almansa Sobrino---
39369447290SJavier Almansa Sobrino
39469447290SJavier Almansa Sobrino``0xC40001B2``
39569447290SJavier Almansa Sobrino
39669447290SJavier Almansa SobrinoInput values
39769447290SJavier Almansa Sobrino------------
39869447290SJavier Almansa Sobrino
39969447290SJavier Almansa Sobrino.. csv-table::
40069447290SJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
40169447290SJavier Almansa Sobrino   :widths: 1 1 1 1 5
40269447290SJavier Almansa Sobrino
40369447290SJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
40469447290SJavier 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
40569447290SJavier 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
40669447290SJavier 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`
40769447290SJavier Almansa Sobrino
40869447290SJavier Almansa SobrinoOutput values
40969447290SJavier Almansa Sobrino-------------
41069447290SJavier Almansa Sobrino
41169447290SJavier Almansa Sobrino.. csv-table::
41269447290SJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
41369447290SJavier Almansa Sobrino   :widths: 1 1 1 1 5
41469447290SJavier Almansa Sobrino
41569447290SJavier Almansa Sobrino   Result,x0,[63:0],Error Code,Command return status
41669447290SJavier Almansa Sobrino   keySize,x1,[63:0],Size,Size of the Realm Attestation Key
41769447290SJavier Almansa Sobrino
41869447290SJavier Almansa SobrinoFailure conditions
41969447290SJavier Almansa Sobrino------------------
42069447290SJavier Almansa Sobrino
42169447290SJavier Almansa SobrinoThe table below shows all the possible error codes returned in ``Result`` upon
42269447290SJavier Almansa Sobrinoa failure. The errors are ordered by condition check.
42369447290SJavier Almansa Sobrino
42469447290SJavier Almansa Sobrino.. csv-table::
42569447290SJavier Almansa Sobrino   :header: "ID", "Condition"
42669447290SJavier Almansa Sobrino   :widths: 1 5
42769447290SJavier Almansa Sobrino
42869447290SJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,``PA`` is outside the shared buffer
42969447290SJavier Almansa Sobrino   ``E_RMM_INVAL``,``PA + BSize`` is outside the shared buffer
43069447290SJavier Almansa Sobrino   ``E_RMM_INVAL``,``Curve`` is not one of the listed in :ref:`ecc_curves`
43169447290SJavier Almansa Sobrino   ``E_RMM_UNK``,An unknown error occurred whilst processing the command
43269447290SJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected
43369447290SJavier Almansa Sobrino
43469447290SJavier Almansa Sobrino.. _ecc_curves:
43569447290SJavier Almansa Sobrino
43669447290SJavier Almansa SobrinoSupported ECC Curves
43769447290SJavier Almansa Sobrino--------------------
43869447290SJavier Almansa Sobrino
43969447290SJavier Almansa Sobrino.. csv-table::
44069447290SJavier Almansa Sobrino   :header: "ID", "Curve"
44169447290SJavier Almansa Sobrino   :widths: 1 5
44269447290SJavier Almansa Sobrino
44369447290SJavier Almansa Sobrino   0,ECC SECP384R1
44469447290SJavier Almansa Sobrino
44569447290SJavier Almansa SobrinoRMM_ATTEST_GET_PLAT_TOKEN command
44669447290SJavier Almansa Sobrino=================================
44769447290SJavier Almansa Sobrino
44842cf6026SJuan Pablo CondeRetrieve the Platform Token from EL3. If the entire token does not fit in the
44942cf6026SJuan Pablo Condebuffer, EL3 returns a hunk of the token (via ``tokenHunkSize`` parameter) and
45042cf6026SJuan Pablo Condeindicates the remaining bytes that are pending retrieval (via ``remainingSize``
45142cf6026SJuan Pablo Condeparameter). The challenge object for the platform token must be populated in
45242cf6026SJuan Pablo Condethe buffer for the first call of this command and the size of the object is
45342cf6026SJuan Pablo Condeindicated by ``c_size`` parameter. Subsequent calls to retrieve remaining hunks of
45442cf6026SJuan Pablo Condethe token must be made with ``c_size`` as 0.
45542cf6026SJuan Pablo Conde
45642cf6026SJuan Pablo CondeIf ``c_size`` is not 0, this command could cause regeneration of platform token
45742cf6026SJuan Pablo Condeand will return token hunk corresponding to beginning of the token.
45842cf6026SJuan Pablo Conde
45942cf6026SJuan Pablo CondeIt is valid for the calls of this command to return ``E_RMM_AGAIN`` error,
46042cf6026SJuan Pablo Condewhich is an indication to the caller to retry this command again. Depending on the
46142cf6026SJuan Pablo Condeplatform, this mechanism can be used to implement queuing to HES, if HES is
46242cf6026SJuan Pablo Condeinvolved in platform token generation.
46369447290SJavier Almansa Sobrino
46469447290SJavier Almansa SobrinoFID
46569447290SJavier Almansa Sobrino---
46669447290SJavier Almansa Sobrino
46769447290SJavier Almansa Sobrino``0xC40001B3``
46869447290SJavier Almansa Sobrino
46969447290SJavier Almansa SobrinoInput values
47069447290SJavier Almansa Sobrino------------
47169447290SJavier Almansa Sobrino
47269447290SJavier Almansa Sobrino.. csv-table::
47369447290SJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
47469447290SJavier Almansa Sobrino   :widths: 1 1 1 1 5
47569447290SJavier Almansa Sobrino
47669447290SJavier Almansa Sobrino   fid,x0,[63:0],UInt64,Command FID
47742cf6026SJuan 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."
47869447290SJavier 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
47942cf6026SJuan 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."
48069447290SJavier Almansa Sobrino
48169447290SJavier Almansa SobrinoOutput values
48269447290SJavier Almansa Sobrino-------------
48369447290SJavier Almansa Sobrino
48469447290SJavier Almansa Sobrino.. csv-table::
48569447290SJavier Almansa Sobrino   :header: "Name", "Register", "Field", "Type", "Description"
48669447290SJavier Almansa Sobrino   :widths: 1 1 1 1 5
48769447290SJavier Almansa Sobrino
48869447290SJavier Almansa Sobrino   Result,x0,[63:0],Error Code,Command return status
48942cf6026SJuan Pablo Conde   tokenHunkSize,x1,[63:0],Size,Size of the platform token hunk retrieved
49042cf6026SJuan Pablo Conde   remainingSize,x2,[63:0],Size,Remaining bytes of the token that are pending retrieval
49169447290SJavier Almansa Sobrino
49269447290SJavier Almansa SobrinoFailure conditions
49369447290SJavier Almansa Sobrino------------------
49469447290SJavier Almansa Sobrino
49569447290SJavier Almansa SobrinoThe table below shows all the possible error codes returned in ``Result`` upon
49669447290SJavier Almansa Sobrinoa failure. The errors are ordered by condition check.
49769447290SJavier Almansa Sobrino
49869447290SJavier Almansa Sobrino.. csv-table::
49969447290SJavier Almansa Sobrino   :header: "ID", "Condition"
50069447290SJavier Almansa Sobrino   :widths: 1 5
50169447290SJavier Almansa Sobrino
50242cf6026SJuan Pablo Conde   ``E_RMM_AGAIN``,Resource for Platform token retrieval is busy. Try again.
50369447290SJavier Almansa Sobrino   ``E_RMM_BAD_ADDR``,``PA`` is outside the shared buffer
50469447290SJavier Almansa Sobrino   ``E_RMM_INVAL``,``PA + BSize`` is outside the shared buffer
50542cf6026SJuan Pablo Conde   ``E_RMM_INVAL``,``CSize`` does not represent the size of a supported SHA algorithm for the first call to this command
50642cf6026SJuan Pablo Conde   ``E_RMM_INVAL``,``CSize`` is not 0 for subsequent calls to retrieve remaining hunks of the token
50769447290SJavier Almansa Sobrino   ``E_RMM_UNK``,An unknown error occurred whilst processing the command
50869447290SJavier Almansa Sobrino   ``E_RMM_OK``,No errors detected
50969447290SJavier Almansa Sobrino
510b226357bSRaghu KrishnamurthyRMM_EL3_FEATURES command
511b226357bSRaghu Krishnamurthy========================
512b226357bSRaghu Krishnamurthy
513b226357bSRaghu KrishnamurthyThis command provides a mechanism to discover features and ABIs supported by the
514b226357bSRaghu KrishnamurthyRMM-EL3 interface, for a given version. This command is helpful when there are
515b226357bSRaghu Krishnamurthyplatform specific optional RMM-EL3 interfaces and features exposed by vendor
516b226357bSRaghu Krishnamurthyspecific EL3 firmware, and a generic RMM that can modify its behavior based on
517b226357bSRaghu Krishnamurthydiscovery of EL3 features.
518b226357bSRaghu Krishnamurthy
519b226357bSRaghu KrishnamurthyThe features can be discovered by specifying the feature register index that
520b226357bSRaghu Krishnamurthyhas fields defined to indicate presence or absence of features and other
521b226357bSRaghu Krishnamurthyrelevant information. The feature register index is specified in the
522b226357bSRaghu Krishnamurthy``feat_reg_idx`` parameter. Each feature register is a 64 bit register.
523b226357bSRaghu Krishnamurthy
524b226357bSRaghu KrishnamurthyThis command is available from v0.4 of the RMM-EL3 interface.
525b226357bSRaghu Krishnamurthy
526b226357bSRaghu KrishnamurthyThe following is the register definition for feature register index 0 for
527b226357bSRaghu Krishnamurthyv0.4 of the interface:
528b226357bSRaghu Krishnamurthy
529b226357bSRaghu KrishnamurthyRMM-EL3 Feature Resister 0
530b226357bSRaghu Krishnamurthy--------------------------
531b226357bSRaghu Krishnamurthy
532b226357bSRaghu Krishnamurthy.. code-block:: none
533b226357bSRaghu Krishnamurthy
534b226357bSRaghu Krishnamurthy    63      32      31      16       15      8       7       1       0
535b226357bSRaghu Krishnamurthy    +-------+-------+-------+-------+-------+-------+-------+-------+
536b226357bSRaghu Krishnamurthy    |       |       |       |       |       |       |       |       |
537b226357bSRaghu Krishnamurthy    |       |       |       |       |       |       |       |       |
538b226357bSRaghu Krishnamurthy    +-------+-------+-------+-------+-------+-------+-------+-------+
539b226357bSRaghu Krishnamurthy                                                             ^
540b226357bSRaghu Krishnamurthy                                                             |
541b226357bSRaghu Krishnamurthy                                                 RMMD_EL3_TOKEN_SIGN
542b226357bSRaghu Krishnamurthy
543b226357bSRaghu Krishnamurthy**Bit Fields:**
544b226357bSRaghu Krishnamurthy
545b226357bSRaghu Krishnamurthy- **Bit 0**: `RMMD_EL3_TOKEN_SIGN`
546b226357bSRaghu Krishnamurthy    - When set to 1, the `RMMD_EL3_TOKEN_SIGN` feature is enabled.
547b226357bSRaghu Krishnamurthy    - When cleared (0), the feature is disabled.
548b226357bSRaghu Krishnamurthy- **Bits [1:63]**: Reserved (must be zero)
549b226357bSRaghu Krishnamurthy
550b226357bSRaghu KrishnamurthyFID
551b226357bSRaghu Krishnamurthy---
552b226357bSRaghu Krishnamurthy
553b226357bSRaghu Krishnamurthy``0xC40001B4``
554b226357bSRaghu Krishnamurthy
555b226357bSRaghu Krishnamurthy
556b226357bSRaghu KrishnamurthyInput values
557b226357bSRaghu Krishnamurthy------------
558b226357bSRaghu Krishnamurthy
559b226357bSRaghu Krishnamurthy.. csv-table:: Input values for RMM_EL3_FEATURES
560b226357bSRaghu Krishnamurthy   :header: "Name", "Register", "Field", "Type", "Description"
561b226357bSRaghu Krishnamurthy   :widths: 1 1 1 1 5
562b226357bSRaghu Krishnamurthy
563b226357bSRaghu Krishnamurthy   fid,x0,[63:0],UInt64,Command FID
564b226357bSRaghu Krishnamurthy   feat_reg_idx,x1,[63:0],UInt64, "Feature register index. For v0.4, a value of 0 is the only
565b226357bSRaghu Krishnamurthy   acceptable value"
566b226357bSRaghu Krishnamurthy
567b226357bSRaghu Krishnamurthy
568b226357bSRaghu KrishnamurthyOutput values
569b226357bSRaghu Krishnamurthy-------------
570b226357bSRaghu Krishnamurthy
571b226357bSRaghu Krishnamurthy.. csv-table:: Output values for RMM_EL3_FEATURES
572b226357bSRaghu Krishnamurthy   :header: "Name", "Register", "Field", "Type", "Description"
573b226357bSRaghu Krishnamurthy   :widths: 1 1 1 1 5
574b226357bSRaghu Krishnamurthy
575b226357bSRaghu Krishnamurthy   Result,x0,[63:0],Error Code,Command return status
576b226357bSRaghu Krishnamurthy   feat_reg,x1,[63:0],Value,Value of the register as defined above
577b226357bSRaghu Krishnamurthy
578b226357bSRaghu KrishnamurthyFailure conditions
579b226357bSRaghu Krishnamurthy------------------
580b226357bSRaghu Krishnamurthy
581b226357bSRaghu KrishnamurthyThe table below shows all the possible error codes returned in ``Result`` upon
582b226357bSRaghu Krishnamurthya failure. The errors are ordered by condition check.
583b226357bSRaghu Krishnamurthy
584b226357bSRaghu Krishnamurthy.. csv-table:: Failure conditions for RMM_EL3_FEATURES
585b226357bSRaghu Krishnamurthy   :header: "ID", "Condition"
586b226357bSRaghu Krishnamurthy   :widths: 1 5
587b226357bSRaghu Krishnamurthy
588b226357bSRaghu Krishnamurthy   ``E_RMM_INVAL``,``feat_reg_idx`` is out of valid range
589b226357bSRaghu Krishnamurthy   ``E_RMM_UNK``,"if the SMC is not present, if interface version is <0.4"
590b226357bSRaghu Krishnamurthy   ``E_RMM_OK``,No errors detected
591b226357bSRaghu Krishnamurthy
592b226357bSRaghu KrishnamurthyRMM_EL3_TOKEN_SIGN command
593b226357bSRaghu Krishnamurthy==========================
594b226357bSRaghu Krishnamurthy
595b226357bSRaghu KrishnamurthyThis command is an optional command that can be discovered using the RMM_EL3_FEATURES command.
596b226357bSRaghu KrishnamurthyThis command is used to send requests related to realm attestation token signing requests to EL3.
597b226357bSRaghu KrishnamurthyThe command supports 3 opcodes:
598b226357bSRaghu Krishnamurthy
599b226357bSRaghu Krishnamurthy   - RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP
600b226357bSRaghu Krishnamurthy   - RMM_EL3_TOKEN_SIGN_PULL_RESP_OP
601b226357bSRaghu Krishnamurthy   - RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP
602b226357bSRaghu Krishnamurthy
603b226357bSRaghu KrishnamurthyThe above opcodes can be used to send realm attestation token signing requests to EL3 and get their
604b226357bSRaghu Krishnamurthyresponse, so that the realm attestation token can be constructed.
605b226357bSRaghu Krishnamurthy
606b226357bSRaghu KrishnamurthyThis command is useful when the RMM may not have access to the private portion of the realm
607b226357bSRaghu Krishnamurthyattestation key and needs signing services from EL3 or CCA HES, or other platform specific
608b226357bSRaghu Krishnamurthymechanisms to perform signing.
609b226357bSRaghu Krishnamurthy
610b226357bSRaghu KrishnamurthyThe RMM-EL3 interface for this command is modeled as two separate queues, one for signing requests
611b226357bSRaghu Krishnamurthyand one for retrieving the signed responses. It is possible that the queue in EL3 is full or EL3 is busy and
612b226357bSRaghu Krishnamurthyunable to service the RMM requests, in which case the RMM is expected to retry the push operation
613b226357bSRaghu Krishnamurthyfor requests and pop operation for responses.
614b226357bSRaghu Krishnamurthy
615b226357bSRaghu KrishnamurthyFID
616b226357bSRaghu Krishnamurthy---
617b226357bSRaghu Krishnamurthy
618b226357bSRaghu Krishnamurthy``0xC40001B5``
619b226357bSRaghu Krishnamurthy
620b226357bSRaghu KrishnamurthyInput values
621b226357bSRaghu Krishnamurthy------------
622b226357bSRaghu Krishnamurthy
623b226357bSRaghu Krishnamurthy.. csv-table:: Input values for RMM_EL3_TOKEN_SIGN
624b226357bSRaghu Krishnamurthy   :header: "Name", "Register", "Field", "Type", "Description"
625b226357bSRaghu Krishnamurthy   :widths: 1 1 1 1 5
626b226357bSRaghu Krishnamurthy
627b226357bSRaghu Krishnamurthy   fid,x0,[63:0],UInt64,Command FID
628b226357bSRaghu Krishnamurthy   opcode,x1,[63:0],UInt64,"
629b226357bSRaghu Krishnamurthy   Opcode that is one of:
630b226357bSRaghu Krishnamurthy
631b226357bSRaghu Krishnamurthy    - RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP: 0x1 -
632b226357bSRaghu Krishnamurthy      Opcode to push a token signing request to EL3 using struct el3_token_sign_request as described above
633b226357bSRaghu Krishnamurthy    - RMM_EL3_TOKEN_SIGN_PULL_RESP_OP: 0x2 -
634b226357bSRaghu Krishnamurthy      Opcode to pull a token signing response from EL3 using struct el3_token_sign_response as described above
635b226357bSRaghu Krishnamurthy    - RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP: 0x3 -
636b226357bSRaghu Krishnamurthy      Opcode to get the realm attestation public key
637b226357bSRaghu Krishnamurthy
638b226357bSRaghu Krishnamurthy   "
639b226357bSRaghu 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"
640b226357bSRaghu 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
641b226357bSRaghu 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
642b226357bSRaghu Krishnamurthy
643b226357bSRaghu KrishnamurthyOutput values
644b226357bSRaghu Krishnamurthy-------------
645b226357bSRaghu Krishnamurthy
646b226357bSRaghu Krishnamurthy.. csv-table:: Output values for RMM_EL3_TOKEN_SIGN
647b226357bSRaghu Krishnamurthy   :header: "Name", "Register", "Field", "Type", "Description"
648b226357bSRaghu Krishnamurthy   :widths: 1 1 1 1 5
649b226357bSRaghu Krishnamurthy
650b226357bSRaghu Krishnamurthy   Result,x0,[63:0],Error Code,Command return status. Valid for all opcodes listed in input values
651b226357bSRaghu Krishnamurthy   retval1,x1,[63:0],Value, "If opcode is RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP, then returns length of
652b226357bSRaghu Krishnamurthy   public key returned. Otherwise, reserved"
653b226357bSRaghu Krishnamurthy
654b226357bSRaghu Krishnamurthy
655b226357bSRaghu KrishnamurthyFailure conditions
656b226357bSRaghu Krishnamurthy------------------
657b226357bSRaghu Krishnamurthy
658b226357bSRaghu KrishnamurthyThe table below shows all the possible error codes returned in ``Result`` upon
659b226357bSRaghu Krishnamurthya failure. The errors are ordered by condition check.
660b226357bSRaghu Krishnamurthy
661b226357bSRaghu Krishnamurthy.. csv-table:: Failure conditions for RMM_EL3_TOKEN_SIGN
662b226357bSRaghu Krishnamurthy   :header: "ID", "Condition"
663b226357bSRaghu Krishnamurthy   :widths: 1 5
664b226357bSRaghu Krishnamurthy
665b226357bSRaghu Krishnamurthy   ``E_RMM_INVAL``,"if opcode is invalid or buffer address and length passed to the EL3 are not in valid range
666b226357bSRaghu Krishnamurthy   corresponding to the RMM-EL3 shared buffer, or if the curve used for opcode
667b226357bSRaghu Krishnamurthy   RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP is not the ECC P384 curve"
668b226357bSRaghu Krishnamurthy   ``E_RMM_UNK``,"if the SMC is not present, if interface version is <0.4"
669b226357bSRaghu Krishnamurthy   ``E_RMM_AGAIN``,"For opcode RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP, if the request is not queued since
670b226357bSRaghu Krishnamurthy   the EL3 queue is full, or if the response is not ready yet, for other opcodes"
671b226357bSRaghu Krishnamurthy   ``E_RMM_OK``,No errors detected
672b226357bSRaghu Krishnamurthy
673b226357bSRaghu Krishnamurthy
674f801fdc2STushar KhandelwalRMM_MECID_KEY_UPDATE command
675f801fdc2STushar Khandelwal============================
676f801fdc2STushar Khandelwal
677f801fdc2STushar KhandelwalThis command updates the tweak for the encryption key/programs a new encryption key
678f801fdc2STushar Khandelwalassociated with a given MECID. After the execution of this command, all memory
679f801fdc2STushar Khandelwalaccesses associated with the MECID are encrypted/decrypted using the new key.
680f801fdc2STushar KhandelwalThis command is available from v0.5 of the RMM-EL3 interface.
681f801fdc2STushar Khandelwal
682f801fdc2STushar KhandelwalFID
683f801fdc2STushar Khandelwal---
684f801fdc2STushar Khandelwal
685f801fdc2STushar Khandelwal``0xC40001B6``
686f801fdc2STushar Khandelwal
687f801fdc2STushar KhandelwalInput values
688f801fdc2STushar Khandelwal------------
689f801fdc2STushar Khandelwal
690f801fdc2STushar Khandelwal.. csv-table:: Input values for RMM_MECID_KEY_UPDATE
691f801fdc2STushar Khandelwal   :header: "Name", "Register", "Field", "Type", "Description"
692f801fdc2STushar Khandelwal   :widths: 1 1 1 1 5
693f801fdc2STushar Khandelwal
694f801fdc2STushar Khandelwal   fid,x0,[63:0],UInt64,Command FID
695f801fdc2STushar Khandelwal   mecid,x1,[15:0],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."
696f801fdc2STushar Khandelwal
697f801fdc2STushar KhandelwalOutput values
698f801fdc2STushar Khandelwal-------------
699f801fdc2STushar Khandelwal
700f801fdc2STushar Khandelwal.. csv-table:: Output values for RMM_MECID_KEY_UPDATE
701f801fdc2STushar Khandelwal   :header: "Name", "Register", "Field", "Type", "Description"
702f801fdc2STushar Khandelwal   :widths: 1 1 1 1 5
703f801fdc2STushar Khandelwal
704f801fdc2STushar Khandelwal   Result,x0,[63:0],Error Code,Command return status. Valid for all opcodes listed in input values
705f801fdc2STushar Khandelwal
706f801fdc2STushar Khandelwal
707f801fdc2STushar KhandelwalFailure conditions
708f801fdc2STushar Khandelwal------------------
709f801fdc2STushar Khandelwal
710f801fdc2STushar KhandelwalThe table below shows all the possible error codes returned in ``Result`` upon
711f801fdc2STushar Khandelwala failure. The errors are ordered by condition check.
712f801fdc2STushar Khandelwal
713f801fdc2STushar Khandelwal.. csv-table:: Failure conditions for RMM_MECID_KEY_UPDATE
714f801fdc2STushar Khandelwal   :header: "ID", "Condition"
715f801fdc2STushar Khandelwal   :widths: 1 5
716f801fdc2STushar Khandelwal
717f801fdc2STushar Khandelwal   ``E_RMM_INVAL``,"if mecid is invalid (larger than 65,535 or than the maximum MECID width, determined by MECIDR_EL2.MECIDWidthm1)"
718f801fdc2STushar Khandelwal   ``E_RMM_UNK``,"An unknown error occurred whilst processing the command or the SMC is not present if interface version is <0.5"
719f801fdc2STushar Khandelwal   ``E_RMM_OK``,No errors detected
720f801fdc2STushar Khandelwal
721f801fdc2STushar Khandelwal
722*0616bf03SSona MathewRMM_IDE_KEY_PROG command
723*0616bf03SSona Mathew=========================
724*0616bf03SSona Mathew
725*0616bf03SSona MathewSet the key/IV info at Root port for an IDE stream as part of Device Assignment flow. This
726*0616bf03SSona Mathewcommand is available from v0.6 of the RMM-EL3 interface.
727*0616bf03SSona Mathew
728*0616bf03SSona MathewPlease refer to `IDE-KM RFC <https://github.com/TF-RMM/tf-rmm/wiki/RFC:-EL3-RMM-IDE-KM-Interface>`_
729*0616bf03SSona Mathewfor description of the IDE setup sequence and how this will be invoked by RMM.
730*0616bf03SSona Mathew
731*0616bf03SSona MathewThe key is 256 bits and IV is 96 bits. The caller needs
732*0616bf03SSona Mathewto call this SMC to program this key to the Rx, Tx ports and for each sub-stream
733*0616bf03SSona Mathewcorresponding to a single keyset.
734*0616bf03SSona Mathew
735*0616bf03SSona MathewFID
736*0616bf03SSona Mathew---
737*0616bf03SSona Mathew
738*0616bf03SSona Mathew``0xC40001B7``
739*0616bf03SSona Mathew
740*0616bf03SSona MathewInput values
741*0616bf03SSona Mathew------------
742*0616bf03SSona Mathew
743*0616bf03SSona Mathew.. csv-table:: Input values for RMM_IDE_KEY_PROG
744*0616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
745*0616bf03SSona Mathew   :widths: 1 1 1 1 5
746*0616bf03SSona Mathew
747*0616bf03SSona Mathew   fid,x0,[63:0],UInt64,Command FID
748*0616bf03SSona Mathew   ecam_address,x1,[63:0],UInt64,Used to identify the root complex(RC)
749*0616bf03SSona Mathew   rp_id,x2,[63:0],UInt64,Used to identify the root port within the root complex(RC)
750*0616bf03SSona Mathew   Keyset[12]:Dir[11]:Substream[10:8]:StreamID[7:0],x3,[63:0],UInt64,IDE selective stream informationKey set: can be 0 or 1unused bits MBZ.
751*0616bf03SSona Mathew   KeqQW0,x4,[63:0],UInt64,Quad word of key [63:0]
752*0616bf03SSona Mathew   KeqQW1,x5,[63:0],UInt64,Quad word of key [127:64]
753*0616bf03SSona Mathew   KeqQW2,x6,[63:0],UInt64,Quad word of key [191:128]
754*0616bf03SSona Mathew   KeqQW3,x7,[63:0],UInt64,Quad word of key [255:192]
755*0616bf03SSona Mathew   IFVQW0,x8,[63:0],UInt64,Quad word of IV [63:0]
756*0616bf03SSona Mathew   IFVQW1,x9,[63:0],UInt64,Quad word of IV [95:64]
757*0616bf03SSona Mathew   request_id,x10,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
758*0616bf03SSona Mathew   cookie,x11,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
759*0616bf03SSona Mathew
760*0616bf03SSona Mathew
761*0616bf03SSona MathewOutput values
762*0616bf03SSona Mathew-------------
763*0616bf03SSona Mathew
764*0616bf03SSona Mathew.. csv-table:: Output values for RMM_IDE_KEY_PROG
765*0616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
766*0616bf03SSona Mathew   :widths: 1 1 1 2 4
767*0616bf03SSona Mathew
768*0616bf03SSona Mathew   Result,x0,[63:0],Error Code,Command return status
769*0616bf03SSona Mathew
770*0616bf03SSona MathewFailure conditions
771*0616bf03SSona Mathew------------------
772*0616bf03SSona Mathew
773*0616bf03SSona MathewThe table below shows all the possible error codes returned in ``Result`` upon
774*0616bf03SSona Mathewa failure. The errors are ordered by condition check.
775*0616bf03SSona Mathew
776*0616bf03SSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KEY_PROG
777*0616bf03SSona Mathew   :header: "ID", "Condition"
778*0616bf03SSona Mathew   :widths: 1 5
779*0616bf03SSona Mathew
780*0616bf03SSona Mathew   ``E_RMM_OK``,Key programming is successful.
781*0616bf03SSona Mathew   ``E_RMM_FAULT``,Key programming is not successful.
782*0616bf03SSona Mathew   ``E_RMM_INVAL``,Key programming arguments are incorrect.
783*0616bf03SSona Mathew   ``E_RMM_UNK``,Unknown error or the SMC is not present if the version is < 0.6
784*0616bf03SSona Mathew   ``E_RMM_AGAIN``,Returned only for non-blocking mode. IDE-KM interface is busy or request is full. Retry required.
785*0616bf03SSona Mathew   ``E_RMM_INPROGRESS``,Returned only for non-blocking mode. The caller must issue RMM_IDE_KM_PULL_RESPONSE SMC to pull the response.
786*0616bf03SSona Mathew
787*0616bf03SSona Mathew
788*0616bf03SSona MathewRMM_IDE_KEY_SET_GO command
789*0616bf03SSona Mathew==========================
790*0616bf03SSona Mathew
791*0616bf03SSona MathewActivate the IDE stream at Root Port once the keys have been programmed as part of
792*0616bf03SSona MathewDevice Assignment flow. This command is available from v0.6 of the RMM-EL3 interface.
793*0616bf03SSona Mathew
794*0616bf03SSona MathewPlease refer to `IDE-KM RFC <https://github.com/TF-RMM/tf-rmm/wiki/RFC:-EL3-RMM-IDE-KM-Interface>`_
795*0616bf03SSona Mathewfor description of the IDE setup sequence and info on how this will be invoked by RMM.
796*0616bf03SSona Mathew
797*0616bf03SSona MathewThe caller(RMM) needs to ensure the EL3_IDE_KEY_PROG() call had succeeded prior to this call.
798*0616bf03SSona Mathew
799*0616bf03SSona MathewFID
800*0616bf03SSona Mathew---
801*0616bf03SSona Mathew
802*0616bf03SSona Mathew``0xC40001B8``
803*0616bf03SSona Mathew
804*0616bf03SSona MathewInput values
805*0616bf03SSona Mathew------------
806*0616bf03SSona Mathew
807*0616bf03SSona Mathew.. csv-table:: Input values for RMM_IDE_KEY_SET_GO
808*0616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
809*0616bf03SSona Mathew   :widths: 1 1 1 1 5
810*0616bf03SSona Mathew
811*0616bf03SSona Mathew   fid,x0,[63:0],UInt64,Command FID
812*0616bf03SSona Mathew   ecam_address,x1,[63:0],UInt64,Used to identify the root complex(RC)
813*0616bf03SSona Mathew   rp_id,x2,[63:0],UInt64,Used to identify the root port within the root complex(RC)
814*0616bf03SSona Mathew   Keyset[12]:Dir[11]:Substream[10:8]:StreamID[7:0],x3,[63:0],UInt64,IDE selective stream information. Key set can be 0 or 1. Unused bits MBZ.
815*0616bf03SSona Mathew   request_id,x4,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
816*0616bf03SSona Mathew   cookie,x5,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
817*0616bf03SSona Mathew
818*0616bf03SSona Mathew
819*0616bf03SSona MathewOutput values
820*0616bf03SSona Mathew-------------
821*0616bf03SSona Mathew
822*0616bf03SSona Mathew.. csv-table:: Output values for RMM_IDE_KEY_SET_GO
823*0616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
824*0616bf03SSona Mathew   :widths: 1 1 1 2 4
825*0616bf03SSona Mathew
826*0616bf03SSona Mathew   Result,x0,[63:0],Error Code,Command return status
827*0616bf03SSona Mathew
828*0616bf03SSona MathewFailure conditions
829*0616bf03SSona Mathew------------------
830*0616bf03SSona Mathew
831*0616bf03SSona MathewThe table below shows all the possible error codes returned in ``Result`` upon
832*0616bf03SSona Mathewa failure. The errors are ordered by condition check.
833*0616bf03SSona Mathew
834*0616bf03SSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KEY_SET_GO
835*0616bf03SSona Mathew   :header: "ID", "Condition"
836*0616bf03SSona Mathew   :widths: 1 5
837*0616bf03SSona Mathew
838*0616bf03SSona Mathew   ``E_RMM_OK``,Key set go is successful.
839*0616bf03SSona Mathew   ``E_RMM_FAULT``,Key set go is not successful.
840*0616bf03SSona Mathew   ``E_RMM_INVAL``,incorrect arguments.
841*0616bf03SSona Mathew   ``E_RMM_UNK``,Unknown error or the SMC is not present if the version is < 0.6.
842*0616bf03SSona Mathew   ``E_RMM_AGAIN``,Returned only for non-blocking mode. IDE-KM interface is busy or request is full. Retry required.
843*0616bf03SSona Mathew   ``E_RMM_INPROGRESS``,Returned only for non-blocking mode. The caller must issue RMM_IDE_KM_PULL_RESPONSE SMC to pull the response.
844*0616bf03SSona Mathew
845*0616bf03SSona Mathew
846*0616bf03SSona MathewRMM_IDE_KEY_SET_STOP command
847*0616bf03SSona Mathew============================
848*0616bf03SSona Mathew
849*0616bf03SSona MathewDeactivate the IDE stream at Root Port as part of Device Assignment flow. This command is
850*0616bf03SSona Mathewavailable from v0.6 of the RMM-EL3 interface.
851*0616bf03SSona Mathew
852*0616bf03SSona MathewPlease refer to `IDE-KM RFC <https://github.com/TF-RMM/tf-rmm/wiki/RFC:-EL3-RMM-IDE-KM-Interface>`_
853*0616bf03SSona Mathewfor description of the IDE setup sequence and info on how this will be invoked by RMM.
854*0616bf03SSona Mathew
855*0616bf03SSona MathewThis SMC is used to tear down an IDE Stream.
856*0616bf03SSona Mathew
857*0616bf03SSona MathewFID
858*0616bf03SSona Mathew---
859*0616bf03SSona Mathew
860*0616bf03SSona Mathew``0xC40001B9``
861*0616bf03SSona Mathew
862*0616bf03SSona MathewInput values
863*0616bf03SSona Mathew------------
864*0616bf03SSona Mathew
865*0616bf03SSona Mathew.. csv-table:: Input values for RMM_IDE_KEY_SET_STOP
866*0616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
867*0616bf03SSona Mathew   :widths: 1 1 1 1 5
868*0616bf03SSona Mathew
869*0616bf03SSona Mathew   fid,x0,[63:0],UInt64,Command FID
870*0616bf03SSona Mathew   ecam_address,x1,[63:0],UInt64,Used to identify the root complex(RC)
871*0616bf03SSona Mathew   rp_id,x2,[63:0],UInt64,Used to identify the root port within the root complex(RC)
872*0616bf03SSona Mathew   Keyset[12]:Dir[11]:Substream[10:8]:StreamID[7:0],x3,[63:0],UInt64,IDE selective stream information. Key set can be 0 or 1. Unused bits MBZ.
873*0616bf03SSona Mathew   request_id,x4,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
874*0616bf03SSona Mathew   cookie,x5,[63:0],UInt64,Used only in non-blocking mode. Ignored in blocking mode.
875*0616bf03SSona Mathew
876*0616bf03SSona Mathew
877*0616bf03SSona MathewOutput values
878*0616bf03SSona Mathew-------------
879*0616bf03SSona Mathew
880*0616bf03SSona Mathew.. csv-table:: Output values for RMM_IDE_KEY_SET_STOP
881*0616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
882*0616bf03SSona Mathew   :widths: 1 1 1 2 4
883*0616bf03SSona Mathew
884*0616bf03SSona Mathew   Result,x0,[63:0],Error Code,Command return status
885*0616bf03SSona Mathew
886*0616bf03SSona MathewFailure conditions
887*0616bf03SSona Mathew------------------
888*0616bf03SSona Mathew
889*0616bf03SSona MathewThe table below shows all the possible error codes returned in ``Result`` upon
890*0616bf03SSona Mathewa failure. The errors are ordered by condition check.
891*0616bf03SSona Mathew
892*0616bf03SSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KEY_SET_STOP
893*0616bf03SSona Mathew   :header: "ID", "Condition"
894*0616bf03SSona Mathew   :widths: 1 5
895*0616bf03SSona Mathew
896*0616bf03SSona Mathew   ``E_RMM_OK``,Key set go is successful.
897*0616bf03SSona Mathew   ``E_RMM_FAULT``,Key set go is not successful.
898*0616bf03SSona Mathew   ``E_RMM_INVAL``,incorrect arguments.
899*0616bf03SSona Mathew   ``E_RMM_UNK``,Unknown error or the SMC is not present if the version is < 0.6.
900*0616bf03SSona Mathew   ``E_RMM_AGAIN``,Returned only for non-blocking mode. IDE-KM interface is busy or request is full. Retry required.
901*0616bf03SSona Mathew   ``E_RMM_INPROGRESS``,Returned only for non-blocking mode. The caller must issue RMM_IDE_KM_PULL_RESPONSE SMC to pull the response.
902*0616bf03SSona Mathew
903*0616bf03SSona Mathew
904*0616bf03SSona MathewRMM_IDE_KM_PULL_RESPONSE command
905*0616bf03SSona Mathew================================
906*0616bf03SSona Mathew
907*0616bf03SSona MathewRetrieve the response from Root Port to a previous non-blocking IDE-KM SMC request as part of
908*0616bf03SSona MathewDevice Assignment flow. This command is available from v0.6 of the RMM-EL3 interface.
909*0616bf03SSona Mathew
910*0616bf03SSona MathewPlease refer to `IDE-KM RFC <https://github.com/TF-RMM/tf-rmm/wiki/RFC:-EL3-RMM-IDE-KM-Interface>`_
911*0616bf03SSona Mathewfor description of the IDE setup sequence and info on how this will be invoked by RMM.
912*0616bf03SSona Mathew
913*0616bf03SSona MathewThe response from this call could correspond to any of the last pending requests and the
914*0616bf03SSona MathewRMM needs to identify the request and populate the response. For blocking calls, this SMC
915*0616bf03SSona Mathewalways returns E_RMM_UNK.
916*0616bf03SSona Mathew
917*0616bf03SSona MathewFID
918*0616bf03SSona Mathew---
919*0616bf03SSona Mathew
920*0616bf03SSona Mathew``0xC40001BA``
921*0616bf03SSona Mathew
922*0616bf03SSona MathewInput values
923*0616bf03SSona Mathew------------
924*0616bf03SSona Mathew
925*0616bf03SSona Mathew.. csv-table:: Input values for RMM_IDE_KM_PULL_RESPONSE
926*0616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
927*0616bf03SSona Mathew   :widths: 1 1 1 1 5
928*0616bf03SSona Mathew
929*0616bf03SSona Mathew   fid,x0,[63:0],UInt64,Command FID
930*0616bf03SSona Mathew   ecam_address,x1,[63:0],UInt64,Used to identify the root complex(RC)
931*0616bf03SSona Mathew   rp_id,x2,[63:0],UInt64,Used to identify the root port within the root complex(RC)
932*0616bf03SSona Mathew
933*0616bf03SSona Mathew
934*0616bf03SSona MathewOutput values
935*0616bf03SSona Mathew-------------
936*0616bf03SSona Mathew
937*0616bf03SSona Mathew.. csv-table:: Output values for RMM_IDE_KM_PULL_RESPONSE
938*0616bf03SSona Mathew   :header: "Name", "Register", "Field", "Type", "Description"
939*0616bf03SSona Mathew   :widths: 1 1 1 2 4
940*0616bf03SSona Mathew
941*0616bf03SSona Mathew   Result,x0,[63:0],Error Code,Command return status
942*0616bf03SSona Mathew   Result,x1,[63:0],Error Code,Retrieved response corresponding to previous IDE_KM requests.
943*0616bf03SSona Mathew   Result,x2,[63:0],value,passthrough from requested SMC
944*0616bf03SSona Mathew   Result,x3,[63:0],value,passthrough from requested SMC
945*0616bf03SSona Mathew
946*0616bf03SSona MathewFailure conditions
947*0616bf03SSona Mathew------------------
948*0616bf03SSona Mathew
949*0616bf03SSona MathewThe table below shows all the possible error codes returned in ``Result`` upon
950*0616bf03SSona Mathewa failure. The errors are ordered by condition check.
951*0616bf03SSona Mathew
952*0616bf03SSona Mathew.. csv-table:: Failure conditions for RMM_IDE_KM_PULL_RESPONSE
953*0616bf03SSona Mathew   :header: "ID", "Condition"
954*0616bf03SSona Mathew   :widths: 1 5
955*0616bf03SSona Mathew
956*0616bf03SSona Mathew   ``E_RMM_OK``,Key set go is successful.
957*0616bf03SSona Mathew   ``E_RMM_FAULT``,Key set go is not successful.
958*0616bf03SSona Mathew   ``E_RMM_INVAL``,incorrect arguments.
959*0616bf03SSona Mathew   ``E_RMM_UNK``,Unknown error or the SMC is not present if the version is < 0.6.
960*0616bf03SSona Mathew   ``E_RMM_AGAIN``,KM request is empty and no response if available.
961*0616bf03SSona Mathew
962*0616bf03SSona Mathew
96369447290SJavier Almansa SobrinoRMM-EL3 world switch register save restore convention
96469447290SJavier Almansa Sobrino_____________________________________________________
96569447290SJavier Almansa Sobrino
96669447290SJavier Almansa SobrinoAs part of NS world switch, EL3 is expected to maintain a register context
96769447290SJavier Almansa Sobrinospecific to each world and will save and restore the registers
96869447290SJavier Almansa Sobrinoappropriately. This section captures the contract between EL3 and RMM on the
96969447290SJavier Almansa Sobrinoregister set to be saved and restored.
97069447290SJavier Almansa Sobrino
97169447290SJavier Almansa SobrinoEL3 must maintain a separate register context for the following:
97269447290SJavier Almansa Sobrino
97369447290SJavier Almansa Sobrino   #. General purpose registers (x0-x30) and ``sp_el0``, ``sp_el2`` stack pointers
97469447290SJavier 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.
97569447290SJavier Almansa Sobrino
9768e51cccaSAlexeiFedorovAs part of SMC forwarding between the NS world and Realm world, EL3 allows x0-x7 to be passed
9778e51cccaSAlexeiFedorovas arguments to Realm and x0-x4 to be used for return arguments back to Non Secure.
9788e51cccaSAlexeiFedorovAs per SMCCCv1.2, x4 must be preserved if not being used as return argument by the SMC function
9798e51cccaSAlexeiFedorovand it is the responsibility of RMM to preserve this or use this as a return argument.
9808e51cccaSAlexeiFedorovEL3 will always copy x0-x4 from Realm context to NS Context.
98169447290SJavier Almansa Sobrino
98213cc1aa7SShruti GuptaEL3 must save and restore the following as part of world switch:
98313cc1aa7SShruti Gupta   #. EL2 system registers with the exception of ``zcr_el2`` register.
98413cc1aa7SShruti Gupta   #. PAuth key registers (APIA, APIB, APDA, APDB, APGA).
98513cc1aa7SShruti Gupta
98669447290SJavier Almansa SobrinoEL3 will not save some registers as mentioned in the below list. It is the
98769447290SJavier Almansa Sobrinoresponsibility of RMM to ensure that these are appropriately saved if the
98869447290SJavier Almansa SobrinoRealm World makes use of them:
98969447290SJavier Almansa Sobrino
99069447290SJavier Almansa Sobrino   #. FP/SIMD registers
99169447290SJavier Almansa Sobrino   #. SVE registers
99269447290SJavier Almansa Sobrino   #. SME registers
99313cc1aa7SShruti Gupta   #. EL1/0 registers with the exception of PAuth key registers as mentioned above.
99413cc1aa7SShruti Gupta   #. zcr_el2 register.
99569447290SJavier Almansa Sobrino
99613cc1aa7SShruti GuptaIt is essential that EL3 honors this contract to maintain the Confidentiality and integrity
99713cc1aa7SShruti Guptaof the Realm world.
9988e51cccaSAlexeiFedorov
99969447290SJavier Almansa SobrinoSMCCC v1.3 allows NS world to specify whether SVE context is in use. In this
100069447290SJavier Almansa Sobrinocase, RMM could choose to not save the incoming SVE context but must ensure
100169447290SJavier Almansa Sobrinoto clear SVE registers if they have been used in Realm World. The same applies
100269447290SJavier Almansa Sobrinoto SME registers.
100369447290SJavier Almansa Sobrino
100469447290SJavier Almansa SobrinoTypes
100569447290SJavier Almansa Sobrino_____
100669447290SJavier Almansa Sobrino
100769447290SJavier Almansa Sobrino.. _rmm_el3_manifest_struct:
100869447290SJavier Almansa Sobrino
1009dc0ca64eSJavier Almansa SobrinoRMM-EL3 Boot Manifest structure
1010dc0ca64eSJavier Almansa Sobrino~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101169447290SJavier Almansa Sobrino
101290552c61SAlexeiFedorovThe RMM-EL3 Boot Manifest v0.5 structure contains platform boot information passed
101390552c61SAlexeiFedorovfrom EL3 to RMM. The size of the Boot Manifest is 160 bytes.
101469447290SJavier Almansa Sobrino
101569447290SJavier Almansa SobrinoThe members of the RMM-EL3 Boot Manifest structure are shown in the following
101669447290SJavier Almansa Sobrinotable:
101769447290SJavier Almansa Sobrino
101890552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
10191db295cfSAlexeiFedorov|        Name       | Offset |       Type        |                 Description                  |
102090552c61SAlexeiFedorov+===================+========+===================+==============================================+
10211db295cfSAlexeiFedorov| version           |   0    |      uint32_t     | Boot Manifest version                        |
102290552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
10231db295cfSAlexeiFedorov| padding           |   4    |      uint32_t     | Reserved, set to 0                           |
102490552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
102590552c61SAlexeiFedorov| plat_data         |   8    |      uint64_t     | Pointer to Platform Data section             |
102690552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
1027bef44f60SAlexeiFedorov| plat_dram         |   16   |    memory_info    | NS DRAM Layout Info structure                |
102890552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
102988f7c87bSHarry Moulton| plat_console      |   40   |   console_list    | List of consoles available to RMM            |
103090552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
1031bef44f60SAlexeiFedorov| plat_ncoh_region  |   64   |    memory_info    | Device non-coherent ranges Info structure    |
103290552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
1033bef44f60SAlexeiFedorov| plat_coh_region   |   88   |    memory_info    | Device coherent ranges Info structure        |
103490552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
103590552c61SAlexeiFedorov| plat_smmu         |   112  |     smmu_list     | List of SMMUs available to RMM               |
103690552c61SAlexeiFedorov|                   |        |                   | (from Boot Manifest v0.5)                    |
103790552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
103890552c61SAlexeiFedorov| plat_root_complex |   136  | root_complex_list | List of PCIe root complexes available to RMM |
103990552c61SAlexeiFedorov|                   |        |                   | (from Boot Manifest v0.5)                    |
104090552c61SAlexeiFedorov+-------------------+--------+-------------------+----------------------------------------------+
104169447290SJavier Almansa Sobrino
1042bef44f60SAlexeiFedorov.. _memory_info_struct:
10431db295cfSAlexeiFedorov
1044bef44f60SAlexeiFedorovMemory Info structure
104590552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~
10461db295cfSAlexeiFedorov
1047bef44f60SAlexeiFedorovMemory Info structure contains information about platform memory layout.
1048bef44f60SAlexeiFedorovThe members of this structure are shown in the table below:
10491db295cfSAlexeiFedorov
105090552c61SAlexeiFedorov+-----------+--------+---------------+----------------------------------------+
10511db295cfSAlexeiFedorov|   Name    | Offset |     Type      |              Description               |
105290552c61SAlexeiFedorov+===========+========+===============+========================================+
1053bef44f60SAlexeiFedorov| num_banks |   0    |    uint64_t   | Number of memory banks/device regions  |
105490552c61SAlexeiFedorov+-----------+--------+---------------+----------------------------------------+
1055bef44f60SAlexeiFedorov| banks     |   8    | memory_bank * | Pointer to 'memory_bank'[] array       |
105690552c61SAlexeiFedorov+-----------+--------+---------------+----------------------------------------+
10571db295cfSAlexeiFedorov| checksum  |   16   |    uint64_t   | Checksum                               |
105890552c61SAlexeiFedorov+-----------+--------+---------------+----------------------------------------+
10591db295cfSAlexeiFedorov
10601db295cfSAlexeiFedorovChecksum is calculated as two's complement sum of 'num_banks', 'banks' pointer
1061bef44f60SAlexeiFedorovand memory banks data array pointed by it.
10621db295cfSAlexeiFedorov
1063bef44f60SAlexeiFedorov.. _memory_bank_struct:
10641db295cfSAlexeiFedorov
1065bef44f60SAlexeiFedorovMemory Bank/Device region structure
1066bef44f60SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10671db295cfSAlexeiFedorov
1068bef44f60SAlexeiFedorovMemory Bank structure contains information about each memory bank/device region:
10691db295cfSAlexeiFedorov
107090552c61SAlexeiFedorov+------+--------+----------+--------------------------------------------+
10711db295cfSAlexeiFedorov| Name | Offset |   Type   |                Description                 |
107290552c61SAlexeiFedorov+======+========+==========+============================================+
107390552c61SAlexeiFedorov| base |   0    | uint64_t | Base address                               |
107490552c61SAlexeiFedorov+------+--------+----------+--------------------------------------------+
1075bef44f60SAlexeiFedorov| size |   8    | uint64_t | Size of memory bank/device region in bytes |
107690552c61SAlexeiFedorov+------+--------+----------+--------------------------------------------+
10771db295cfSAlexeiFedorov
107888f7c87bSHarry Moulton.. _console_list_struct:
10791db295cfSAlexeiFedorov
108088f7c87bSHarry MoultonConsole List structure
108188f7c87bSHarry Moulton~~~~~~~~~~~~~~~~~~~~~~
108288f7c87bSHarry Moulton
108388f7c87bSHarry MoultonConsole List structure contains information about the available consoles for RMM.
108488f7c87bSHarry MoultonThe members of this structure are shown in the table below:
108588f7c87bSHarry Moulton
108690552c61SAlexeiFedorov+--------------+--------+----------------+-----------------------------------+
108788f7c87bSHarry Moulton|   Name       | Offset |     Type       |           Description             |
108890552c61SAlexeiFedorov+==============+========+================+===================================+
108988f7c87bSHarry Moulton| num_consoles |   0    |   uint64_t     | Number of consoles                |
109090552c61SAlexeiFedorov+--------------+--------+----------------+-----------------------------------+
109188f7c87bSHarry Moulton| consoles     |   8    | console_info * | Pointer to 'console_info'[] array |
109290552c61SAlexeiFedorov+--------------+--------+----------------+-----------------------------------+
109388f7c87bSHarry Moulton| checksum     |   16   |   uint64_t     | Checksum                          |
109490552c61SAlexeiFedorov+--------------+--------+----------------+-----------------------------------+
109588f7c87bSHarry Moulton
109688f7c87bSHarry MoultonChecksum is calculated as two's complement sum of 'num_consoles', 'consoles'
109788f7c87bSHarry Moultonpointer and the consoles array pointed by it.
109888f7c87bSHarry Moulton
109988f7c87bSHarry Moulton.. _console_info_struct:
110088f7c87bSHarry Moulton
110188f7c87bSHarry MoultonConsole Info structure
110288f7c87bSHarry Moulton~~~~~~~~~~~~~~~~~~~~~~
110388f7c87bSHarry Moulton
110488f7c87bSHarry MoultonConsole Info structure contains information about each Console available to RMM.
110588f7c87bSHarry Moulton
110690552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
110788f7c87bSHarry Moulton|   Name    | Offset |   Type   |             Description              |
110890552c61SAlexeiFedorov+===========+========+==========+======================================+
110990552c61SAlexeiFedorov| base      |   0    | uint64_t | Console Base address                 |
111090552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
111188f7c87bSHarry Moulton| map_pages |   8    | uint64_t | Num of pages to map for console MMIO |
111290552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
1113bef44f60SAlexeiFedorov| name      |   16   | char[8]  | Name of console                      |
111490552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
1115bef44f60SAlexeiFedorov| clk_in_hz |   24   | uint64_t | UART clock (in Hz) for console       |
111690552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
111788f7c87bSHarry Moulton| baud_rate |   32   | uint64_t | Baud rate                            |
111890552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
111988f7c87bSHarry Moulton| flags     |   40   | uint64_t | Additional flags (RES0)              |
112090552c61SAlexeiFedorov+-----------+--------+----------+--------------------------------------+
112190552c61SAlexeiFedorov
112290552c61SAlexeiFedorov.. _smmu_list_struct:
112390552c61SAlexeiFedorov
112490552c61SAlexeiFedorovSMMU List structure
112590552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~
112690552c61SAlexeiFedorov
112790552c61SAlexeiFedorovSMMU List structure contains information about SMMUs available for RMM.
112890552c61SAlexeiFedorovThe members of this structure are shown in the table below:
112990552c61SAlexeiFedorov
113090552c61SAlexeiFedorov+-----------+--------+-------------+--------------------------------+
113190552c61SAlexeiFedorov|    Name   | Offset |     Type    |          Description           |
113290552c61SAlexeiFedorov+===========+========+=============+================================+
113390552c61SAlexeiFedorov| num_smmus |   0    |   uint64_t  | Number of SMMUs                |
113490552c61SAlexeiFedorov+-----------+--------+-------------+--------------------------------+
113590552c61SAlexeiFedorov| smmus     |   8    | smmu_info * | Pointer to 'smmu_info'[] array |
113690552c61SAlexeiFedorov+-----------+--------+-------------+--------------------------------+
113790552c61SAlexeiFedorov| checksum  |   16   |   uint64_t  | Checksum                       |
113890552c61SAlexeiFedorov+-----------+--------+-------------+--------------------------------+
113990552c61SAlexeiFedorov
114090552c61SAlexeiFedorov.. _smmu_info_struct:
114190552c61SAlexeiFedorov
114290552c61SAlexeiFedorovSMMU Info structure
114390552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~
114490552c61SAlexeiFedorov
114590552c61SAlexeiFedorovSMMU Info structure contains information about each SMMU available to RMM.
114690552c61SAlexeiFedorov
114790552c61SAlexeiFedorov+-------------+--------+----------+-------------------------------+
114890552c61SAlexeiFedorov|    Name     | Offset |   Type   |          Description          |
114990552c61SAlexeiFedorov+=============+========+==========+===============================+
115090552c61SAlexeiFedorov| smmu_base   |   0    | uint64_t | SMMU Base address             |
115190552c61SAlexeiFedorov+-------------+--------+----------+-------------------------------+
115290552c61SAlexeiFedorov| smmu_r_base |   8    | uint64_t | SMMU Realm Pages base address |
115390552c61SAlexeiFedorov+-------------+--------+----------+-------------------------------+
115490552c61SAlexeiFedorov
115590552c61SAlexeiFedorov.. _root_complex_list_struct:
115690552c61SAlexeiFedorov
115790552c61SAlexeiFedorovRoot Complex List structure
115890552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~~~~
115990552c61SAlexeiFedorov
116090552c61SAlexeiFedorovRoot Complex List structure contains information about PCIe root complexes available for RMM.
116190552c61SAlexeiFedorovThe members of this structure are shown in the table below.
116290552c61SAlexeiFedorov
116390552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
116490552c61SAlexeiFedorov|       Name       | Offset |        Type         |           Description               |
116590552c61SAlexeiFedorov+==================+========+=====================+=====================================+
116690552c61SAlexeiFedorov| num_root_complex |   0    |      uint64_t       | Number of root complexes            |
116790552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
116890552c61SAlexeiFedorov| rc_info_version  |   8    |      uint32_t       | Root Complex Info structure version |
116990552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
117090552c61SAlexeiFedorov| padding          |   12   |      uint32_t       | Reserved, set to 0                  |
117190552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
117290552c61SAlexeiFedorov| root_complex     |   16   | root_complex_info * | Pointer to 'root_complex'[] array   |
117390552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
117490552c61SAlexeiFedorov| checksum         |   24   |      uint64_t       | Checksum                            |
117590552c61SAlexeiFedorov+------------------+--------+---------------------+-------------------------------------+
117690552c61SAlexeiFedorov
117790552c61SAlexeiFedorovThe checksum calculation of Root Complex List structure includes all data structures
117890552c61SAlexeiFedorovreferenced by 'root_complex_info' pointer.
117990552c61SAlexeiFedorov
118090552c61SAlexeiFedorov.. _root_complex_info_struct:
118190552c61SAlexeiFedorov
118290552c61SAlexeiFedorovRoot Complex Info structure
118390552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~~~~
118490552c61SAlexeiFedorov
118590552c61SAlexeiFedorovRoot Complex Info structure contains information about each PCIe root complex available to RMM.
118690552c61SAlexeiFedorovThe table below describes the members of this structure as per v0.1.
118790552c61SAlexeiFedorov
118890552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
118990552c61SAlexeiFedorov|    Name         | Offset |       Type       |               Description           |
119090552c61SAlexeiFedorov+=================+========+==================+=====================================+
119190552c61SAlexeiFedorov| ecam_base       |   0    |     uint64_t     | PCIe ECAM Base address              |
119290552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
119390552c61SAlexeiFedorov| segment         |   8    |     uint8_t      | PCIe segment identifier             |
119490552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
119590552c61SAlexeiFedorov| padding[3]      |   9    |     uint8_t      | Reserved, set to 0                  |
119690552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
119790552c61SAlexeiFedorov| num_root_ports  |   12   |     uint32_t     | Number of root ports                |
119890552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
119990552c61SAlexeiFedorov| root_ports      |   16   | root_port_info * | Pointer to 'root_port_info'[] array |
120090552c61SAlexeiFedorov+-----------------+--------+------------------+-------------------------------------+
120190552c61SAlexeiFedorov
120290552c61SAlexeiFedorovThe Root Complex Info structure version uses the same numbering scheme as described in
120390552c61SAlexeiFedorov:ref:`rmm_el3_ifc_versioning`.
120490552c61SAlexeiFedorov
120590552c61SAlexeiFedorov.. _root_port_info_struct:
120690552c61SAlexeiFedorov
120790552c61SAlexeiFedorovRoot Port Info structure
120890552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~
120990552c61SAlexeiFedorov
121090552c61SAlexeiFedorovRoot Complex Info structure contains information about each root port in PCIe root complex.
121190552c61SAlexeiFedorov
121290552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
121390552c61SAlexeiFedorov|      Name        | Offset |       Type         |              Description              |
121490552c61SAlexeiFedorov+==================+========+====================+=======================================+
121590552c61SAlexeiFedorov| root_port_id     |   0    |     uint16_t       | Root Port identifier                  |
121690552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
121790552c61SAlexeiFedorov| padding          |   2    |     uint16_t       | Reserved, set to 0                    |
121890552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
121990552c61SAlexeiFedorov| num_bdf_mappings |   4    |     uint32_t       | Number of BDF mappings                |
122090552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
122190552c61SAlexeiFedorov| bdf_mappings     |   8    | bdf_mapping_info * | Pointer to 'bdf_mapping_info'[] array |
122290552c61SAlexeiFedorov+------------------+--------+--------------------+---------------------------------------+
122390552c61SAlexeiFedorov
122490552c61SAlexeiFedorov.. _bdf_mapping_info_struct:
122590552c61SAlexeiFedorov
122690552c61SAlexeiFedorovBDF Mapping Info structure
122790552c61SAlexeiFedorov~~~~~~~~~~~~~~~~~~~~~~~~~~
122890552c61SAlexeiFedorov
122990552c61SAlexeiFedorovBDF Mapping Info structure contains information about each Device-Bus-Function (BDF) mapping
123090552c61SAlexeiFedorovfor PCIe root port.
123190552c61SAlexeiFedorov
123290552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
123390552c61SAlexeiFedorov|     Name     | Offset |   Type   |                     Description                      |
123490552c61SAlexeiFedorov+==============+========+==========+======================================================+
123590552c61SAlexeiFedorov| mapping_base |   0    | uint16_t | Base of BDF mapping (inclusive)                      |
123690552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
123790552c61SAlexeiFedorov| mapping_top  |   2    | uint16_t | Top of BDF mapping (exclusive)                       |
123890552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
123990552c61SAlexeiFedorov| mapping_off  |   4    | uint16_t | Mapping offset, as per Arm Base System Architecture: |
124090552c61SAlexeiFedorov|              |        |          | StreamID = RequesterID[N-1:0] + (1<<N)*Constant_B    |
124190552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
124290552c61SAlexeiFedorov| smmu_idx     |   6    | uint16_t | SMMU index in 'smmu_info'[] array                    |
124390552c61SAlexeiFedorov+--------------+--------+----------+------------------------------------------------------+
12441db295cfSAlexeiFedorov
1245b226357bSRaghu Krishnamurthy.. _el3_token_sign_request_struct:
1246b226357bSRaghu Krishnamurthy
1247b226357bSRaghu KrishnamurthyEL3 Token Sign Request structure
1248b226357bSRaghu Krishnamurthy~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1249b226357bSRaghu Krishnamurthy
1250bef44f60SAlexeiFedorovThis structure represents a realm attestation token signing request.
1251b226357bSRaghu Krishnamurthy
1252b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1253b226357bSRaghu Krishnamurthy|   Name      | Offset |     Type      |               Description               |
1254b226357bSRaghu Krishnamurthy+=============+========+===============+=========================================+
1255b226357bSRaghu Krishnamurthy| sig_alg_id  |   0    |   uint32_t    | Algorithm idenfier for the sign request.|
1256b226357bSRaghu Krishnamurthy|             |        |               | - 0x0: ECC SECP384R1 (ECDSA)            |
1257b226357bSRaghu Krishnamurthy|             |        |               | - Other values reserved                 |
1258b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1259b226357bSRaghu Krishnamurthy| rec_granule |   8    |   uint64_t    | Identifier used by RMM to associate     |
1260b226357bSRaghu Krishnamurthy|             |        |               | a signing request to a realm. Must not  |
1261b226357bSRaghu Krishnamurthy|             |        |               | be interpreted or modified.             |
1262b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1263b226357bSRaghu Krishnamurthy| req_ticket  |   16   |   uint64_t    | Value used by RMM to associate request  |
1264b226357bSRaghu Krishnamurthy|             |        |               | and responses. Must not be interpreted  |
1265b226357bSRaghu Krishnamurthy|             |        |               | or modified.                            |
1266b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1267b226357bSRaghu Krishnamurthy| hash_alg_id |   24   |   uint32_t    | Hash algorithm for data in `hash_buf`   |
1268b226357bSRaghu Krishnamurthy|             |        |               | - 0x1: SHA2-384                         |
1269b226357bSRaghu Krishnamurthy|             |        |               | - All other values reserved.            |
1270b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1271b226357bSRaghu Krishnamurthy| hash_buf    |   32   |   uint8_t[]   | TBS (to-be-signed) Hash of length       |
1272b226357bSRaghu Krishnamurthy|             |        |               | defined by hash algorithm `hash_alg_id` |
1273b226357bSRaghu Krishnamurthy+-------------+--------+---------------+-----------------------------------------+
1274b226357bSRaghu Krishnamurthy
1275b226357bSRaghu Krishnamurthy.. _el3_token_sign_response_struct:
1276b226357bSRaghu Krishnamurthy
1277b226357bSRaghu KrishnamurthyEL3 Token Sign Response structure
1278b226357bSRaghu Krishnamurthy~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1279b226357bSRaghu Krishnamurthy
1280b226357bSRaghu KrishnamurthyThis structure represents a realm attestation token signing response.
1281b226357bSRaghu Krishnamurthy
1282b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1283b226357bSRaghu Krishnamurthy|   Name        | Offset |     Type      |               Description               |
1284b226357bSRaghu Krishnamurthy+===============+========+===============+=========================================+
1285b226357bSRaghu Krishnamurthy| rec_granule   |   0    |   uint64_t    | Identifier used by RMM to associate     |
1286b226357bSRaghu Krishnamurthy|               |        |               | a signing request to a realm. Must not  |
1287b226357bSRaghu Krishnamurthy|               |        |               | be interpreted or modified.             |
1288b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1289b226357bSRaghu Krishnamurthy| req_ticket    |   8    |   uint64_t    | Value used by RMM to associate request  |
1290b226357bSRaghu Krishnamurthy|               |        |               | and responses. Must not be interpreted  |
1291b226357bSRaghu Krishnamurthy|               |        |               | or modified.                            |
1292b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1293b226357bSRaghu Krishnamurthy| sig_len       |   16   |   uint16_t    | Length of the `signature_buf` field     |
1294b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1295b226357bSRaghu Krishnamurthy| signature_buf |   18   |   uint8_t[]   | Signature                               |
1296b226357bSRaghu Krishnamurthy+---------------+--------+---------------+-----------------------------------------+
1297