From nobody Wed Sep 23 17:13:09 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=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1777441488; cv=none; d=zohomail.com; s=zohoarc; b=liKMaZVB+lb/k+1EvhJq/3+zCzY6OvzputGSung12DpXCGUzbB473UgPvwnCzH+pGw20yjGFdGMuX6bOtukdJrrR7DVnyl1+bUgOEENDOA2NJ3QdhT/vxRY2tJhkh2fh8pXHBdwIvP66U+7AsTEQe7nrSdd6YZZyLycyUJrQEEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777441488; 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=WKKSczJlZI72MKqmSxli1VuWsQHX4BCNVKQfFoYPfwY=; b=LN2vm6bxuacDHFta3ZHfNgN5ry+U62PfWGQbNHEpJRwbEOe/2h7qFWkpjG6JG9LbkAwMtjh+sW+bD27OLEDotaBj5M9uRx/Upn4Hna4MhOOp9QWVS+bmK8pwzhiwAcVXxFSyAKXtoEF83rx3hmSEwIKAU7HKW4TQSIYMrX2f004= 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 1777441487750179.86066317670281; Tue, 28 Apr 2026 22:44:47 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1296939.1573072 (Exim 4.92) (envelope-from ) id 1wHxiR-00084z-LT; Wed, 29 Apr 2026 05:44:07 +0000 Received: by outflank-mailman (output) from mailman id 1296939.1573072; Wed, 29 Apr 2026 05:44:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wHxiR-00084s-Ia; Wed, 29 Apr 2026 05:44:07 +0000 Received: by outflank-mailman (input) for mailman id 1296939; Wed, 29 Apr 2026 05:44:06 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wHxiQ-00084I-MM for xen-devel@lists.xenproject.org; Wed, 29 Apr 2026 05:44:06 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wHxiQ-003p6b-21 for xen-devel@lists.xenproject.org; Wed, 29 Apr 2026 07:44:06 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69f19aa3-e002-0a2a0a5209dd-0a2a450ae8ea-2 for ; Wed, 29 Apr 2026 07:44:06 +0200 Received: from [217.140.110.172] (helo=foss.arm.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTP (eXpurgate 4.56.1) (envelope-from ) id 69f19aa5-56b3-0a2a450a0019-d98c6eac86d2-1 for ; Wed, 29 Apr 2026 07:44:05 +0200 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 209DA2BCE; Tue, 28 Apr 2026 22:43:59 -0700 (PDT) Received: from C3HXLD123V.arm.com (unknown [10.57.90.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3EAE33F62B; Tue, 28 Apr 2026 22:44:03 -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=foss header.d=arm.com header.i="@arm.com" header.h="From:To:Cc:Subject:Date:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1777441444; bh=D0cWhXb5cOQnh67SWhy+Xw1f5uxdZNslX4hyB6LTlbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mP5yOT8W5xF9s2AHoIo0HBtQluRfUBB5R3yG9h/hpcntrzT1TI4lVdaFvPbZ22Ua2 mIvQ9MiuE5m5zwRgaUmg3JSK4ROlrF2xVxlIYmLWlag0x2D6lASoV+qnRQZWc/5ccr bsi8k3W4LWPaLtKHmF2ZECs1o56euNT4DIGSZ11A= From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Volodymyr Babchuk , Jens Wiklander , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH v2 1/6] xen/arm: ffa: Fix NPI injection when vcpu0 is offline Date: Wed, 29 Apr 2026 07:43:22 +0200 Message-ID: <2a36253fca9c23681fea0d5493faeb3044de558d.1776955622.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-4011c0/1777441446-4415A8B7-5EAC21DC/0/0 X-purgate-type: clean X-purgate-size: 3404 X-ZohoMail-DKIM: pass (identity @arm.com) X-ZM-MESSAGEID: 1777441490106158500 Content-Type: text/plain; charset="utf-8" RX-buffer-full notifications currently inject the notification pending interrupt through vcpu0 only. Secure notification delivery already walks the domain's online vCPUs, but the RX-buffer-full path does not. When vcpu0 is offline, the notification remains pending and the guest never receives it. Extract the common notification injection path and reuse it from ffa_raise_rx_buffer_full(). The shared helper delivers the global notification to the first online vCPU and keeps the existing ratelimited debug message when none are online. Functional impact: RX-buffer-full notifications are delivered even when vcpu0 is offline. Fixes: 3935c705688e ("xen/arm: ffa: Add buffer full notification support") Signed-off-by: Bertrand Marquis Reviewed-by: Jens Wiklander --- Changes since v1: - add R-b from Jens --- xen/arch/arm/tee/ffa_notif.c | 45 ++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c index 186e72641237..07bc5cb3a430 100644 --- a/xen/arch/arm/tee/ffa_notif.c +++ b/xen/arch/arm/tee/ffa_notif.c @@ -19,6 +19,29 @@ static bool __ro_after_init fw_notif_enabled; static unsigned int __ro_after_init notif_sri_irq; =20 +static void inject_notif_pending(struct domain *d) +{ + struct vcpu *v; + + /* + * Since we're only delivering global notification, always + * deliver to the first online vCPU. It doesn't matter + * which we chose, as long as it's available. + */ + for_each_vcpu(d, v) + { + if ( is_vcpu_online(v) ) + { + vgic_inject_irq(d, v, GUEST_FFA_NOTIF_PEND_INTR_ID, true); + return; + } + } + + if ( printk_ratelimit() ) + printk(XENLOG_G_DEBUG "%pd: ffa: can't inject NPI, all vCPUs offli= ne\n", + d); +} + int32_t ffa_handle_notification_bind(struct cpu_user_regs *regs) { struct domain *d =3D current->domain; @@ -190,7 +213,7 @@ void ffa_raise_rx_buffer_full(struct domain *d) =20 ACCESS_ONCE(ctx->notif.buff_full_pending) =3D true; if ( !test_and_set_bool(ctx->notif.vm_pending) ) - vgic_inject_irq(d, d->vcpu[0], GUEST_FFA_NOTIF_PEND_INTR_ID, true); + inject_notif_pending(d); } #endif =20 @@ -238,7 +261,6 @@ static void notif_vm_pend_intr(uint16_t vm_id) { struct ffa_ctx *ctx; struct domain *d; - struct vcpu *v; =20 /* * vm_id =3D=3D 0 means a notifications pending for Xen itself, but @@ -277,24 +299,7 @@ static void notif_vm_pend_intr(uint16_t vm_id) * it. */ ACCESS_ONCE(ctx->notif.secure_pending) =3D true; - - /* - * Since we're only delivering global notification, always - * deliver to the first online vCPU. It doesn't matter - * which we chose, as long as it's available. - */ - for_each_vcpu(d, v) - { - if ( is_vcpu_online(v) ) - { - vgic_inject_irq(d, v, GUEST_FFA_NOTIF_PEND_INTR_ID, - true); - break; - } - } - if ( !v && printk_ratelimit() ) - printk(XENLOG_G_DEBUG "%pd: ffa: can't inject NPI, all vCPUs offli= ne\n", - d); + inject_notif_pending(d); =20 out_unlock: rcu_unlock_domain(d); --=20 2.53.0