[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v14 08/15] xen/arm: ffa: fix notification SRI across CPU hotplug/suspend


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykola Kvach <Mykola_Kvach@xxxxxxxx>
  • Date: Tue, 17 Nov 2026 01:04:44 +0000
  • Accept-language: en-US, uk-UA
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OxbftVabo0Iq95qONmVxYcaUvcbm+FXNrSmc1pXVw5k=; b=d0HBfjV//y/CfOUn8Tnocwq6V4TlYWFQk9c/MjrarxuWz5Xi2uZvyGQcUdWmi1fbsFCQEWOBVBDIW9pmC6Hpr5mSSL5smu0lSNwbIonIt8UeOoNjSLEh5ZBkwlDBRg9aALEI9pthLJkTBzW1WNS3y32c5A+RHhb70meeEIvE2/yG8RhCZ+X61UHh/3FtsXXPxljC1sQKODlDwxfbG15e3ZMgRPMGEfQbBRd9x9tvjxH0E0LNasaYpS0BMU4oeKzorVeYPlcCsnu5pDwdL38eSHdeodfAEL+OCuZXMjIPoJduFDXoNLyw8OD3GE07lT00SC6ege5D4JzzE51IGoMr7w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QNH5M0ByvzUnTm1IphU+LB3LIN6/wI+RpyxE5PmHzDu6xrHctW3ouXTAKoixIM8JdGFTBlxuAY7zhOB5KVDFd77en/w19tF+F6ZSj7omiZQEd92h0TgakyC5vBTe3Y6fm6GpTNmu70y3BqeZCn+9CtDwJWqYoXaf7FrTzhZF71ytJYiRQlYr97Gg/29JhaWQ8k5AJpysUA4a8z8iM4jB6+NX+Q0tq3Wm6+ozK0zrSSTPhrd+SMAM0mwuQ+iQ49zIurQOgDb54Pg6InPgu1LojdRhcbrvZAQQgihu4eSupCEAKPwq6T3pT/ZyX+zj88l07HLIyWxazAf1yY77C4Pukg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Mykola Kvach <Mykola_Kvach@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Jens Wiklander <jenswi@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Luca Fancellu <luca.fancellu@xxxxxxx>
  • Delivery-date: Tue, 17 Nov 2026 01:04:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHddi+hjp7Mzp6lbUSrOd7jaLayGg==
  • Thread-topic: [PATCH v14 08/15] xen/arm: ffa: fix notification SRI across CPU hotplug/suspend

The FF-A notification SRI interrupt handler was not correctly tied to
CPU hotplug and suspend/resume. As a result, CPUs going offline and
back online could end up with stale or missing handlers, breaking
delivery of FF-A notifications.

Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
Changes in V13:
- Use false for free_on_release (MISRA Rule 10.3). No functional change.
- Explicitly discard request_sri_irq()'s result on secondary CPUs. The
  helper logs errors, preserving the existing behavior (MISRA Rule 17.7).
  No functional change.
- Explain why the notifier ignores other CPU events (MISRA Rule 16.4). No
  functional change.
---
 xen/arch/arm/tee/ffa_notif.c | 63 +++++++++++++++++++++++++++++-------
 1 file changed, 51 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
index c64bc39f03..1ec455d2ad 100644
--- a/xen/arch/arm/tee/ffa_notif.c
+++ b/xen/arch/arm/tee/ffa_notif.c
@@ -360,10 +360,28 @@ static int32_t ffa_notification_bitmap_destroy(uint16_t 
vm_id)
     return ffa_simple_call(FFA_NOTIFICATION_BITMAP_DESTROY, vm_id, 0, 0, 0);
 }
 
-void ffa_notif_init_interrupt(void)
+static DEFINE_PER_CPU_READ_MOSTLY(struct irqaction, sri_irq);
+
+static int request_sri_irq(void)
 {
     int ret;
+    struct irqaction *sri_action = &this_cpu(sri_irq);
+
+    sri_action->name = "FF-A notif";
+    sri_action->handler = notif_irq_handler;
+    sri_action->dev_id = NULL;
+    sri_action->free_on_release = false;
+
+    ret = setup_irq(notif_sri_irq, 0, sri_action);
+    if ( ret )
+        printk(XENLOG_ERR "ffa: setup_irq irq %u failed: error %d\n",
+               notif_sri_irq, ret);
+
+    return ret;
+}
 
+void ffa_notif_init_interrupt(void)
+{
     if ( fw_notif_enabled && notif_sri_irq < NR_GIC_SGI )
     {
         /*
@@ -376,14 +394,37 @@ void ffa_notif_init_interrupt(void)
          * pending, while the SPMC in the secure world will not notice that
          * the interrupt was lost.
          */
-        ret = request_irq(notif_sri_irq, 0, notif_irq_handler, "FF-A notif",
-                          NULL);
-        if ( ret )
-            printk(XENLOG_ERR "ffa: request_irq irq %u failed: error %d\n",
-                   notif_sri_irq, ret);
+        (void)request_sri_irq();
+    }
+}
+
+static void deinit_ffa_notif_interrupt(void)
+{
+    if ( fw_notif_enabled && notif_sri_irq < NR_GIC_SGI )
+        release_irq(notif_sri_irq, NULL);
+}
+
+static int cpu_ffa_notif_callback(struct notifier_block *nfb,
+                                  unsigned long action,
+                                  void *hcpu)
+{
+    switch ( action )
+    {
+    case CPU_DYING:
+        deinit_ffa_notif_interrupt();
+        break;
+    default:
+        /* Ignore other CPU events. */
+        break;
     }
+
+    return NOTIFY_DONE;
 }
 
+static struct notifier_block cpu_ffa_notif_nfb = {
+    .notifier_call = cpu_ffa_notif_callback,
+};
+
 void ffa_notif_init(void)
 {
     const struct arm_smccc_1_2_regs arg = {
@@ -416,13 +457,11 @@ void ffa_notif_init(void)
                 return;
             }
         }
-        ret = request_irq(irq, 0, notif_irq_handler, "FF-A notif", NULL);
-        if ( ret )
-        {
-            printk(XENLOG_ERR "ffa: request_irq irq %u failed: error %d\n",
-                   irq, ret);
+
+        if ( request_sri_irq() )
             return;
-        }
+
+        register_cpu_notifier(&cpu_ffa_notif_nfb);
         fw_notif_enabled = true;
     }
 }
-- 
2.53.0

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.