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

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


  • To: Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • From: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • Date: Thu, 26 Nov 2026 01:40:13 +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-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pttVqjM6IwRkpX6Ilg7/uYkQQAtqqrWRDOkoXNgBO5k=; fh=F3RNbjY7HGhv1K80flmiFZpRiz/hLFdWKtGPVcWuod8=; b=WhU5bmSDxyCz4xf+H1+YmjSoKj8uEbJ4Qb91ihuoEhl8f6FSr0N7OvYKlhSQcqrUSZ JMq18OgaaAZCPAl4XMy1pBMYpGYB/MnO6S4yisiPXESUOyU2xOGZb8ZCLutKpgJW7Znn cyGUd8GRtsD0dvC5xee+aotPhUsYA4xQcbyjeo4LJC6M9RlrKxonzIphGTVKmcadSCVR qpI7PCF+IeJibLLjeKnm9leJodE0C4URlf9j3np6mLEC9OQvST/TxsIe2rCxjYd6NKHw V5JwinMgJNyP5N9QBF48kUYJcaa3L5rOCXlWJJbo13SYOa1+xVpZeeUcZ7IuDR4wZcse cN6A==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1795650024; cv=none; d=google.com; s=arc-20260327; b=DmZpDI+SO7Gbef5V4TXiXMHnO8TGrm153Q7ze3FFJYNovYL4qKMhzy0KRMdBR+KQae ZBHd1rZcanxw2F2n/uVV68eX603vgOnGsm8F0GcCvD5IBANWZRwbmdud1mL99sPoA/Cs uqfuT0nQdIkHnkUZ/CW80LUucclh53o+nIzBVteFnWiAMPgaTiU+j6Rg49ysjdvyB2Pp AmIwKuTJzMoRUXGJPMmBJcmhJP0DAJKgPNqdkKNMg6+3wMUxfQ3ZE+Xs0Ohd1DGTphLl m8xabffRr6bF7KwzFUMAKXvYkdOhCAghq8kxfx30CgnAg79VZPHl+21mcOt0JOvUQjKV x4Kw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20260707 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Jens Wiklander <jenswi@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • Delivery-date: Wed, 25 Nov 2026 23:40:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Bertrand,

Thank you for the patch.

On Thu, Sep 3, 2026 at 5:43 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>
> Reviewed-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>

Acked-by: Mykola Kvach <mykola_kvach@xxxxxxxx>

Best regards,
Mykola

> ---
> Changes since v2:
> - none
> 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;
>
> +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®.