From dc0ca64e4b6c86090eee025293e7ae7f1fe1cf12 Mon Sep 17 00:00:00 2001 From: Javier Almansa Sobrino Date: Thu, 1 Dec 2022 17:20:45 +0000 Subject: fix(rmmd): add missing padding to RMM Boot Manifest and initialize it 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 Change-Id: Idb9e38f9fcda2ba0655646a1e2c4fdbabd5cdc40 --- services/std_svc/rmmd/trp/trp_entry.S | 10 ++++++++++ services/std_svc/rmmd/trp/trp_main.c | 18 ++++++++++++++++++ services/std_svc/rmmd/trp/trp_private.h | 4 ++++ 3 files changed, 32 insertions(+) (limited to 'services') diff --git a/services/std_svc/rmmd/trp/trp_entry.S b/services/std_svc/rmmd/trp/trp_entry.S index 47c1df14d..ef3024daf 100644 --- a/services/std_svc/rmmd/trp/trp_entry.S +++ b/services/std_svc/rmmd/trp/trp_entry.S @@ -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 diff --git a/services/std_svc/rmmd/trp/trp_main.c b/services/std_svc/rmmd/trp/trp_main.c index 5a56af043..b0a1c0929 100644 --- a/services/std_svc/rmmd/trp/trp_main.c +++ b/services/std_svc/rmmd/trp/trp_main.c @@ -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) { diff --git a/services/std_svc/rmmd/trp/trp_private.h b/services/std_svc/rmmd/trp/trp_private.h index 945ae1c89..d8c69603b 100644 --- a/services/std_svc/rmmd/trp/trp_private.h +++ b/services/std_svc/rmmd/trp/trp_private.h @@ -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 */ -- cgit v1.2.1