From 609ada9691ca3793ad7203536fb4c95088bd3026 Mon Sep 17 00:00:00 2001 From: Juan Pablo Conde Date: Mon, 24 Mar 2025 16:18:48 -0500 Subject: [PATCH] feat(rmmd): verify FEAT_MEC present before calling plat hoook Some platforms do not support FEAT_MEC. Hence, they do not provide an interface to update the update of the key corresponding to a MECID. This patch adds a condition in order to verify FEAT_MEC is present before calling the corresponding platform hook, thus preventing it from being called when the platform does not support the feature. Change-Id: Ib1eb9e42f475e27ec31529569e888b93b207148c Signed-off-by: Juan Pablo Conde --- include/plat/common/platform.h | 2 +- plat/arm/board/neoverse_rd/platform/rdv3/rdv3_common.c | 3 ++- services/std_svc/rmmd/rmmd_main.c | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index 708cbcd3f..faccf314f 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -399,7 +399,7 @@ int plat_rmmd_el3_token_sign_pull_resp(struct el3_token_sign_response *resp); size_t plat_rmmd_get_el3_rmm_shared_mem(uintptr_t *shared); int plat_rmmd_load_manifest(struct rmm_manifest *manifest); int plat_rmmd_mecid_key_update(uint16_t mecid); -#endif +#endif /* ENABLE_RME */ /******************************************************************************* * Optional BL31 functions (may be overridden) diff --git a/plat/arm/board/neoverse_rd/platform/rdv3/rdv3_common.c b/plat/arm/board/neoverse_rd/platform/rdv3/rdv3_common.c index b1ee5e605..ac1f893d2 100644 --- a/plat/arm/board/neoverse_rd/platform/rdv3/rdv3_common.c +++ b/plat/arm/board/neoverse_rd/platform/rdv3/rdv3_common.c @@ -193,7 +193,8 @@ int plat_rmmd_load_manifest(struct rmm_manifest *manifest) int plat_rmmd_mecid_key_update(uint16_t mecid) { /* - * TODO + * RDV3 does not support FEAT_MEC. + * This empty hook is for compilation to succeed. */ return 0; } diff --git a/services/std_svc/rmmd/rmmd_main.c b/services/std_svc/rmmd/rmmd_main.c index e94b04814..9f9894e92 100644 --- a/services/std_svc/rmmd/rmmd_main.c +++ b/services/std_svc/rmmd/rmmd_main.c @@ -478,6 +478,14 @@ static int rmmd_mecid_key_update(uint64_t mecid) uint64_t mecid_width, mecid_width_mask; int ret; + /* + * Check whether FEAT_MEC is supported by the hardware. If not, return + * unknown SMC. + */ + if (is_feat_mec_supported() == false) { + return E_RMM_UNK; + } + /* * Check whether the mecid parameter is at most MECIDR_EL2.MECIDWidthm1 + 1 * in length.