diff options
| author | Harrison Mutai <harrison.mutai@arm.com> | 2026-05-15 15:47:27 +0100 |
|---|---|---|
| committer | Harrison Mutai <harrison.mutai@arm.com> | 2026-06-29 13:37:46 +0100 |
| commit | 5bfbf4b83974aefc109415454eaf00fcb7cccee6 (patch) | |
| tree | 19a5ce62112b1864c276b971860e72fb51c63810 | |
| parent | 1cdb2e13ae7147b11f65f8cd6be0de9871fb3b20 (diff) | |
| download | arm-trusted-firmware-5bfbf4b83974aefc109415454eaf00fcb7cccee6.tar.gz arm-trusted-firmware-5bfbf4b83974aefc109415454eaf00fcb7cccee6.zip | |
feat(rmmd): route MEC refresh via FIRME
Use FIRME_MEC_REFRESH as the provider for the RMM_MEC_REFRESH command
and remove replace the existing plat_rmmd_mecid_key_update() hook.
BREAKING-CHANGE: plat_rmmd_mecid_key_update() is deprecated for MEC
refresh flows and has been dropped. Platforms that currently implement
plat_rmmd_mecid_key_update() for MECID key refresh must migrate that
logic to plat_firme_mec_refresh(), including converting return values to
FIRME status codes.
Change-Id: I79985e0f7280b31e1fd149ef1e51bc9cf4b5a6cb
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
| -rw-r--r-- | docs/porting-guide.rst | 27 | ||||
| -rw-r--r-- | include/plat/common/platform.h | 1 | ||||
| -rw-r--r-- | plat/arm/board/fvp/fvp_common.c | 7 | ||||
| -rw-r--r-- | plat/arm/board/neoverse_rd/platform/rdv3/rdv3_common.c | 9 | ||||
| -rw-r--r-- | plat/qemu/common/qemu_common.c | 9 | ||||
| -rw-r--r-- | services/std_svc/rmmd/rmmd_main.c | 44 |
6 files changed, 22 insertions, 75 deletions
diff --git a/docs/porting-guide.rst b/docs/porting-guide.rst index 9dcb72f93..30d5f751c 100644 --- a/docs/porting-guide.rst +++ b/docs/porting-guide.rst @@ -2365,24 +2365,33 @@ RMM image and stores it in the area specified by manifest. When ENABLE_RMM is disabled, this function is not used. -Function : plat_rmmd_mecid_key_update() [when ENABLE_RMM == 1] +Function : plat_firme_mec_refresh() [when FIRME_SUPPORT == 1] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: - Argument : uint16_t, unsigned int + Argument : uint16_t, uint8_t Return : int -This function is invoked by BL31's RMMD when there is a request from the RMM -monitor to update the tweak for the encryption key associated to a MECID. +This function is invoked by BL31's FIRME MECID management service when there is +a request to refresh the Memory Encryption Context (MEC) associated with a +MECID. -The first parameter (``uint16_t mecid``) contains the MECID for which the -encryption key is to be updated. The second argument specifies the reason -for key update. Possible values are: 0 - Realm creation, 1 - Realm destruction. +The first parameter (``uint16_t mecid``) contains the MECID whose associated +MEC is to be refreshed. The second parameter (``uint8_t reason``) specifies the +reason for the refresh. Possible values are: +``MEC_REFRESH_REASON_REALM_CREATE`` for Realm creation and +``MEC_REFRESH_REASON_REALM_DESTROY`` for Realm destruction. -Return value is 0 upon success and -EFAULT otherwise. +The FIRME MECID management service validates that FEAT_MEC is supported and +that the MECID fits within the common MECID width before calling this function. -This function needs to be implemented by a platform if it enables RME. +The function returns a FIRME status code. It should return ``FIRME_SUCCESS`` on +success, or an appropriate negative FIRME error code such as +``FIRME_INVALID_PARAMETERS``, ``FIRME_DENIED`` or ``FIRME_RETRY`` on failure. + +This function needs to be implemented by a platform if it enables FIRME support +and advertises the FIRME MECID management service. Function : plat_rmmd_reserve_memory() [when ENABLE_RMM == 1] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index 4d4682cd6..b953c2893 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -409,7 +409,6 @@ int plat_rmmd_el3_token_sign_push_req( 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, unsigned int reason); uintptr_t plat_rmmd_reserve_memory(size_t size, unsigned long alignment); /* The following 4 functions are to be implemented if diff --git a/plat/arm/board/fvp/fvp_common.c b/plat/arm/board/fvp/fvp_common.c index 4aafc0530..3733eee30 100644 --- a/plat/arm/board/fvp/fvp_common.c +++ b/plat/arm/board/fvp/fvp_common.c @@ -1066,7 +1066,7 @@ int plat_rmmd_load_manifest(struct rmm_manifest *manifest) /* * Update encryption key associated with @mecid. */ -int plat_rmmd_mecid_key_update(uint16_t mecid, unsigned int reason) +int plat_firme_mec_refresh(uint16_t mecid, uint8_t reason) { /* * FVP does not provide an interface to change the encryption key associated @@ -1074,9 +1074,4 @@ int plat_rmmd_mecid_key_update(uint16_t mecid, unsigned int reason) */ return 0; } - -int plat_firme_mec_refresh(uint16_t mecid, uint8_t reason) -{ - return 0; -} #endif /* ENABLE_RMM */ 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 aa4cec63e..ad25d570d 100644 --- a/plat/arm/board/neoverse_rd/platform/rdv3/rdv3_common.c +++ b/plat/arm/board/neoverse_rd/platform/rdv3/rdv3_common.c @@ -189,15 +189,6 @@ int plat_rmmd_load_manifest(struct rmm_manifest *manifest) /* * Update encryption key associated with @mecid. */ -int plat_rmmd_mecid_key_update(uint16_t mecid, unsigned int reason) -{ - /* - * RDV3 does not support FEAT_MEC. - * This empty hook is for compilation to succeed. - */ - return 0; -} - int plat_firme_mec_refresh(uint16_t mecid, uint8_t reason) { /* diff --git a/plat/qemu/common/qemu_common.c b/plat/qemu/common/qemu_common.c index 97625bd49..3bdc02f4d 100644 --- a/plat/qemu/common/qemu_common.c +++ b/plat/qemu/common/qemu_common.c @@ -761,15 +761,6 @@ int plat_rmmd_load_manifest(struct rmm_manifest *manifest) /* * Update encryption key associated with @mecid. */ -int plat_rmmd_mecid_key_update(uint16_t mecid, unsigned int reason) -{ - /* - * QEMU does not provide an interface to change the encryption key - * associated with MECID. Hence always return success. - */ - return 0; -} - int plat_firme_mec_refresh(uint16_t mecid, uint8_t reason) { /* diff --git a/services/std_svc/rmmd/rmmd_main.c b/services/std_svc/rmmd/rmmd_main.c index 521bb9e16..c648a452a 100644 --- a/services/std_svc/rmmd/rmmd_main.c +++ b/services/std_svc/rmmd/rmmd_main.c @@ -32,6 +32,7 @@ #include <plat/common/platform.h> #include <platform_def.h> #include <services/rmmd_svc.h> +#include <services/firme_svc.h> #include <smccc_helpers.h> #include <lib/extensions/sme.h> #include <lib/extensions/sve.h> @@ -455,46 +456,6 @@ static int rmm_el3_ifc_get_feat_register(uint64_t feat_reg_idx, return E_RMM_OK; } -/* - * Update encryption key associated with mecid included in x1. - */ -static int rmmd_mecid_key_update(uint64_t x1) -{ - uint64_t mecid_width, mecid_width_mask; - uint16_t mecid; - unsigned int reason; - 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. - */ - mecid_width = ((read_mecidr_el2() >> MECIDR_EL2_MECIDWidthm1_SHIFT) & - MECIDR_EL2_MECIDWidthm1_MASK) + 1UL; - mecid_width_mask = ((1UL << mecid_width) - 1UL); - - mecid = (x1 >> MECID_SHIFT) & MECID_MASK; - if ((mecid & ~mecid_width_mask) != 0U) { - return E_RMM_INVAL; - } - - reason = (x1 >> MEC_REFRESH_REASON_SHIFT) & MEC_REFRESH_REASON_MASK; - ret = plat_rmmd_mecid_key_update(mecid, reason); - - if (ret != 0) { - return E_RMM_UNK; - } - return E_RMM_OK; -} - /******************************************************************************* * This function handles RMM-EL3 interface SMCs ******************************************************************************/ @@ -585,7 +546,8 @@ uint64_t rmmd_rmm_el3_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, rmmd_rmm_sync_exit(x1); } case RMM_MEC_REFRESH: - ret = rmmd_mecid_key_update(x1); + ret = firme_handler(FIRME_MEC_REFRESH_FID, x1, x2, x3, x4, + cookie, handle, flags); SMC_RET1(handle, ret); default: WARN("RMMD: Unsupported RMM-EL3 call 0x%08x\n", smc_fid); |
