blob: 23609921011e36b9d14ae0f6e90595e7847a1efb [file] [log] [blame]
Patrick Williams03514f12024-04-05 07:04:11 -05001From f7b58b5ba5b48e071eb360c1bcfc4d31290a77c1 Mon Sep 17 00:00:00 2001
2From: Ali Can Ozaslan <ali.oezaslan@arm.com>
3Date: Tue, 5 Mar 2024 21:01:59 +0000
4Subject: [PATCH] Platform:corstone1000:Fix issues due to adjustment Mailbox
5 Agent params
6
7Adjust Mailbox Agent API parameters patch changed memory check and
8related parameters. As a result, platform-specific issues occurred.
9Secure side client IDs are converted to negative values. Control
10parameter is created.
11
12Signed-off-by: Bence Balogh <bence.balogh@arm.com>
13Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
14Signed-off-by: Ali Can Ozaslan <ali.oezaslan@arm.com>
15Upstream-Status: Pending
16
17---
18 .../tfm_spe_dual_core_psa_client_secure_lib.c | 23 +++++++++++++++----
19 1 file changed, 18 insertions(+), 5 deletions(-)
20
21diff --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
22index d2eabe144..39e11b8cd 100644
23--- a/platform/ext/target/arm/corstone1000/openamp/tfm_spe_dual_core_psa_client_secure_lib.c
24+++ b/platform/ext/target/arm/corstone1000/openamp/tfm_spe_dual_core_psa_client_secure_lib.c
25@@ -18,6 +18,9 @@
26 #include "utilities.h"
27 #include "thread.h"
28
29+#define SE_PROXY_SP_UID 0
30+#define SMM_GW_SP_UID 0x8003
31+
32 /**
33 * In linux environment and for psa_call type client api,
34 * the layout of the reply from tf-m to linux is as following.
35@@ -174,7 +177,14 @@ static psa_status_t prepare_params_for_psa_call(struct client_params_t *params,
36 {
37 psa_status_t ret = PSA_SUCCESS;
38
39- params->ns_client_id_stateless = s_map_entry->msg.client_id;
40+ if (s_map_entry->msg.client_id == SE_PROXY_SP_UID) {
41+ params->ns_client_id_stateless = -1;
42+ }
43+ else if (s_map_entry->msg.client_id == SMM_GW_SP_UID) {
44+ params->ns_client_id_stateless = -1 * s_map_entry->msg.client_id;
45+ } else {
46+ params->ns_client_id_stateless = s_map_entry->msg.client_id;
47+ }
48
49 params->p_outvecs = NULL;
50 ret = alloc_and_prepare_out_vecs(&params->p_outvecs, s_map_entry);
51@@ -250,6 +260,9 @@ void deliver_msg_to_tfm_spe(void *private)
52 struct client_params_t params = {0};
53 psa_status_t psa_ret = PSA_ERROR_GENERIC_ERROR;
54 unordered_map_entry_t* s_map_entry = (unordered_map_entry_t*)private;
55+ uint32_t control = PARAM_PACK(s_map_entry->msg.params.psa_call_params.type,
56+ s_map_entry->msg.params.psa_call_params.in_len,
57+ s_map_entry->msg.params.psa_call_params.out_len);
58
59 switch(s_map_entry->msg.call_type) {
60 case OPENAMP_PSA_FRAMEWORK_VERSION:
61@@ -266,11 +279,11 @@ void deliver_msg_to_tfm_spe(void *private)
62 send_service_reply_to_non_secure(psa_ret, s_map_entry);
63 break;
64 }
65+ control = PARAM_SET_NS_INVEC(control);
66+ control = PARAM_SET_NS_OUTVEC(control);
67+ control = PARAM_SET_NS_VEC(control);
68 psa_ret = tfm_rpc_psa_call(s_map_entry->msg.params.psa_call_params.handle,
69- PARAM_PACK(s_map_entry->msg.params.psa_call_params.type,
70- s_map_entry->msg.params.psa_call_params.in_len,
71- s_map_entry->msg.params.psa_call_params.out_len),
72- &params, NULL);
73+ control, &params, NULL);
74 if (psa_ret != PSA_SUCCESS) {
75 send_service_reply_to_non_secure(psa_ret, s_map_entry);
76 break;