]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(rmmd): add missing padding to RMM Boot Manifest and initialize it
authorJavier Almansa Sobrino <javier.almansasobrino@arm.com>
Thu, 1 Dec 2022 17:20:45 +0000 (17:20 +0000)
committerJavier Almansa Sobrino <javier.almansasobrino@arm.com>
Wed, 7 Dec 2022 18:54:28 +0000 (18:54 +0000)
This patch also:
     * Enforces the check of RES0 fields on EL3-RMM boot interface
       and manifest
     * Fixes a couple of nits on the EL3-RMM Boot Interface
       documentation.

Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: Idb9e38f9fcda2ba0655646a1e2c4fdbabd5cdc40

docs/components/rmm-el3-comms-spec.rst
include/services/rmm_core_manifest.h
plat/arm/board/fvp/fvp_common.c
plat/arm/common/trp/arm_trp_setup.c
services/std_svc/rmmd/trp/trp_entry.S
services/std_svc/rmmd/trp/trp_main.c
services/std_svc/rmmd/trp/trp_private.h

index 8070ff4464a40c7727cddc83665baa1215ea4c19..25c42697077fb2c04e17396f0095247a86143dcd 100644 (file)
@@ -101,7 +101,7 @@ During cold boot RMM expects the following register values:
    x2,Maximum number of CPUs to be supported at runtime. RMM should ensure that it can support this maximum number.
    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.
 
-During cold boot, EL3 firmware needs to allocate a 4K page that will be
+During cold boot, EL3 firmware needs to allocate a 4KB page that will be
 passed to RMM in x3. This memory will be used as shared buffer for communication
 between EL3 and RMM. It must be assigned to Realm world and must be mapped with
 Normal memory attributes (IWB-OWB-ISH) at EL3. At boot, this memory will be
@@ -522,8 +522,8 @@ _____
 
 .. _rmm_el3_manifest_struct:
 
-RMM-EL3 Boot Manifest Version
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+RMM-EL3 Boot Manifest structure
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The RMM-EL3 Boot Manifest structure contains platform boot information passed
 from EL3 to RMM. The width of the Boot Manifest is 128 bits
index 2f2585860149b7d6fc3cf4a5e56d86a281a446fd..7edef469b166774413172448e87817eeeb162020 100644 (file)
@@ -38,6 +38,7 @@
 /* Boot manifest core structure as per v0.1 */
 typedef struct rmm_manifest {
        uint32_t version;       /* Manifest version */
+       uint32_t padding;       /* RES0 */
        uintptr_t plat_data;    /* Manifest platform data */
 } rmm_manifest_t;
 
index f8463f14c7e3e34a3a6126277d1bacbd33c6c4c1..f5d9940f07264c10318233d526c2fbdaf1deba75 100644 (file)
@@ -536,6 +536,7 @@ int plat_rmmd_load_manifest(rmm_manifest_t *manifest)
        assert(manifest != NULL);
 
        manifest->version = RMMD_MANIFEST_VERSION;
+       manifest->padding = 0U; /* RES0 */
        manifest->plat_data = (uintptr_t)NULL;
 
        return 0;
index 59b4c06e947b027818c674d60cfa60f97161360b..aeacd1054a397a9ec671e7853480617cd398ff20 100644 (file)
@@ -28,6 +28,9 @@ static console_t arm_trp_runtime_console;
 
 static int arm_trp_process_manifest(rmm_manifest_t *manifest)
 {
+       /* padding field on the manifest must be RES0 */
+       assert(manifest->padding == 0U);
+
        /* Verify the Boot Manifest Version. Only the Major is considered */
        if (RMMD_MANIFEST_VERSION_MAJOR !=
                RMMD_GET_MANIFEST_VERSION_MAJOR(manifest->version)) {
index 47c1df14d0af61e4f17419d63ecd4251e3045470..ef3024dafafba27c0a2e5c9d74941dfc49db2012 100644 (file)
@@ -83,7 +83,17 @@ trp_head:
        mov     x3, x23
        bl      trp_setup
        bl      trp_main
+       b       1f
+
 warm_boot:
+       mov     x0, x20
+       mov     x1, x21
+       mov     x2, x22
+       mov     x3, x23
+       bl      trp_validate_warmboot_args
+       cbnz    x0, trp_panic /* Failed to validate warmboot args */
+
+1:
        mov_imm x0, RMM_BOOT_COMPLETE
        mov     x1, xzr /* RMM_BOOT_SUCCESS */
        smc     #0
index 5a56af04382d43bf226674246a6c521518f0177b..b0a1c0929dc45db1e024d4e0c130b4b1dfc3c356 100644 (file)
@@ -66,6 +66,24 @@ void trp_setup(uint64_t x0,
        trp_early_platform_setup((rmm_manifest_t *)trp_shared_region_start);
 }
 
+int trp_validate_warmboot_args(uint64_t x0, uint64_t x1,
+                              uint64_t x2, uint64_t x3)
+{
+       /*
+        * Validate boot parameters for warm boot
+        *
+        * According to the Boot Interface ABI v.0.1, the parameters
+        * received from EL3 during warm boot are:
+        *
+        * x0: CPUID (verified earlier so not used here)
+        * [x1:x3]: RES0
+        */
+
+       (void)x0;
+
+       return ((x1 | x2 | x3) == 0UL) ? 0 : E_RMM_BOOT_UNKNOWN;
+}
+
 /* Main function for TRP */
 void trp_main(void)
 {
index 945ae1c89c77f948234468fe5d4c6542c7832617..d8c69603bae76c61250b1a09913ed78213d49b96 100644 (file)
@@ -53,5 +53,9 @@ void trp_setup(uint64_t x0,
               uint64_t x2,
               uint64_t x3);
 
+/* Validate arguments for warm boot only */
+int trp_validate_warmboot_args(uint64_t x0, uint64_t x1,
+                              uint64_t x2, uint64_t x3);
+
 #endif /* __ASSEMBLER__ */
 #endif /* TRP_PRIVATE_H */