From nobody Wed Apr 8 07:23:57 2026 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=1775126884; cv=none; d=zohomail.com; s=zohoarc; b=kWFDYrtGx1GoBhz/Q0rbBOPMhhrB733XUDF6xnmsPUVNcBh09AXldMsB1JJo+WA+/camS76a8B8ypungQ5gvL3THvBEx74v7Egw51LGNvrSJeBMocLSCvmyUDw3IQT9gAkY42Ymr4L2CSdGp4zA0DFZXtsPq2u+u6iAQ4AxpPHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775126884; 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=E2TvwCSkEBb4iQcEjFfj1UiUN2JVsCuECcxIJOnRftY=; b=hhIOKyrA4VkYvS1xhxs3+qPGg9P1n+QqNceiJf0NYBiKQYvNAdp+EBwiIkLlv1f8zQGrVL/qZAGLr3GS08397BQTHzCDOprpLFlnKPoFmJuWcU1QcwSLPO67n0klmNG6ploYUs4q1JexlwaKDRWuOZQTsLkyvugJEa8UbDgT2U0= 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 1775126884177503.56570612268035; Thu, 2 Apr 2026 03:48:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1271527.1559689 (Exim 4.92) (envelope-from ) id 1w8FaJ-0005RK-PK; Thu, 02 Apr 2026 10:47:35 +0000 Received: by outflank-mailman (output) from mailman id 1271527.1559689; Thu, 02 Apr 2026 10:47:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w8FaJ-0005R1-GB; Thu, 02 Apr 2026 10:47:35 +0000 Received: by outflank-mailman (input) for mailman id 1271527; Thu, 02 Apr 2026 10:47:34 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w8FaI-0005CF-8o for xen-devel@lists.xenproject.org; Thu, 02 Apr 2026 10:47:34 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1w8FaH-009qA7-Lh for xen-devel@lists.xenproject.org; Thu, 02 Apr 2026 12:47:33 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69ce4932-e002-0a2a0a5209dd-0a2a450cd128-40 for ; Thu, 02 Apr 2026 12:47:33 +0200 Received: from [209.85.218.49] (helo=mail-ej1-f49.google.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.0) (envelope-from ) id 69ce4945-f40c-0a2a450c0019-d155da31ad3b-3 for ; Thu, 02 Apr 2026 12:47:33 +0200 Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-b932fe2e1a7so84945766b.1 for ; Thu, 02 Apr 2026 03:47:33 -0700 (PDT) Received: from EPUAKYIW02F7.. ([45.12.26.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b9c3d028955sm76392366b.61.2026.04.02.03.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2026 03:47:32 -0700 (PDT) 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775126853; x=1775731653; 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=E2TvwCSkEBb4iQcEjFfj1UiUN2JVsCuECcxIJOnRftY=; b=jRdeBmAlBkJ9d7HKYA1KQjZt6GAJcV3zxI57FF1bfypMIDOk29Q5LUJt+GfHevhl/6 nmYuLiLgDgR8X8ULKWPvEfzvmF6DKwe2ZT4nIdBDkFZIoieRkoR9ucEPset5ELOvn1J8 PG7OHn8JPTd/jpwwnTLek4JuFDGWcSDEtI8/6DbM/5vFckkImvfT8snl07grHHz0IdgQ EyYUCz8b4MAJXIAH34lcwhi9mgzouWpabG9gf504rCzJAKAmVaQODJqZztl1XTQsw5eY Wvu9WotApk4fkEXZQkrdtjQb+4kuDf7zj6LKQti6G/+Oe2mWQKdP1WDOEx/u2kwCK+X7 28uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775126853; x=1775731653; 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=E2TvwCSkEBb4iQcEjFfj1UiUN2JVsCuECcxIJOnRftY=; b=pk/Sn5S8f6f5Jd+huJEvjmV3RQOfPwM8QPuWz/TjmcxY7vudxAIg3omq8jqiPQTzd4 VgMn8VnTBQVOAmspVxwgvZVcfpkaGFVKwp88tAn0rj8DnnbEZxdLOSaWvfaVjduk0yHn KEDJ6HCHbZpB34hNVQYM910V65Y3tP9Yl0CSyoucGlQlWfI00EmiVZlDFvRDIMSa1pi6 zM232UvmnSBCqQEcDiTy6urGUqug2GvSowLDruMXXRaBTFDie+a4LIcZ1SbEtjGK2vDk p6k2DRAOBDvbrIx1oVM/OfiAE5Klo8BpX22tm/SZJlhjZBF+ImjyNZzl5AiPnVeioR4L cFkg== X-Gm-Message-State: AOJu0YympHjsWZAXTF0MdK44dh71T/9up9yYNAMPEDQmQxYoJFu890aP qXcAI3r0Vij825KpUHSILdSvesOCwfAOaIe3LvKrFueQ9UItrzcADuVNX+crkz6G X-Gm-Gg: ATEYQzzH20BgsMnl/jrvpnZDX9bb31UjHPdYvZk4bTq2i7uhIDxQlRyotzUwPlhDfXY Hpur2q8uikY71dLmP1ENLv1YKoqxmlVUISHpNYq1yTRQ9yTkqUp4NCEmLMOLrStGeZFbeWRR3GI hblxwoVGL4N0EA0bVpQtfDI5I0j4PE3xsTEUM6YQc/tS33Zpbq+4BMh2/Saww2CvBRIBztmzyFs fJKl7JZ1p08CUm6AeTJlRMKNKAXG+c9Kj3TUVbfF0cGl9LZqkG49t53KNd//rwAcupUn+cp28un mDH3CNZEBZS4UP123Ste+aX8DZsv58abKiJkTEd9kr6KC0xmfhlcKYXFgXfKOjZCoAO/b0MK9hk dU6Q26bjiQrbPAzb0Nlx9XM7BZHhVlAcIizkTHYNTK13qX7dvL2kmQQi4ZMAM+okwdcB/TYxHYz BfGe0Dp9K1M0w5VTEg2c9/MxSWIQ== X-Received: by 2002:a17:906:ba84:b0:b94:2648:4672 with SMTP id a640c23a62f3a-b9c13b7bdbemr484677266b.41.1775126852622; Thu, 02 Apr 2026 03:47:32 -0700 (PDT) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mykola Kvach , Volodymyr Babchuk , Bertrand Marquis , Jens Wiklander , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH v8 07/13] xen/arm: ffa: fix notification SRI across CPU hotplug/suspend Date: Thu, 2 Apr 2026 13:45:08 +0300 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d25034/1775126853-81557A3D-86A1C0B4/0/0 X-purgate-type: clean X-purgate-size: 3590 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1775126886635154100 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 186e726412..513c399594 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= ); } =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 ) { /* @@ -376,14 +394,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 { @@ -392,7 +432,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) && @@ -408,13 +447,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