Implement FFA_YIELD ABI
This change adds the missing FFA ABI and updates the documentation.
Change-Id: Ia302daf011e58984154ea33760a1912532d0753c
Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
diff --git a/components/messaging/ffa/libsp/ffa.c b/components/messaging/ffa/libsp/ffa.c
index 03431dd..cae246d 100644
--- a/components/messaging/ffa/libsp/ffa.c
+++ b/components/messaging/ffa/libsp/ffa.c
@@ -299,6 +299,22 @@
return FFA_OK;
}
+ffa_result ffa_yield(void)
+{
+ struct ffa_params result = {0};
+
+ ffa_svc(FFA_YIELD, FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ,
+ FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ,
+ &result);
+
+ if (result.a0 == FFA_ERROR)
+ return ffa_get_errorcode(&result);
+
+ assert(result.a0 == FFA_RUN);
+
+ return FFA_OK;
+}
+
static ffa_result ffa_msg_send_direct_req(uint32_t function_id, uint32_t resp_id,
uint16_t source, uint16_t dest,
uint64_t a0, uint64_t a1, uint64_t a2,
diff --git a/components/messaging/ffa/libsp/include/ffa_api.h b/components/messaging/ffa/libsp/include/ffa_api.h
index 2175d8f..bec9009 100644
--- a/components/messaging/ffa/libsp/include/ffa_api.h
+++ b/components/messaging/ffa/libsp/include/ffa_api.h
@@ -146,6 +146,15 @@
*/
ffa_result ffa_msg_wait(struct ffa_direct_msg *msg);
+/**
+ * @brief Yields execution back to the FF-A component that scheduled the SP.
+ * E.g. SP0 yields execution back to VM0 instead of busy waiting
+ * for an IO operation to complete.
+ *
+ * @return The FF-A error status code
+ */
+ffa_result ffa_yield(void);
+
/** Messaging interfaces */
/**
diff --git a/components/messaging/ffa/libsp/include/sp_messaging.h b/components/messaging/ffa/libsp/include/sp_messaging.h
index c1c5a7a..bea40c4 100644
--- a/components/messaging/ffa/libsp/include/sp_messaging.h
+++ b/components/messaging/ffa/libsp/include/sp_messaging.h
@@ -40,6 +40,13 @@
sp_result sp_msg_wait(struct sp_msg *msg);
/**
+ * @brief Yield execution.
+ *
+ * @return The SP API result
+ */
+sp_result sp_yield(void);
+
+/**
* @brief Sends a request message and waits for the response message
* which it returns then.
*
diff --git a/components/messaging/ffa/libsp/sp_messaging.c b/components/messaging/ffa/libsp/sp_messaging.c
index 67fd7ee..0c26aa7 100644
--- a/components/messaging/ffa/libsp/sp_messaging.c
+++ b/components/messaging/ffa/libsp/sp_messaging.c
@@ -82,6 +82,11 @@
return SP_RESULT_OK;
}
+sp_result sp_yield(void)
+{
+ return SP_RESULT_FFA(ffa_yield());
+}
+
sp_result sp_msg_send_direct_req(const struct sp_msg *req, struct sp_msg *resp)
{
ffa_result ffa_res = FFA_OK;
diff --git a/docs/uml/libsp_functions.puml b/docs/uml/libsp_functions.puml
index b46cc01..538d573 100644
--- a/docs/uml/libsp_functions.puml
+++ b/docs/uml/libsp_functions.puml
@@ -25,6 +25,7 @@
.. CPU cycle management interfaces ..
+ ffa_msg_wait()
+ + ffa_yield()
.. Messaging interfaces ..
+ ffa_msg_send_direct_req()