aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdison Ai <edison.ai@arm.com>2019-02-11 17:17:34 +0800
committerEdison Ai <edison.ai@arm.com>2019-02-12 15:38:56 +0800
commit690a6d6086155bacaa984d83af5ba8f611bd4cf3 (patch)
tree1476058cc82a1da6d9333568676a6f834adbdf7a
parent82cc07cbbc7c03e67dc88d9490dad27cbd823048 (diff)
downloadtrusted-firmware-m-690a6d6086155bacaa984d83af5ba8f611bd4cf3.tar.gz
Core: Support set reverse handle during connectingsandbox/twincpu/m0p
The connection handle is not created while SP is processing PSA_IPC_CONNECT message, this causes a failed calling of psa_set_rhandle(). Remove this limitation by setting reverse handle in psa_reply(). Change-Id: I15b3022aed981b529ad7771472a50e01e4d697d2 Signed-off-by: Edison Ai <edison.ai@arm.com>
-rw-r--r--secure_fw/core/ipc/tfm_svcalls.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c
index c8acf5f189..bdea0de852 100644
--- a/secure_fw/core/ipc/tfm_svcalls.c
+++ b/secure_fw/core/ipc/tfm_svcalls.c
@@ -435,9 +435,15 @@ static void tfm_svcall_psa_set_rhandle(uint32_t *args)
tfm_panic();
}
- if (tfm_spm_set_rhandle(msg->service, msg->handle,
- rhandle) != IPC_SUCCESS) {
- tfm_panic();
+ /*
+ * Connection handle is not created while SP is processing PSA_IPC_CONNECT
+ * message. Store reverse handle temporarily and re-set it after the
+ * connection created.
+ */
+ if (msg->handle != PSA_NULL_HANDLE) {
+ tfm_spm_set_rhandle(msg->service, msg->handle, rhandle);
+ } else {
+ msg->msg.rhandle = rhandle;
}
}
@@ -744,6 +750,11 @@ static void tfm_svcall_psa_reply(uint32_t *args)
tfm_panic();
}
ret = connect_handle;
+
+ /* Set reverse handle after connection created if needed. */
+ if (msg->msg.rhandle) {
+ tfm_spm_set_rhandle(service, connect_handle, msg->msg.rhandle);
+ }
} else if (status == PSA_CONNECTION_REFUSED) {
ret = PSA_CONNECTION_REFUSED;
} else if (status == PSA_CONNECTION_BUSY) {