feat(FF-A): implement FFA_SPM_ID_GET interface
If FFA_SPM_ID_GET is invoked at the secure virtual FF-A instance
(a secure partition) return the SPMC id. The SPMC id is queried by
the SPMC to the SPMD by calling FFA_ID_GET or by the Hypervisor to
the SPMD by calling FFA_SPM_ID_GET. Introduce plat_ffa module to
allow for the SPMC and hypervisor specific code.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I892fa034ac00a1c0ada7ac13e9384a8c5ccfc507
diff --git a/src/api.c b/src/api.c
index 38475a7..01c91b5 100644
--- a/src/api.c
+++ b/src/api.c
@@ -9,6 +9,7 @@
#include "hf/api.h"
#include "hf/arch/cpu.h"
+#include "hf/arch/ffa.h"
#include "hf/arch/ffa_memory_handle.h"
#include "hf/arch/mm.h"
#include "hf/arch/other_world.h"
@@ -436,6 +437,24 @@
}
/**
+ * Returns the ID of the SPMC.
+ */
+struct ffa_value api_ffa_spm_id_get(void)
+{
+ struct ffa_value ret = ffa_error(FFA_NOT_SUPPORTED);
+
+ if (MAKE_FFA_VERSION(1, 1) <= FFA_VERSION_COMPILED) {
+ /*
+ * Return the SPMC ID that was fetched during FF-A
+ * initialization.
+ */
+ ret = (struct ffa_value){.func = FFA_SUCCESS_32,
+ .arg2 = arch_ffa_spmc_id_get()};
+ }
+ return ret;
+}
+
+/**
* This function is called by the architecture-specific context switching
* function to indicate that register state for the given vCPU has been saved
* and can therefore be used by other pCPUs.
@@ -1692,6 +1711,11 @@
case FFA_MSG_SEND_DIRECT_REQ_64:
case FFA_MSG_SEND_DIRECT_REQ_32:
return (struct ffa_value){.func = FFA_SUCCESS_32};
+ /* FF-A v1.1 features. */
+ case FFA_SPM_ID_GET_32:
+ if (MAKE_FFA_VERSION(1, 1) <= FFA_VERSION_COMPILED) {
+ return (struct ffa_value){.func = FFA_SUCCESS_32};
+ }
default:
return ffa_error(FFA_NOT_SUPPORTED);
}