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

Re: [PATCH v8 07/13] xen/arm: ffa: fix notification SRI across CPU hotplug/suspend


  • To: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • Date: Tue, 5 May 2026 13:18:40 +0300
  • 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=q1U65eNbtkKV3mllMX338BcDp2zbFoL57vU+Lzv7wek=; fh=WN+dxI8BWGEvyCtKTDN97slsPx57wxpKUn64COmgY4w=; b=Q2eOkKdXXoLgj064lx4wOadPryifRWHY4IYe2Pdl+yGK9LU3WXVtg5GbAwRbewuGmo wgh5zZ1GWvE6B60Fa9wPNYix4w7J/Id8N+DyOK3BCoZmMKTJnc9XViMIOGGVV4HmVN+w L4Yn3GpKc4tFwe4strJunnd+l1cpmzPq5xXwNdYKVnsHGyIsEYPxdYZgys+Ffo8WrY+r wuNcA0JNeBKUr/nV+aDfEiLC0FYxzT87Mj/HYuYJklQstkFbPVJniK1vkXlkb9k7a5bp 195cRTS6CHHoPEnTDSMmjvOUqYFbrw9m2mI7HZvQLmGCh0gYxCia1EO8OH1ADeVA4AD8 ET/w==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1777976331; cv=none; d=google.com; s=arc-20240605; b=BfQWkc4/422jcjKOTZ12kLrhm4JOz5Z3OHk/amvD1UQ9ENI45elsF7q/cJq9pjNQTt U8i2aTP+D3d8KjT6uSZTWKp0HuQd2mpWnEni9fIzBOomimgIxljjbco8hkliVi8IRU7m mgOHFqDb17Hu4dnxD3CefqWv5yq7FI6pbW9SrSXSJHsO1fUgvTGFQ12zBmYMTLTEADiZ 6tG42QyxEsVwpra9GUUX4kpLn57XDoQGiR7zrTeZNrVjGWSwFvd7znVLX2hRLHIDBKM4 7+BCcoTlgHklhFthdhwmsS9AQRiIIztHqB9Xmt7HJ4jy35rr9TqWJWzBaJjHUq43qI41 nCUQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Jens Wiklander <jens.wiklander@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Tue, 05 May 2026 10:18:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Bertrand,

Thank you for the review.

On Mon, Apr 27, 2026 at 11:22 AM Bertrand Marquis
<Bertrand.Marquis@xxxxxxx> wrote:
>
> Hi Mykola,
>
> > On 2 Apr 2026, at 12:45, Mykola Kvach <xakep.amatop@xxxxxxxxx> wrote:
> >
> > From: Mykola Kvach <mykola_kvach@xxxxxxxx>
> >
> > 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 <mykola_kvach@xxxxxxxx>
>
> This will probably need a rebase if the harden notification and VM to VM 
> notification
> serie in FF-A is merged first.

I will rebase this patch if the FF-A notification series lands first.

>
> Anyway, changes look good so:
>
> Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Thank you, I will add your Reviewed-by.

Best regards,
Mykola

>
> Cheers
> Bertrand
>
> > ---
> > 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);
> > }
> >
> > -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 = &this_cpu(sri_irq);
> > +
> > +    sri_action->name = "FF-A notif";
> > +    sri_action->handler = notif_irq_handler;
> > +    sri_action->dev_id = NULL;
> > +    sri_action->free_on_release = 0;
> > +
> > +    ret = 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);
> >
> > +    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 = request_irq(notif_sri_irq, 0, notif_irq_handler, "FF-A 
> > notif",
> > -                          NULL);
> > -        if ( ret )
> > -            printk(XENLOG_ERR "ffa: request_irq irq %u failed: error %d\n",
> > -                   notif_sri_irq, ret);
> > +        request_sri_irq();
> >     }
> > }
> >
> > +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 = {
> > +    .notifier_call = cpu_ffa_notif_callback,
> > +};
> > +
> > void ffa_notif_init(void)
> > {
> >     const struct arm_smccc_1_2_regs arg = {
> > @@ -392,7 +432,6 @@ void ffa_notif_init(void)
> >     };
> >     struct arm_smccc_1_2_regs resp;
> >     unsigned int irq;
> > -    int ret;
> >
> >     /* 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 = irq;
> >         if ( irq >= NR_GIC_SGI )
> >             irq_set_type(irq, IRQ_TYPE_EDGE_RISING);
> > -        ret = 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 = true;
> >     }
> > }
> > --
> > 2.43.0
> >
>



 


Rackspace

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