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

Re: [PATCH 1/6] xen/arm: ffa: Fix NPI injection when vcpu0 is offline


  • To: Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • From: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • Date: Wed, 22 Apr 2026 10:04:31 +0200
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4rKad+UxzUkxCopKUoZk2Ve1GRQCNyIIC91C5R5IU0E=; fh=wNLC6Hyb5Ukz/ErppBRQBwv8vwa/OMsdh6R8bnNsiPU=; b=RtGFfiaf70Eey0klBuoJxeZBvIHzAD0u6097Rp4AEfY4ABeqKJbdfFGdfBBpr68tYQ W/mJeaHqKylpOn0bXuq+fR7sg5td5YxHo8k2oCIKcgd/NEP3drWAmHiHwVy1vgfQ8qon JpE8YlSI3WCGEf6/8xrOD/imQwoENXpYrG6QE4NqPkLJC4SUaOxCIHl9c2ZGG075Wqv0 MZg5+VZCy4DKSyaoEK3KkHWDcIH2u2EY5d79KwHCkoNurdcHF4g56PigwZJKTY62AJ9b EhNvtIwlkcXLQtXFI5lQOeWiy8YGi5WJC8c362igNL8SqcN3HjSDGvOYOqIw1cvaPBj3 7sHQ==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1776845083; cv=none; d=google.com; s=arc-20240605; b=QeFhT7zu+TQ8SpWPQ2j2vkq5+wXfz3+w4ct/+k1jTFUW06cG+4ic0tPC+92S/AQmZU uapKZrdfVobxabZVHCZ/sFwxM5PevrYCMRp0dQWRiBSFmyxpOr2u15V8gsAnS/ZkYOAn tuugwVJPiXkjfHstxws7oI8BZhfZyyneJHVIMRH9bznJNASTpXBtAGoVoGelYgNsxEd8 ho3e+3j+IATpjpVU0ip5E7gSbuuC0aNIuUc1YbZyV+bNIQGOrMTdN+4edD5q2eknY78J Rs2bJPSc6GX3ZqQ9l+RbHk8hlqf7V85DwFQaXWyciZ6Ofsc5nBePitXyaZ1t+Ufap96N TRNA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=linaro.org header.i="@linaro.org" header.h="Content-Transfer-Encoding:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Wed, 22 Apr 2026 08:05:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Bertrand,

On Fri, Apr 17, 2026 at 3:41 PM Bertrand Marquis
<bertrand.marquis@xxxxxxx> wrote:
>
> 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 <bertrand.marquis@xxxxxxx>
> ---
>  xen/arch/arm/tee/ffa_notif.c | 45 ++++++++++++++++++++----------------
>  1 file changed, 25 insertions(+), 20 deletions(-)

Looks good:
Reviewed-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>

Cheers,
Jens

>
> 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;
>
> +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 
> offline\n",
> +               d);
> +}
> +
>  int32_t ffa_handle_notification_bind(struct cpu_user_regs *regs)
>  {
>      struct domain *d = current->domain;
> @@ -190,7 +213,7 @@ void ffa_raise_rx_buffer_full(struct domain *d)
>
>      ACCESS_ONCE(ctx->notif.buff_full_pending) = 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
>
> @@ -238,7 +261,6 @@ static void notif_vm_pend_intr(uint16_t vm_id)
>  {
>      struct ffa_ctx *ctx;
>      struct domain *d;
> -    struct vcpu *v;
>
>      /*
>       * vm_id == 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) = 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 
> offline\n",
> -               d);
> +    inject_notif_pending(d);
>
>  out_unlock:
>      rcu_unlock_domain(d);
> --
> 2.53.0
>



 


Rackspace

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