]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
xen/arm: ffa: Remove per VM notif_enabled
authorBertrand Marquis <bertrand.marquis@arm.com>
Wed, 27 Nov 2024 16:07:41 +0000 (17:07 +0100)
committerJulien Grall <julien@xen.org>
Mon, 16 Dec 2024 20:04:17 +0000 (21:04 +0100)
Remove the per VM flag to store if notifications are enabled or not as
the only case where they are not, if notifications are enabled globally,
will make the VM creation fail.
Also use the opportunity to always give the notifications interrupts IDs
to VM. If the firmware does not support notifications, there won't be
any generated and setting one will give back a NOT_SUPPORTED.

Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
xen/arch/arm/tee/ffa.c
xen/arch/arm/tee/ffa_notif.c
xen/arch/arm/tee/ffa_private.h

index 8488fe6af9c04856237780329df562d5af77d7c8..04d2403415fee21acf1b67534f3d611ec05d23b5 100644 (file)
@@ -169,8 +169,6 @@ static void handle_version(struct cpu_user_regs *regs)
 
 static void handle_features(struct cpu_user_regs *regs)
 {
-    struct domain *d = current->domain;
-    struct ffa_ctx *ctx = d->arch.tee;
     uint32_t a1 = get_user_reg(regs, 1);
     unsigned int n;
 
@@ -218,16 +216,10 @@ static void handle_features(struct cpu_user_regs *regs)
         ffa_set_regs_success(regs, 0, 0);
         break;
     case FFA_FEATURE_NOTIF_PEND_INTR:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0);
         break;
     case FFA_FEATURE_SCHEDULE_RECV_INTR:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
         break;
 
     case FFA_NOTIFICATION_BIND:
@@ -236,10 +228,7 @@ static void handle_features(struct cpu_user_regs *regs)
     case FFA_NOTIFICATION_SET:
     case FFA_NOTIFICATION_INFO_GET_32:
     case FFA_NOTIFICATION_INFO_GET_64:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, 0, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, 0, 0);
         break;
     default:
         ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
index 4b3e46318f4befccee40346917e28a3237603c57..21b9e78f6399951b397b0354482e8c9d2227e10c 100644 (file)
@@ -405,7 +405,6 @@ void ffa_notif_init(void)
 
 int ffa_notif_domain_init(struct domain *d)
 {
-    struct ffa_ctx *ctx = d->arch.tee;
     int32_t res;
 
     if ( !notif_enabled )
@@ -415,18 +414,15 @@ int ffa_notif_domain_init(struct domain *d)
     if ( res )
         return -ENOMEM;
 
-    ctx->notif.enabled = true;
-
     return 0;
 }
 
 void ffa_notif_domain_destroy(struct domain *d)
 {
-    struct ffa_ctx *ctx = d->arch.tee;
-
-    if ( ctx->notif.enabled )
-    {
+    /*
+     * Call bitmap_destroy even if bitmap create failed as the SPMC will
+     * return a DENIED error that we will ignore.
+     */
+    if ( notif_enabled )
         ffa_notification_bitmap_destroy(ffa_get_vm_id(d));
-        ctx->notif.enabled = false;
-    }
 }
index 02162e0ee4c7520be4a6ed42bdc28ae48cfff0ac..973ee55be09bad103da90786932885bb482c26f1 100644 (file)
@@ -281,8 +281,6 @@ struct ffa_mem_region {
 };
 
 struct ffa_ctx_notif {
-    bool enabled;
-
     /*
      * True if domain is reported by FFA_NOTIFICATION_INFO_GET to have
      * pending global notifications.