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

Re: [PATCH] xen/drivers/char: fix SCIF IRQ registration failure propagation


  • To: Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Thu, 9 Apr 2026 10:17:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TNTEazLHomjmOsy3+fEjUeM+cp7EbT1E+n7pHfeiQJc=; b=bYhdUrpJk6/NFA3V6oz+J1dR/zj/i3kiOT91gTQ92ifteBP4gx9tTDulE7SOnpg6rK66WvyoQgW1/5WG4fhgtz8NZUOy+qQA8X9E99eQ6I5Ep3hxI/W7bybXDgrvs1ecahcXjNzfdeW3cSznE6le5kEjWHCieF+9O2T9VUZrNUlasBGVZA6cRtewFm/oKWxhg+n8OJMQd+wpwb7SQ67d4nCNmAa3iT/75mmWy45dPg9TjCSSRfcJ1BDVfXTILsM4898zLAUGQLXb3DuwhTRTRXa+Wuy9hWhxxN7p/cwUd/XXw3L/DDPxSZAM5HnS3oBqoLLArqI3iQrkBm6jG8ZxNg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QxnPSnhkR37RHNNA1aGu1wHRvcrg5p1cqpAUwZKRJSKR0vR9ZnA6k7SF7L7WJHSZ3Z3xg5uRpTwK+U4OTTorctgnHSYqioB8Hi09jLM6H5No5IBil6InPVBt0u380B4WyuvGOq+3mBMnQQX0UtvzZFaaPiLVAAwQXQJhkNvjJCuLm/Sehi6mYaLMOjhwYMui6pSWGWs8a+gMrpcnUiIyz+yY/qYRjEcBWRX/+Bsan5Y2kK1e+imQANDzVMgQ8RiYYIipA+Jz1MQYyo7j+rOMPGoVaHR3VsH5M//9Zy9MjPkieeI2auPvp2uH3UVpo1cqPoKDYgioF1jwVs/lMMa/tQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 09 Apr 2026 08:17:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 08/04/2026 19:03, Oleksii Moisieiev wrote:
> In scif_uart_init_postirq(), when setup_irq() returns an error the
> failure was only logged via dprintk() and execution continued,
> unconditionally writing TIE|RIE|REIE into the Serial Control Register
> (SCSCR). This armed all three hardware interrupt lines (TX FIFO empty,
> RX data ready, receive error) with no handler registered to service
> them. On platforms where the GIC receives these asserted lines, the
> result is either repeated spurious-interrupt warnings or an unhandled
> interrupt fault.
> 
> The fix adds an early return inside the error branch. The
> interrupt-enable write to SCSCR is skipped entirely when no handler is
> registered.
> 
> SCIF TX continues to operate correctly after this change. The Xen
> serial framework never calls serial_async_transmit() for SCIF, so
> port->txbuf is always NULL. This causes __serial_putc() to take the
> synchronous finite-capacity path, which polls the SCFSR_TDFE hardware
> flag directly and does not depend on the interrupt mechanism.
NIT: It would be nice to at least mention that there will be no serial RX
without interrupts.

> 
> As a secondary clean-up, the hardware error-flag clearing sequence is
> moved to before the setup_irq() call so that error bits accumulated
> since init_preirq() are cleared unconditionally, regardless of whether
> IRQ registration succeeds.
> 
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
That's a good catch. I can see most of our drivers already use that.
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

That said, I can see that we have exactly the same issue for pl011, cadence and
exynos. I can either take your patch as is (no more work for you) and submit the
patch fixing remaining drivers or you can send a v2 fixing all at once. It's up
to you.

~Michal

> ---
> 
>  xen/drivers/char/scif-uart.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/drivers/char/scif-uart.c b/xen/drivers/char/scif-uart.c
> index 888821a3b8..673a2d3800 100644
> --- a/xen/drivers/char/scif-uart.c
> +++ b/xen/drivers/char/scif-uart.c
> @@ -187,16 +187,24 @@ static void __init scif_uart_init_postirq(struct 
> serial_port *port)
>      uart->irqaction.name    = "scif_uart";
>      uart->irqaction.dev_id  = port;
>  
> -    if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
> -        dprintk(XENLOG_ERR, "Failed to allocated scif_uart IRQ %d\n",
> -                uart->irq);
> -
>      /* Clear all errors */
>      if ( scif_readw(uart, params->status_reg) & params->error_mask )
>          scif_writew(uart, params->status_reg, ~params->error_mask);
>      if ( scif_readw(uart, params->overrun_reg) & params->overrun_mask )
>          scif_writew(uart, params->overrun_reg, ~params->overrun_mask);
>  
> +    if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
> +    {
> +        dprintk(XENLOG_ERR, "Failed to allocated scif_uart IRQ %d\n",
> +                uart->irq);
> +        /*
> +         * If the IRQ handler could not be installed (setup_irq failed),
> +         * do not enable TX/RX or error interrupts. Serial transmit will
> +         * fall back to polling mode.
> +         */
> +        return;
> +    }
> +
>      /* Enable TX/RX and Error Interrupts  */
>      scif_writew(uart, SCIF_SCSCR, scif_readw(uart, SCIF_SCSCR) |
>                  params->irq_flags);




 


Rackspace

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