Skip to contentSkip to conversation

xen/arm: ffa: fix bind/unbind notification

PATCH In review Jens Wiklander 3 participants 3 messages Feb 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: ffa: fix bind/unbind notification

The notification bitmask is in passed in the FF-A ABI in two 32-bit registers w3 and w4. The lower 32-bits should go in w3 and the higher in w4. These two registers has unfortunately been swapped for FFA_NOTIFICATION_BIND and FFA_NOTIFICATION_UNBIND in the FF-A mediator. So fix that by using the correct registers.

Fixes b490f470f58d ("xen/arm: ffa: support notification")
---
 xen/arch/arm/tee/ffa_notif.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/tee/ffa_notif.c +4 -4
index 21b9e78f6399..00efaf8f7353 100644
@@ -40,8 +40,8 @@ int ffa_handle_notification_bind(struct cpu_user_regs *regs)
      * We only support notifications from SP so no need to check the sender
      * endpoint ID, the SPMC will take care of that for us.
      */
-    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_hi,
-                           bitmap_lo);
+    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_lo,
+                           bitmap_hi);
 }
 
 int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
@@ -61,8 +61,8 @@ int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
      * We only support notifications from SP so no need to check the
      * destination endpoint ID, the SPMC will take care of that for us.
      */
-    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_hi,
-                            bitmap_lo);
+    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_lo,
+                            bitmap_hi);
 }
 
 void ffa_handle_notification_info_get(struct cpu_user_regs *regs)
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Jens,

Thanks a lot for the finding.

Quoted 10 lines · Jens Wiklander

The notification bitmask is in passed in the FF-A ABI in two 32-bit registers w3 and w4. The lower 32-bits should go in w3 and the higher in w4. These two registers has unfortunately been swapped for FFA_NOTIFICATION_BIND and FFA_NOTIFICATION_UNBIND in the FF-A mediator. So fix that by using the correct registers.

Fixes b490f470f58d ("xen/arm: ffa: support notification")

@Oleksii: This is a fix of a bug, can this be considered for 4.20 ?

Thanks
Bertrand

Quoted 33 lines

---
xen/arch/arm/tee/ffa_notif.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/tee/ffa_notif.c +4 -4
index 21b9e78f6399..00efaf8f7353 100644
@@ -40,8 +40,8 @@ int ffa_handle_notification_bind(struct cpu_user_regs *regs)
     * We only support notifications from SP so no need to check the sender
     * endpoint ID, the SPMC will take care of that for us.
     */
-    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_hi,
-                           bitmap_lo);
+    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_lo,
+                           bitmap_hi);
 }
 
 int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
@@ -61,8 +61,8 @@ int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
     * We only support notifications from SP so no need to check the
     * destination endpoint ID, the SPMC will take care of that for us.
     */
-    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_hi,
-                            bitmap_lo);
+    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_lo,
+                            bitmap_hi);
 }
 
 void ffa_handle_notification_info_get(struct cpu_user_regs *regs)
Signature · 1 line
2.43.0
#2 lore raw

Hi Bertrand,

Quoted 12 lines · Bertrand Marquis

Hi Jens,

Thanks a lot for the finding.

Quoted 8 lines · Jens Wiklander

The notification bitmask is in passed in the FF-A ABI in two 32-bit registers w3 and w4. The lower 32-bits should go in w3 and the higher in w4. These two registers has unfortunately been swapped for FFA_NOTIFICATION_BIND and FFA_NOTIFICATION_UNBIND in the FF-A mediator. So fix that by using the correct registers.

Quoted 5 lines
Quoted 2 lines
Fixes b490f470f58d ("xen/arm: ffa: support notification")

@Oleksii: This is a fix of a bug, can this be considered for 4.20 ?

The fix is straightforward, so let's include this fix in 4.20:

Thanks.

~ Oleksii

Quoted 37 lines

Thanks
Bertrand

Quoted 33 lines

---
xen/arch/arm/tee/ffa_notif.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/tee/ffa_notif.c +4 -4
index 21b9e78f6399..00efaf8f7353 100644
@@ -40,8 +40,8 @@ int ffa_handle_notification_bind(struct cpu_user_regs *regs)
      * We only support notifications from SP so no need to check the sender
      * endpoint ID, the SPMC will take care of that for us.
      */
-    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_hi,
-                           bitmap_lo);
+    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_lo,
+                           bitmap_hi);
 }
 
 int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
@@ -61,8 +61,8 @@ int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
      * We only support notifications from SP so no need to check the
      * destination endpoint ID, the SPMC will take care of that for us.
      */
-    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_hi,
-                            bitmap_lo);
+    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_lo,
+                            bitmap_hi);
 }
 
 void ffa_handle_notification_info_get(struct cpu_user_regs *regs)
Signature · 1 line
2.43.0