1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-07 04:58:57 +00:00

arm-bsp/trusted-firmware-m: replace OpenAMP with RSE Comms

Signed-off-by: Bence Balogh <bence.balogh@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Bence Balogh
2024-04-29 17:26:54 +02:00
committed by Jon Mason
parent db2284fc01
commit f63c043ba7
10 changed files with 3655 additions and 133 deletions
@@ -1,76 +0,0 @@
From f7b58b5ba5b48e071eb360c1bcfc4d31290a77c1 Mon Sep 17 00:00:00 2001
From: Ali Can Ozaslan <ali.oezaslan@arm.com>
Date: Tue, 5 Mar 2024 21:01:59 +0000
Subject: [PATCH] Platform:corstone1000:Fix issues due to adjustment Mailbox
Agent params
Adjust Mailbox Agent API parameters patch changed memory check and
related parameters. As a result, platform-specific issues occurred.
Secure side client IDs are converted to negative values. Control
parameter is created.
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Ali Can Ozaslan <ali.oezaslan@arm.com>
Upstream-Status: Pending
---
.../tfm_spe_dual_core_psa_client_secure_lib.c | 23 +++++++++++++++----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/platform/ext/target/arm/corstone1000/openamp/tfm_spe_dual_core_psa_client_secure_lib.c b/platform/ext/target/arm/corstone1000/openamp/tfm_spe_dual_core_psa_client_secure_lib.c
index d2eabe144..39e11b8cd 100644
--- a/platform/ext/target/arm/corstone1000/openamp/tfm_spe_dual_core_psa_client_secure_lib.c
+++ b/platform/ext/target/arm/corstone1000/openamp/tfm_spe_dual_core_psa_client_secure_lib.c
@@ -18,6 +18,9 @@
#include "utilities.h"
#include "thread.h"
+#define SE_PROXY_SP_UID 0
+#define SMM_GW_SP_UID 0x8003
+
/**
* In linux environment and for psa_call type client api,
* the layout of the reply from tf-m to linux is as following.
@@ -174,7 +177,14 @@ static psa_status_t prepare_params_for_psa_call(struct client_params_t *params,
{
psa_status_t ret = PSA_SUCCESS;
- params->ns_client_id_stateless = s_map_entry->msg.client_id;
+ if (s_map_entry->msg.client_id == SE_PROXY_SP_UID) {
+ params->ns_client_id_stateless = -1;
+ }
+ else if (s_map_entry->msg.client_id == SMM_GW_SP_UID) {
+ params->ns_client_id_stateless = -1 * s_map_entry->msg.client_id;
+ } else {
+ params->ns_client_id_stateless = s_map_entry->msg.client_id;
+ }
params->p_outvecs = NULL;
ret = alloc_and_prepare_out_vecs(&params->p_outvecs, s_map_entry);
@@ -250,6 +260,9 @@ void deliver_msg_to_tfm_spe(void *private)
struct client_params_t params = {0};
psa_status_t psa_ret = PSA_ERROR_GENERIC_ERROR;
unordered_map_entry_t* s_map_entry = (unordered_map_entry_t*)private;
+ uint32_t control = PARAM_PACK(s_map_entry->msg.params.psa_call_params.type,
+ s_map_entry->msg.params.psa_call_params.in_len,
+ s_map_entry->msg.params.psa_call_params.out_len);
switch(s_map_entry->msg.call_type) {
case OPENAMP_PSA_FRAMEWORK_VERSION:
@@ -266,11 +279,11 @@ void deliver_msg_to_tfm_spe(void *private)
send_service_reply_to_non_secure(psa_ret, s_map_entry);
break;
}
+ control = PARAM_SET_NS_INVEC(control);
+ control = PARAM_SET_NS_OUTVEC(control);
+ control = PARAM_SET_NS_VEC(control);
psa_ret = tfm_rpc_psa_call(s_map_entry->msg.params.psa_call_params.handle,
- PARAM_PACK(s_map_entry->msg.params.psa_call_params.type,
- s_map_entry->msg.params.psa_call_params.in_len,
- s_map_entry->msg.params.psa_call_params.out_len),
- &params, NULL);
+ control, &params, NULL);
if (psa_ret != PSA_SUCCESS) {
send_service_reply_to_non_secure(psa_ret, s_map_entry);
break;
@@ -1,50 +0,0 @@
From b70dd14eed59d7c5833ded8469cf99e631951e14 Mon Sep 17 00:00:00 2001
From: Emekcan Aras <emekcan.aras@arm.com>
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 <emekcan.aras@arm.com>
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
@@ -0,0 +1,28 @@
From 21b0c9f028b6b04fa2f027510ec90969735f4dd1 Mon Sep 17 00:00:00 2001
From: Bence Balogh <bence.balogh@arm.com>
Date: Wed, 17 Apr 2024 19:31:03 +0200
Subject: [PATCH] platform: CS1000: Increase RSE_COMMS buffer size
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
Upstream-Status: Pending
---
platform/ext/target/arm/corstone1000/rse_comms/rse_comms.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/platform/ext/target/arm/corstone1000/rse_comms/rse_comms.h b/platform/ext/target/arm/corstone1000/rse_comms/rse_comms.h
index 6d79dd3bf..f079f6504 100644
--- a/platform/ext/target/arm/corstone1000/rse_comms/rse_comms.h
+++ b/platform/ext/target/arm/corstone1000/rse_comms/rse_comms.h
@@ -16,7 +16,7 @@ extern "C" {
#endif
/* size suits to fit the largest message too (EFI variables) */
-#define RSE_COMMS_PAYLOAD_MAX_SIZE (0x2100)
+#define RSE_COMMS_PAYLOAD_MAX_SIZE (0x3B00)
/*
* Allocated for each client request.
--
2.25.1
@@ -35,13 +35,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI:append:corstone1000 = " \
file://0001-platform-corstone1000-Update-MPU-configuration.patch \
file://0002-platform-corstone1000-Cover-S_DATA-with-MPU.patch \
file://0003-Platform-corstone1000-Fix-issues-due-to-adjustment-M.patch \
file://0004-platform-corstone1000-align-capsule-update-structs.patch \
file://0005-platform-corstone1000-fix-synchronization-issue-on-o.patch \
file://0006-Platform-Corstone1000-skip-the-first-nv-counter.patch \
file://0007-platform-corstone1000-add-unique-guid-for-mps3.patch \
file://0008-Platform-Corstone1000-Enable-host-firewall-in-FVP.patch \
file://0009-platform-corstone1000-Increase-ITS-max-asset-size.patch \
file://0003-platform-corstone1000-align-capsule-update-structs.patch \
file://0004-Platform-Corstone1000-skip-the-first-nv-counter.patch \
file://0005-platform-corstone1000-add-unique-guid-for-mps3.patch \
file://0006-Platform-Corstone1000-Enable-host-firewall-in-FVP.patch \
file://0007-platform-corstone1000-Increase-ITS-max-asset-size.patch \
file://0008-Platform-CS1000-Replace-OpenAMP-with-RSE_COMMS.patch \
file://0009-platform-CS1000-Increase-RSE_COMMS-buffer-size.patch \
"
# TF-M ships patches for external dependencies that needs to be applied