arm-bsp/corstone1000: fix synchronization issue on openamp notification
cover arm-bsp/corstone1000: fix synchronization issue on openamp notification
From: Emekcan Aras <[email protected]>
This fixes a race that is observed rarely in the FVP. It occurs in FVP when tfm sends the notication ack in openamp, and then reset the access request which resets the mhu registers before received by the host processor. It implements the fix both in SE and the host processor openamp wrapper. This solution enables polling on the status register of mhu until the notificaiton is read by the host processor. (Inspired by signal_and_wait_for_signal function in mhu_wrapper_v2_x.c in trusted-firmware-m
https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/rss/common/native_drivers/mhu_wrapper_v2_x.c#n61)
Emekcan Aras (1):
arm-bsp/corstone1000: fix synchronization issue on openamp
notification
...e1000-fix-synchronization-issue-on-o.patch | 50 +++++++++ .../trusted-firmware-m-corstone1000.inc | 1 + ...rstone1000-fix-synchronization-issue.patch | 105 ++++++++++++++++++ .../trusted-services/ts-arm-platforms.inc | 1 + 4 files changed, 157 insertions(+) create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0009-platform-corstone1000-fix-synchronization-issue-on-o.patch create mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0008-platform-corstone1000-fix-synchronization-issue.patch
Signature · 1 line
2.25.1
PATCH 1/1 arm-bsp/corstone1000: fix synchronization issue on openamp notification
From: Emekcan Aras <[email protected]>
This fixes a race that is observed rarely in the FVP. It occurs in FVP when tfm sends the notication ack in openamp, and then reset the access request which resets the mhu registers before received by the host processor. It implements the fix both in SE and the host processor openamp wrapper. This solution enables polling on the status register of mhu until the notificaiton is read by the host processor. (Inspired by signal_and_wait_for_signal function in mhu_wrapper_v2_x.c in trusted-firmware-m
https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/rss/common/native_drivers/mhu_wrapper_v2_x.c#n61)
--- ...e1000-fix-synchronization-issue-on-o.patch | 50 +++++++++ .../trusted-firmware-m-corstone1000.inc | 1 + ...rstone1000-fix-synchronization-issue.patch | 105 ++++++++++++++++++ .../trusted-services/ts-arm-platforms.inc | 1 + 4 files changed, 157 insertions(+) create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0009-platform-corstone1000-fix-synchronization-issue-on-o.patch create mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0008-platform-corstone1000-fix-synchronization-issue.patch
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0009-platform-corstone1000-fix-synchronization-issue-on-o.patch new file +50 -0
@@ -0,0 +1,50 @@ +From b70dd14eed59d7c5833ded8469cf99e631951e14 Mon Sep 17 00:00:00 2001 +From: Emekcan Aras <[email protected]> +Date: Wed, 15 Nov 2023 09:52:19 +0000 +Subject: [PATCH] platform: corstone1000: fix synchronization issue on openamp + notification + +This fixes a race that is observed rarely in the FVP. It occurs in FVP +when tfm sends the notication ack in openamp, and then reset the access +request which resets the mhu registers before received by the host +processor. This solution introduces polling on the status register of +mhu until the notificaiton is read by the host processor. (Inspired by +signal_and_wait_for_signal function in mhu_wrapper_v2_x.c in trusted-firmware-m +https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/rss/common/native_drivers/mhu_wrapper_v2_x.c#n61) + +Signed-off-by: Emekcan Aras <[email protected]> +Upstream-Status: Pending [Not submitted to upstream yet] +--- + .../corstone1000/openamp/platform_spe_dual_core_hal.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/platform/ext/target/arm/corstone1000/openamp/platform_spe_dual_core_hal.c b/platform/ext/target/arm/corstone1000/openamp/platform_spe_dual_core_hal.c +index 7613345ffc..b58088032f 100644 +--- a/platform/ext/target/arm/corstone1000/openamp/platform_spe_dual_core_hal.c ++++ b/platform/ext/target/arm/corstone1000/openamp/platform_spe_dual_core_hal.c +@@ -83,7 +83,7 @@ enum tfm_plat_err_t tfm_dual_core_hal_init(void) + + enum tfm_plat_err_t tfm_hal_notify_peer(void) + { +- uint32_t access_ready; ++ uint32_t access_ready,val; + enum mhu_v2_x_error_t status; + struct mhu_v2_x_dev_t* dev = &MHU1_SE_TO_HOST_DEV; + +@@ -108,6 +108,13 @@ enum tfm_plat_err_t tfm_hal_notify_peer(void) + return TFM_PLAT_ERR_SYSTEM_ERR; + } + ++ do { ++ status = mhu_v2_x_channel_poll(dev, MHU1_SEH_NOTIFY_CH, &val); ++ if (status != MHU_V_2_X_ERR_NONE) { ++ break; ++ } ++ } while(val != 0); ++ + status = mhu_v2_x_reset_access_request(dev); + if (status != MHU_V_2_X_ERR_NONE) { + SPMLOG_ERRMSGVAL("mhu_v2_x_reset_access_request : ", status); +-- +2.25.1 +
meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc +1 -0
@@ -36,6 +36,7 @@ SRC_URI:append:corstone1000 = " \ file://0006-Platform-Corstone1000-Enable-Signed-Capsule.patch \ file://0007-platform-corstone1000-increase-ITS-max-asset-size.patch \ file://0008-platform-corstone1000-align-capsule-update-structs.patch \ + file://0009-platform-corstone1000-fix-synchronization-issue-on-o.patch \ " # TF-M ships patches for external dependencies that needs to be applied
meta-arm-bsp/recipes-security/trusted-services/corstone1000/0008-platform-corstone1000-fix-synchronization-issue.patch new file +105 -0
105 lines not on this page · raw message
meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc +1 -0
@@ -9,6 +9,7 @@ SRC_URI:append:corstone1000 = " \ file://0005-plat-corstone1000-add-compile-definitions-for-ECP_DP.patch \ file://0006-plat-corstone1000-Use-the-stateless-platform-service.patch \ file://0007-plat-corstone1000-Initialize-capsule-update-provider.patch \ + file://0008-platform-corstone1000-fix-synchronization-issue.patch \ "
Signature · 1 line
2.25.1