From nobody Sun Dec 14 12:38:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1765478777; cv=none; d=zohomail.com; s=zohoarc; b=OveKeJOLk+Y00++zyhKAVLW2MrVd0vwXfRXkwx0Y7WneEcCA9S5G29Bm14NXle/lSBpIU0IBG3Ururaf17U3obSuQ5JEypl7CpYvVoIiuj6SQMn0LkcsL8igGydQ+0Rw6iBatG1Yn+uHGlzWQJsNLsohnNmFw2KXC/tKO5avsnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765478777; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rz0HDghJ0IsRbhxCGz59UWa71x4c1jNbwB3bP+NDcUo=; b=U9VK/3apy21Px+FPLSKSCvoOwfgXHy9Y9QMfYH6rI2n691korDHwh4hmRWyYKU5THEnYreoqZqZKh5Bwj7dhXVj8O95nhnCWNdlof2QfowimzShvTTHFCjrnNkS+0VXANnvvUTI8ARVuwU9hoRBWXqvL57MrQBEmH+wph1o3AF8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765478777410735.0840076736492; Thu, 11 Dec 2025 10:46:17 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184551.1507010 (Exim 4.92) (envelope-from ) id 1vTlfq-0004aO-7M; Thu, 11 Dec 2025 18:45:58 +0000 Received: by outflank-mailman (output) from mailman id 1184551.1507010; Thu, 11 Dec 2025 18:45:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTlfq-0004Yl-0K; Thu, 11 Dec 2025 18:45:58 +0000 Received: by outflank-mailman (input) for mailman id 1184551; Thu, 11 Dec 2025 18:45:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTlfo-0003I8-4x for xen-devel@lists.xenproject.org; Thu, 11 Dec 2025 18:45:56 +0000 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [2a00:1450:4864:20::52d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a01b52bc-d6c1-11f0-b15b-2bf370ae4941; Thu, 11 Dec 2025 19:45:55 +0100 (CET) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-64198771a9bso828655a12.2 for ; Thu, 11 Dec 2025 10:45:55 -0800 (PST) Received: from EPUAKYIW02F7.. (pool185-5-253-4.as6723.net. [185.5.253.4]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b7cfa5d0b0dsm345870466b.67.2025.12.11.10.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 10:45:53 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a01b52bc-d6c1-11f0-b15b-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765478754; x=1766083554; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rz0HDghJ0IsRbhxCGz59UWa71x4c1jNbwB3bP+NDcUo=; b=KWAP0RRJySseb9OVoG9E0sONatv2MyeoRDoINiWn5kEZFyOflwwtu+K24cGS/JGwvf cB8xYP4HD2EOYzynuOHeaH8kiaGE2IdFCM2e5wLBiK6aiGdL1c+DBCkmJWJPykI9c3+G UcMZBC+hp6K/wQKLiBiC9vz2ao0fc3zGUUK3BChJAAtS3Iclc9Ev10yHV8wZijQrWEgM O8D6KTkrvLytYSXbpFNYOZGQwOnj/IkfWcMhGf5Xck9SJYfZdxwvXF4uq38daF0dGiWn 5VwB8ty8FJGzSqxuxPCnVYxQYP2r+U3SSMekclraC7LahhbOU6080hh9sW1nhKnSQt+0 Lm+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765478754; x=1766083554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rz0HDghJ0IsRbhxCGz59UWa71x4c1jNbwB3bP+NDcUo=; b=mv/CYCTkYF9jRrfWz+mg5DrFKpbUa4utNb4yYurniQy6KS6xe3p3fu1Tn/BhSjeoO8 hPuekvHJBta5NOwEpym5VtjUvwXZaO6Pya8ZA9uBUuVv2HRjBMT7YFCeRshAk8nrBm8f ILYjpjYMmttNYJ9NLZo8AdOy/5d0OimgDu9O7+ZGdEX4g0LtTCQRPrIilgAlVj7iyuaM d6kSBChLRk5WFFktDJVNSNcT9iaZa4KvoYq7OYjBknsHX5qhMBAHCgBJ6JQmwjdCcX36 VeTl/YRNGIh82gAcZSQaz1ZfeBoMEMuoTHZAgaiBWEtQm8S5EuxwB27BE7C3VLGqkGyq PSMQ== X-Gm-Message-State: AOJu0YzlWglAbmOLPGN6BCgVRHFkvRcJKSI75FU/eet+SPubCddsXWsq kYtkSrULFN+JEs/IBbY2iCv9hrmzAlqYkhRVdxkY+1IJauf5q8f4dUCEdj2BNOnG X-Gm-Gg: AY/fxX4NhdNTr/e3Zgc7eNMFQOFtW8aNvrISRLSMFpBOgYNiBOy8Mtx+yJDGfOaPDk5 gowerT8pXLspaPhdfAp3eVqx3c845Fgbhd7LpaCrnxlXolNjT9iSCRq6371Q7nAl5h+tKXDFulI 9rh2CXQHeZ8cYwfGllARLcopXcKH9pRS23xWtYegrLC+AtSipkrAyLCW3ZPCyTYJY8VTOztnKLX AuHnO2365P1dlHVoyZ+/A9CfVQNkyE2z6ikLABRejusviHeSCG51ANFU9eY7H6KSzsqF0zcpZnb klkcZ9oKUmH6saCMa/H9kRv9rjGh60KUHCNED9mP7dYA/Qy037mL3rRvpodJiHjjd+/3T6zuR3t mYLcZkz5yuVxZOe9vslkBN3q/pgt9LTIv7VUWdRI6cK6Z6Tf8mr9CErSa8u44mYZlPv62RMpd2R +qmoSAQzpFaP7n7u3wBgIbVUVFl7TyGJGOj7gb+Yst X-Google-Smtp-Source: AGHT+IFl62FZ0FgJSyr4XEZouQeIWhJVM6kfXy3OW7rtGR1k5t90f62MNqwbncILJbOinFyLpJdUeA== X-Received: by 2002:a17:907:d10:b0:b73:210a:44e with SMTP id a640c23a62f3a-b7ce8414319mr770611666b.30.1765478754270; Thu, 11 Dec 2025 10:45:54 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mykola Kvach , Mykola Kvach , Volodymyr Babchuk , Bertrand Marquis , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH v7 06/12] xen/arm: ffa: fix notification SRI across CPU hotplug/suspend Date: Thu, 11 Dec 2025 20:43:30 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1765478778515158500 Content-Type: text/plain; charset="utf-8" From: Mykola Kvach 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 --- xen/arch/arm/tee/ffa_notif.c | 63 ++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c index 86bef6b3b2..84f5c6b43b 100644 --- a/xen/arch/arm/tee/ffa_notif.c +++ b/xen/arch/arm/tee/ffa_notif.c @@ -359,10 +359,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= ); } =20 -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 =3D &this_cpu(sri_irq); + + sri_action->name =3D "FF-A notif"; + sri_action->handler =3D notif_irq_handler; + sri_action->dev_id =3D NULL; + sri_action->free_on_release =3D 0; + + ret =3D 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); =20 + return ret; +} + +void ffa_notif_init_interrupt(void) +{ if ( fw_notif_enabled && notif_sri_irq < NR_GIC_SGI ) { /* @@ -375,14 +393,36 @@ void ffa_notif_init_interrupt(void) * pending, while the SPMC in the secure world will not notice that * the interrupt was lost. */ - ret =3D request_irq(notif_sri_irq, 0, notif_irq_handler, "FF-A not= if", - NULL); - if ( ret ) - printk(XENLOG_ERR "ffa: request_irq irq %u failed: error %d\n", - notif_sri_irq, ret); + request_sri_irq(); } } =20 +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: + break; + } + + return NOTIFY_DONE; +} + +static struct notifier_block cpu_ffa_notif_nfb =3D { + .notifier_call =3D cpu_ffa_notif_callback, +}; + void ffa_notif_init(void) { const struct arm_smccc_1_2_regs arg =3D { @@ -391,7 +431,6 @@ void ffa_notif_init(void) }; struct arm_smccc_1_2_regs resp; unsigned int irq; - int ret; =20 /* Only enable fw notification if all ABIs we need are supported */ if ( ffa_fw_supports_fid(FFA_NOTIFICATION_BITMAP_CREATE) && @@ -407,13 +446,11 @@ void ffa_notif_init(void) notif_sri_irq =3D irq; if ( irq >=3D NR_GIC_SGI ) irq_set_type(irq, IRQ_TYPE_EDGE_RISING); - ret =3D 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 =3D true; } } --=20 2.43.0