fix: invalid ID in bitmap create/destroy
As per FF-A v1.2 the FFA_NOTIFICATION_BITMAP_CREATE/DESTROY
interfaces must return FFA_INVALID_PARAMETERS when provided
with an invalid partition ID.
The interfaces expect valid NWd FF-A IDs.
Renamed validity function to better cater for the use in both
FFA_NOTIFICATION_BITMAP_CREATE/FFA_NOTIFICATION_BITMAP_DESTROY.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Icd2a96a3899fd5c8ccfa52c68d6a0992fd890042
diff --git a/src/api.c b/src/api.c
index 15addc8..70459d7 100644
--- a/src/api.c
+++ b/src/api.c
@@ -3733,10 +3733,15 @@
ffa_vcpu_count_t vcpu_count,
struct vcpu *current)
{
- if (!plat_ffa_is_notifications_create_valid(current, vm_id)) {
- dlog_verbose("Bitmap create for NWd VM IDs only (%x).\n",
- vm_id);
- return ffa_error(FFA_NOT_SUPPORTED);
+ const struct ffa_value ret =
+ plat_ffa_is_notifications_bitmap_access_valid(current, vm_id);
+
+ if (ffa_func_id(ret) != FFA_SUCCESS_32) {
+ dlog_verbose(
+ "FFA_NOTIFICATION_BITMAP_CREATE to be used by "
+ "hypervisor for valid NWd VM IDs only (%x).\n",
+ vm_id);
+ return ret;
}
return plat_ffa_notifications_bitmap_create(vm_id, vcpu_count);
@@ -3745,13 +3750,15 @@
struct ffa_value api_ffa_notification_bitmap_destroy(ffa_id_t vm_id,
struct vcpu *current)
{
- /*
- * Validity of use of this interface is the same as for bitmap create.
- */
- if (!plat_ffa_is_notifications_create_valid(current, vm_id)) {
- dlog_verbose("Bitmap destroy for NWd VM IDs only (%x).\n",
- vm_id);
- return ffa_error(FFA_NOT_SUPPORTED);
+ const struct ffa_value ret =
+ plat_ffa_is_notifications_bitmap_access_valid(current, vm_id);
+
+ if (ffa_func_id(ret) != FFA_SUCCESS_32) {
+ dlog_verbose(
+ "FFA_NOTIFICATION_BITMAP_DESTROY to be used by "
+ "hypervisor for valid NWd VM IDs only (%x).\n",
+ vm_id);
+ return ret;
}
return plat_ffa_notifications_bitmap_destroy(vm_id);