fix: FFA_VERSION checks compatibility rules
Check that FFA_VERSION requested by the SP is compatible.
If it isn't don't save its value.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I91d87c630d522ae122716f9fd3f0196705b7732a
diff --git a/src/api.c b/src/api.c
index f7a39a1..2805fef 100644
--- a/src/api.c
+++ b/src/api.c
@@ -2437,6 +2437,14 @@
return (struct ffa_value){.func = (uint32_t)FFA_NOT_SUPPORTED};
}
+ if ((requested_version >> FFA_VERSION_MAJOR_OFFSET) !=
+ FFA_VERSION_MAJOR ||
+ requested_version > FFA_VERSION_COMPILED) {
+ dlog_error("Version %x incompatible with %x\n",
+ requested_version, FFA_VERSION_COMPILED);
+ return (struct ffa_value){.func = (uint32_t)FFA_NOT_SUPPORTED};
+ }
+
current_vm_locked = vm_lock(current->vm);
current_vm_locked.vm->ffa_version = requested_version;
vm_unlock(¤t_vm_locked);