| 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(¶ms->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), |
| - ¶ms, NULL); |
| + control, ¶ms, NULL); |
| if (psa_ret != PSA_SUCCESS) { |
| send_service_reply_to_non_secure(psa_ret, s_map_entry); |
| break; |