feat(ff-a): save partitions version during ffa_version
This will be useful later when we may need to consider the version
of a partition when structuring a response to certain FF-A functions.
Also add a call to FFA_VERSION during initialization of the hypervisor
so the SPMC knows the hypervisors implemented version.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: Ia8f5f8a9589300311a1e129536acce0948d5a6bc
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index c0d8c28..9bedee8 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -485,7 +485,7 @@
*/
switch (func) {
case FFA_VERSION_32:
- *args = api_ffa_version(args->arg1);
+ *args = api_ffa_version(current, args->arg1);
return true;
case FFA_PARTITION_INFO_GET_32: {
struct ffa_uuid uuid;
diff --git a/src/arch/aarch64/plat/ffa/hypervisor.c b/src/arch/aarch64/plat/ffa/hypervisor.c
index 4d0e349..b8489e3 100644
--- a/src/arch/aarch64/plat/ffa/hypervisor.c
+++ b/src/arch/aarch64/plat/ffa/hypervisor.c
@@ -76,6 +76,17 @@
arch_ffa_init();
+ /*
+ * Call FFA_VERSION so the SPMC can store the hypervisor's
+ * version. This may be useful if there is a mismatch of
+ * versions.
+ */
+ ret = arch_other_world_call((struct ffa_value){
+ .func = FFA_VERSION_32, .arg1 = FFA_VERSION_COMPILED});
+ if (ret.func == (uint32_t)FFA_NOT_SUPPORTED) {
+ panic("Hypervisor and SPMC versions are not compatible.\n");
+ }
+
/* Setup TEE VM RX/TX buffers */
other_world_vm->mailbox.send = &other_world_send_buffer;
other_world_vm->mailbox.recv = &other_world_recv_buffer;