From nobody Thu Aug 27 00:01:43 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=1776433311; cv=none; d=zohomail.com; s=zohoarc; b=WGDwUy8XBnlwgdyvNGSYxrjnb7B48T1KUrwrEMa8zgpZh63rBo+2RNhNkMARo40x6gCH/miMeKu/mVFYN6bmLRHsTZlVFqNvIL75t34eYNWbrGzI8ikEqHa1cyXQkVucnV7fnhTvUIqCuzNVX/pCD8febVFbdBpsCculO6oICNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776433311; 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=s8TiP1VE/kX/ko3XO+ANZI/AhKbokBHo65rxmjG3vCk=; b=FV8v0/EwLD/j4XGnYn9dOmg/rNN43oFei5dZEpF660AkW5rW+ChRfNlFQSknWhO5O1Y1fPIqZGrDAvG2iB5udc7kySAi+RQ6gHHxJ+CyTD/Djts69UUFdrcDRX7iZ/7ubVxSP51amNLAQrQieyFL8c8eEwA+uhET4rgrKlwOmco= 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 1776433310950745.5822573104992; Fri, 17 Apr 2026 06:41:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1284300.1566123 (Exim 4.92) (envelope-from ) id 1wDjRr-0005Xi-G5; Fri, 17 Apr 2026 13:41:31 +0000 Received: by outflank-mailman (output) from mailman id 1284300.1566123; Fri, 17 Apr 2026 13:41:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wDjRr-0005Xb-C4; Fri, 17 Apr 2026 13:41:31 +0000 Received: by outflank-mailman (input) for mailman id 1284300; Fri, 17 Apr 2026 13:41:30 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wDjRq-0005XG-DB for xen-devel@lists.xenproject.org; Fri, 17 Apr 2026 13:41:30 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wDjRp-000Ejb-QG for xen-devel@lists.xenproject.org; Fri, 17 Apr 2026 15:41:29 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69e23869-5cb7-0a2a0a5109dd-0a2a450688f0-46 for ; Fri, 17 Apr 2026 15:41:29 +0200 Received: from [217.140.110.172] (helo=foss.arm.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTP (eXpurgate 4.56.1) (envelope-from ) id 69e23888-7371-0a2a45060019-d98c6eacc488-1 for ; Fri, 17 Apr 2026 15:41:29 +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 BFB2E1E5E; Fri, 17 Apr 2026 06:41:22 -0700 (PDT) Received: from C3HXLD123V.arm.com (unknown [10.57.89.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 164583F7D8; Fri, 17 Apr 2026 06:41:26 -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=1776433288; bh=2EBHRYe3a9Iu2Tcg1hgwEsSiL6lkKJcFnxNSP9Ue5No=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VdYJxFcLI4jsdEtYZSOcScludKGT5YwwMuMO0TwaaXWi1Hgkxt892Fotc+CN25Arq uRpUQYMjXbKpDSE5fOBcWIAD9XE8w9J02CloxF0T26Qh7gFylIzux2q+Ro2n5PIvfA P811XWtiGYC16BhHODf+4AbWTwWhWzSMWGbofGO0= From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Volodymyr Babchuk , Jens Wiklander , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH 1/6] xen/arm: ffa: Fix NPI injection when vcpu0 is offline Date: Fri, 17 Apr 2026 15:40:49 +0200 Message-ID: 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-16d1c6/1776433289-52369D75-B7400893/0/0 X-purgate-type: clean X-purgate-size: 3302 X-ZohoMail-DKIM: pass (identity @arm.com) X-ZM-MESSAGEID: 1776433311513158500 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 --- 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