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

Re: [PATCH v3 2/4] xen/drivers/char/pl011: fix IRQ registration failure propagation


  • To: Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Wed, 22 Apr 2026 13:22:28 +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=fWXmh2Ux0eSa3Of68oEOgnlsUVp+WgHkf37ef/ws9lU=; b=f+wpxPidQ9fd1TATzQ9fDMdsRs6LyOMJQiQijoJn5nL9GUeeoLZpMcxJwlYYF4EZLe8kXDxvSToG4ZYv+MmICpi6XC3+YU0IH5DAHfkOF/4eYVI82pDQv0CAmJttwjxHkWZ9Op2ead2i7j7CJ0MGO08/W8v1XFFmwZudKhe6L2JLyzmUfV+5BbT3D8K5bQ+m8FaWXbM/0R6iU/+ODzACvZdhELyzN+oMhqrhpiMtlxMsdiifoh1AGHAG8BoNiWmP1WnxzYTDpy2GoZIkufZPXNYWBJIal0DUGN5sjXqfuuQ+7bm44URGIiQai8dxEJxlqHr8LTtEBwb1PO+19C/7Ug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DHw/P4yk9anFQZ33L/SMpMZ0m1bC4EflRzRbcrYq2x93PrGykqeJiDNS38ErAzIqUk++gcbRLgLKJKMEyF3RRmYn5k4sgAubff8yG2+fgAalVGwyPoj9/v+JM6S97PeLSMf8TTTLy8/thwilHLUsGUaevjP7xAOL6EYxIeQpCi1buizWQufm9H3PpoOPyhvu5v9xp9E05YMgYW5SrlhdQrNDk98RvX+c2oIzcuzzCGQAdtj1V5qGGVTpnlCJSuLgRQbZsuoqRveAxvGVUq6bE2XluZMt1lBJ7Haak3M7P0mSvpRx6cp3J1dz5Zp8mgwAhCYGnWrzwaZLxMnp0zct0Q==
  • 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: Wed, 22 Apr 2026 11:23:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 22/04/2026 11:33, Oleksii Moisieiev wrote:
> In pl011_init_postirq(), two code paths could reach the
> interrupt-unmask write to IMSC without a handler being registered:
> 
> - When no valid IRQ number was provided (uart->irq <= 0), the original
>   positive-condition guard (if uart->irq > 0) skipped the irqaction
>   setup but still fell through to the IMSC write, unmasking
>   RTI|OEI|BEI|PEI|FEI|TXI|RXI with no handler installed.
> 
> - When setup_irq() returned an error, only an error message was
>   printed and execution continued to the IMSC write, arming all
>   hardware interrupt lines with no handler 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.
> 
> Restructure pl011_init_postirq() to use early returns: return
> immediately when no valid IRQ is provided, and return after logging
> the error when setup_irq() fails. The interrupt-enable write to IMSC
> is only reached when IRQ registration succeeds.
> 
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
> ---
> 
> Changes in v3:
> - clear pending error interrupts before setup_irq for pl011
> 
>  xen/drivers/char/pl011.c | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
> index 5f9913367d..9e308f4936 100644
> --- a/xen/drivers/char/pl011.c
> +++ b/xen/drivers/char/pl011.c
> @@ -150,18 +150,24 @@ static void __init pl011_init_postirq(struct 
> serial_port *port)
>      struct pl011 *uart = port->uart;
>      int rc;
>  
> -    if ( uart->irq > 0 )
> -    {
> -        uart->irqaction.handler = pl011_interrupt;
> -        uart->irqaction.name    = "pl011";
> -        uart->irqaction.dev_id  = port;
> -        if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
> -            printk("ERROR: Failed to allocate pl011 IRQ %d\n", uart->irq);
> -    }
> +    /* Don't unmask interrupts if no valid irq was provided */
> +    if ( uart->irq <= 0 )
uart->irq is unsigned, so it should be compared to 0. Can be fixed on commit.

Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal




 


Rackspace

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