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

[PATCH v2 3/4] xen/drivers/char/cadence-uart: fix IRQ registration failure propagation


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>
  • Date: Thu, 9 Apr 2026 13:50:26 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • 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=ZwhynW7zmXJxd8AYQ96d1CxfvYTLwAQ0yYVPWGCG7bc=; b=btqjX/tAeHyLq2ihsE63HkZlTWrw46lh7u3dg61anVXZIxd3a408JOVAELDG3nKDVC7sBSJWoG38hVygea9yPbRWel5g+kghKHvP5PNbVvxCc2e53zQtyOhSXwkeQ0FB2rPJB9BRcjqpTLh+zkoh+MaFAdhh6w25l9S6HhQaa1lxbf0AytARln2S821jUkOHTyd6OdyCXGb8E1yEBhY/9vN4yNXQxrbQ5ElXUqS3cVe6MYhTCWh0Ut3T87Biw5vPpZPL2G+MDzI7QMfCUuPVmgyim5gGXVzw5hGvxXkqSDWK6ZNuJ4cAhWSB18rdhXHYLQ66++UAgHPRBh0GRs6j8Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=POqCbvsD7rN2iqWa1gkkj+Ssb5ui9sePq+w3pWZl+dPUU9fUOhRNbYaOOE9G+O8DxZ83JTb/hdXQ64UsLsLJrRYTdhdAatA99ylyhUMf6hHlRpXcHS+EhI2WA/eiDCMxnr+m2HYouAWS2VuI/CPh9qL+/SvL7QwvPtE/1y90cJ3baHcgqjYVTft8dKyYusodB0z1ohXZ2SimQl3Sq6COwUt3qT6/2nXPiEXlBc4+DrC3ktPU97/ifwXVmQLEO+jVwDTHWndo8TbaGmGEPzwgMYC93Lf2YIXRl+zZjytaRUJCnmVhG+oSfnJqitcRnZQ1OnhDM3ZZFiGELqte5ym00g==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>
  • Delivery-date: Thu, 09 Apr 2026 13:50:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcyCfShWUf7VBEr0ifQc+UCSxOog==
  • Thread-topic: [PATCH v2 3/4] xen/drivers/char/cadence-uart: fix IRQ registration failure propagation

In cuart_init_postirq(), two code paths could reach the
interrupt-enable write to IER 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 IER write, enabling the receive
  data interrupt with no handler installed.

- When setup_irq() returned an error, only an error message was
  printed and execution continued to the IER write, arming the
  receive hardware interrupt line with no handler to service it. On
  platforms where the GIC receives this asserted line, the result is
  either repeated spurious-interrupt warnings or an unhandled
  interrupt fault.

Restructure cuart_init_postirq() to use early returns in both error
paths.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
---



 xen/drivers/char/cadence-uart.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/char/cadence-uart.c b/xen/drivers/char/cadence-uart.c
index b2f379833f..a63dc4adb2 100644
--- a/xen/drivers/char/cadence-uart.c
+++ b/xen/drivers/char/cadence-uart.c
@@ -72,13 +72,18 @@ static void __init cuart_init_postirq(struct serial_port 
*port)
     struct cuart *uart = port->uart;
     int rc;
 
-    if ( uart->irq > 0 )
+    /* Don't unmask interrupts if no valid irq was provided */
+    if ( uart->irq <= 0 )
+        return;
+
+    uart->irqaction.handler = cuart_interrupt;
+    uart->irqaction.name    = "cadence-uart";
+    uart->irqaction.dev_id  = port;
+    if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
     {
-        uart->irqaction.handler = cuart_interrupt;
-        uart->irqaction.name    = "cadence-uart";
-        uart->irqaction.dev_id  = port;
-        if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
-            printk("ERROR: Failed to allocate cadence-uart IRQ %d\n", 
uart->irq);
+        printk("ERROR: Failed to allocate cadence-uart IRQ %d\n", uart->irq);
+        /* Do not unmask interrupts if irq handler wasn't set */
+        return;
     }
 
     /* Clear pending error interrupts */
-- 
2.43.0



 


Rackspace

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