SPM: Add backend operation 'replying'
SFN and IPC have different message replying mechanisms:
- SFN replies to the client by SPM after messaging is performed;
while IPC partition calls 'psa_reply' initiatively to reply to
the client.
Abstract 'replying' to decouple the backend-specific operations
out of common FFM logic.
Change-Id: Ie28a0eaa1b37dfe458328dfb6ba298a0bf979c26
Signed-off-by: Ken Liu <Ken.Liu@arm.com>
diff --git a/secure_fw/spm/ffm/backend_ipc.c b/secure_fw/spm/ffm/backend_ipc.c
index cd35e36..ee1a4c2 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -80,6 +80,15 @@
return PSA_SUCCESS;
}
+static void ipc_replying(struct tfm_msg_body_t *p_msg, psa_status_t status)
+{
+ if (is_tfm_rpc_msg(p_msg)) {
+ tfm_rpc_client_call_reply(p_msg, status);
+ } else {
+ thrd_wake_up(&p_msg->ack_evnt, status);
+ }
+}
+
/* Parameters are treated as assuredly */
static void ipc_comp_init_assuredly(struct partition_t *p_pt,
uint32_t service_setting)
@@ -132,4 +141,5 @@
.comp_init_assuredly = ipc_comp_init_assuredly,
.system_run = ipc_system_run,
.messaging = ipc_messaging,
+ .replying = ipc_replying,
};
diff --git a/secure_fw/spm/ffm/psa_api.c b/secure_fw/spm/ffm/psa_api.c
index 16e0d04..0190c02 100644
--- a/secure_fw/spm/ffm/psa_api.c
+++ b/secure_fw/spm/ffm/psa_api.c
@@ -763,11 +763,7 @@
conn_handle->status = TFM_HANDLE_STATUS_IDLE;
}
- if (is_tfm_rpc_msg(msg)) {
- tfm_rpc_client_call_reply(msg, ret);
- } else {
- thrd_wake_up(&msg->ack_evnt, ret);
- }
+ backend_instance.replying(msg, ret);
}
void tfm_spm_partition_psa_notify(int32_t partition_id)