Skip to contentSkip to conversation

xen/drivers/char: fix IRQ registration failure propagation

PATCH Superseded Oleksii Moisieiev 3 participants 12 messages Apr 22 – Apr 23 Arm Samsung Exynos

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#1 lore raw

PATCH v3 1/4 xen/drivers/char: fix SCIF IRQ registration failure propagation

In reply to Oleksii Moisieiev

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. RX wouldn't work if irq wasn't registered.

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.

---

(no changes since v2)

Changes in v2:
- Extend fix to pl011, cadence-uart and exynos4210
- fix typo in patch 1 description

 xen/drivers/char/scif-uart.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
xen/drivers/char/scif-uart.c +12 -4
index 888821a3b8..673a2d3800 100644
@@ -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);
Signature · 1 line
2.43.0
#5 lore raw

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

In reply to Oleksii Moisieiev

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.

---

Changes in v3:
- clear pending error interrupts before setup_irq call for cadence uart
- change uart->irq <= 0 to uart->irq == 0 since irq is unsigned

 xen/drivers/char/cadence-uart.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
xen/drivers/char/cadence-uart.c +14 -8
index b2f379833f..8961d39de1 100644
@@ -72,19 +72,25 @@ static void __init cuart_init_postirq(struct serial_port *port)
     struct cuart *uart = port->uart;
     int rc;
 
-    if ( uart->irq > 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);
-    }
+    /* 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;
 
     /* Clear pending error interrupts */
     cuart_write(uart, R_UART_RTRIG, 1);
     cuart_write(uart, R_UART_CISR, ~0);
 
+    if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
+    {
+        printk("ERROR: Failed to allocate cadence-uart IRQ %d\n", uart->irq);
+        /* Do not unmask interrupts if irq handler wasn't set */
+        return;
+    }
+
     /* Unmask interrupts */
     cuart_write(uart, R_UART_IDR, ~0);
     cuart_write(uart, R_UART_IER, UART_SR_INTR_RTRIG);
Signature · 1 line
2.43.0
#0 lore raw

v3 cover xen/drivers/char: fix IRQ registration failure propagation

This series fixes a common bug pattern found in several Xen UART drivers:
when setup_irq() fails during post-IRQ initialization, drivers log the error but continue executing and unconditionally unmask hardware interrupt lines with no handler registered. On platforms where the GIC receives these asserted lines, the result is either repeated spurious-interrupt warnings or an unhandled interrupt fault.

Patch 1, originally submitted as a standalone fix in v1, addresses the issue in the SCIF driver and moves the hardware error-flag clearing sequence to before the setup_irq() call so that stale error bits are cleared unconditionally. Patches 2-4 apply the same early-return fix to the pl011, cadence-uart, and exynos4210-uart drivers.

The pl011 and cadence-uart drivers additionally had a positive-condition IRQ guard (if uart->irq > 0) that could fall through to the interrupt unmask even when no valid IRQ was provided. Both are restructured to use the early-return idiom.

Changes in v3:
- clear pending error interrupts before setup_irq for pl011
- clear pending error interrupts before setup_irq call for cadence uart
- change uart->irq <= 0 to uart->irq == 0 since irq is unsigned
- skip clearing pending interrupts if setup_irq was failed because according to the 13.4.1.13 of the RM: it must be cleared after cleaning interrupt pending in INTC.

Changes in v2:
- Extend fix to pl011, cadence-uart and exynos4210
- fix typo in patch 1 description

Oleksii Moisieiev (4):
xen/drivers/char: fix SCIF IRQ registration failure propagation xen/drivers/char/pl011: fix IRQ registration failure propagation xen/drivers/char/cadence-uart: fix IRQ registration failure
propagation
xen/drivers/char: fix exynos4210 IRQ registration failure propagation

 xen/drivers/char/cadence-uart.c    | 22 ++++++++++++++--------
 xen/drivers/char/exynos4210-uart.c |  4 ++++
 xen/drivers/char/pl011.c           | 22 ++++++++++++++--------
 xen/drivers/char/scif-uart.c       | 16 ++++++++++++----
 4 files changed, 44 insertions(+), 20 deletions(-)
Signature · 4 lines
2.43.0

base-commit: 077dcf9841ad7df4e63c718249d8ac95f8a709ff
branch: amoi_dfmea_scifv3
#8 lore raw

PATCH v3 4/4 xen/drivers/char: fix exynos4210 IRQ registration failure propagation

In exynos4210_uart_init_postirq(), when setup_irq() returns an error the failure was only logged via dprintk() and execution continued, unconditionally clearing UINTM and setting UMCON_INT_EN. This enabled receive and transmit interrupt lines with no handler registered. On platforms where the GIC receives these asserted lines, the result is either repeated spurious-interrupt warnings or an unhandled interrupt fault.

Add an early return in the setup_irq() error branch so that the interrupt-enable writes to UINTM and UMCON are skipped when IRQ registration fails.

---

Changes in v3:
- skip clearing pending interrupts if setup_irq was failed because according to the 13.4.1.13 of the RM: it must be cleared after cleaning interrupt pending in INTC.

 xen/drivers/char/exynos4210-uart.c | 4 ++++
 1 file changed, 4 insertions(+)
xen/drivers/char/exynos4210-uart.c +4 -0
index 58901df554..2e5860ea2b 100644
@@ -199,8 +199,12 @@ static void __init exynos4210_uart_init_postirq(struct serial_port *port)
     uart->irqaction.dev_id  = port;
 
     if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
+    {
         dprintk(XENLOG_ERR, "Failed to allocated exynos4210_uart IRQ %d\n",
                 uart->irq);
+        /* Don't enable interrupts if irq setup was failed */
+        return;
+    }
 
     /* Unmask interrupts */
     exynos4210_write(uart, UINTM, ~UINTM_ALLI);
Signature · 1 line
2.43.0
#3 lore raw

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

In reply to Oleksii Moisieiev

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.

---

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(-)
xen/drivers/char/pl011.c +14 -8
index 5f9913367d..9e308f4936 100644
@@ -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 )
+        return;
+
+    uart->irqaction.handler = pl011_interrupt;
+    uart->irqaction.name    = "pl011";
+    uart->irqaction.dev_id  = port;
 
     /* Clear pending error interrupts */
     pl011_write(uart, ICR, OEI|BEI|PEI|FEI);
 
+    if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
+    {
+        printk("ERROR: Failed to allocate pl011 IRQ %d\n", uart->irq);
+        /* Do not unmask interrupts if irq handler wasn't set */
+        return;
+    }
+
     /* Unmask interrupts */
     pl011_write(uart, IMSC, RTI|OEI|BEI|PEI|FEI|TXI|RXI);
 }
Signature · 1 line
2.43.0
Reviewed-by on v3 2/4
#4 lore raw

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

Quoted 37 lines · Oleksii Moisieiev

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.

---

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(-)
xen/drivers/char/pl011.c +0 -0
index 5f9913367d..9e308f4936 100644
@@ -150,18 +150,24 @@ static void __init pl011_init_postirq(struct serial_port *port)
     struct pl011 *uart = port->uart;
     int rc;
 

xen/drivers/char/pl011.c static void __init pl011_init_postirq(struct serial_port *port) · line 154

Quoted 10 lines
xen/drivers/char/pl011.c +2 -8
-    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.

~Michal

Reviewed-by on v3 3/4
#6 lore raw

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

In reply to Oleksii Moisieiev
Quoted 15 lines · Oleksii Moisieiev

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.

Quoted 4 lines

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

~Michal

Reviewed-by on v3 4/4
#9 lore raw

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

In reply to Oleksii Moisieiev
Quoted 28 lines · Oleksii Moisieiev

In exynos4210_uart_init_postirq(), when setup_irq() returns an error the failure was only logged via dprintk() and execution continued, unconditionally clearing UINTM and setting UMCON_INT_EN. This enabled receive and transmit interrupt lines with no handler registered. On platforms where the GIC receives these asserted lines, the result is either repeated spurious-interrupt warnings or an unhandled interrupt fault.

Add an early return in the setup_irq() error branch so that the interrupt-enable writes to UINTM and UMCON are skipped when IRQ registration fails.

---

Changes in v3:
- skip clearing pending interrupts if setup_irq was failed because according to the 13.4.1.13 of the RM: it must be cleared after cleaning interrupt pending in INTC.

 xen/drivers/char/exynos4210-uart.c | 4 ++++
 1 file changed, 4 insertions(+)
xen/drivers/char/exynos4210-uart.c +0 -0
index 58901df554..2e5860ea2b 100644

xen/drivers/char/exynos4210-uart.c static void __init exynos4210_uart_init_postirq(struct serial_port *port) · line 205

Quoted 7 lines
xen/drivers/char/exynos4210-uart.c +2 -0
@@ -199,8 +199,12 @@ static void __init exynos4210_uart_init_postirq(struct serial_port *port)
     uart->irqaction.dev_id  = port;
 
     if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
+    {
         dprintk(XENLOG_ERR, "Failed to allocated exynos4210_uart IRQ %d\n",
                 uart->irq);
+        /* Don't enable interrupts if irq setup was failed */

NIT: Not sure why this comment differs from one patch to another. Preferably they should all be the same.

~Michal

Reviewed-by on v3 1/4
#2 lore raw

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

In reply to Oleksii Moisieiev
Quoted 54 lines · Oleksii Moisieiev

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. RX wouldn't work if irq wasn't registered.

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.

---

(no changes since v2)

Changes in v2:
- Extend fix to pl011, cadence-uart and exynos4210
- fix typo in patch 1 description

 xen/drivers/char/scif-uart.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
xen/drivers/char/scif-uart.c +0 -4
index 888821a3b8..673a2d3800 100644
@@ -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);

xen/drivers/char/scif-uart.c static void __init scif_uart_init_postirq(struct serial_port *port) · line 204

Quoted 10 lines
xen/drivers/char/scif-uart.c +9 -0
 
+    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.
+         */

As mentioned before, why do these comments differ depending on the patch. I would suggest to just add:
/* Don't enable interrupts if irq handler was not set. Fall back to polling */

Other than that:

~Michal

Reviewed-by on v3 3/4
#7 lore raw

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

In reply to Oleksii Moisieiev

On 4/22/26 12:33, Oleksii Moisieiev wrote:

Hello Oleksii

Quoted 18 lines

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.

Quoted 6 lines

---

Changes in v3:
- clear pending error interrupts before setup_irq call for cadence uart
- change uart->irq <= 0 to uart->irq == 0 since irq is unsigned

with NIT (could probably be fixed on commit) ...

Quoted 25 lines
  xen/drivers/char/cadence-uart.c | 22 ++++++++++++++--------
  1 file changed, 14 insertions(+), 8 deletions(-)
xen/drivers/char/cadence-uart.c +5 -8
index b2f379833f..8961d39de1 100644
@@ -72,19 +72,25 @@ static void __init cuart_init_postirq(struct serial_port *port)
      struct cuart *uart = port->uart;
      int rc;
 
-    if ( uart->irq > 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);
-    }
+    /* Don't unmask interrupts if no valid irq was provided */
+    if ( uart->irq == 0 )
+        return;
+
+    uart->irqaction.handler = cuart_interrupt;

xen/drivers/char/cadence-uart.c static void __init cuart_init_postirq(struct serial_port *port) · line 89

Quoted 10 lines
xen/drivers/char/cadence-uart.c +5 -0
+    uart->irqaction.name    = "cadence-uart";
+    uart->irqaction.dev_id  = port;
 
      /* Clear pending error interrupts */
      cuart_write(uart, R_UART_RTRIG, 1);
      cuart_write(uart, R_UART_CISR, ~0);
 
+    if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
+    {
+        printk("ERROR: Failed to allocate cadence-uart IRQ %d\n", uart->irq);

... the format specifier should be %u instead of %d since the value
is unsigned.

Quoted 7 lines
xen/drivers/char/cadence-uart.c +4 -0
+        /* Do not unmask interrupts if irq handler wasn't set */
+        return;
+    }
+
      /* Unmask interrupts */
      cuart_write(uart, R_UART_IDR, ~0);
      cuart_write(uart, R_UART_IER, UART_SR_INTR_RTRIG);
#10 lore raw

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

In reply to Orzel, Michal

Hi Michal, Oleksandr

Thank you for the fast review. Well, I don't know why the commit differs :). I haven't copied it, just wrote from scratch.

I see that overall it looks good. I can post v4 with nits fixed from you and Oleksandr, or they will be fixed on commit.

Which way is more convenient for you?

--

Oleksii.

Quoted 44 lines · Michal
Quoted 28 lines · Oleksii Moisieiev

In exynos4210_uart_init_postirq(), when setup_irq() returns an error the failure was only logged via dprintk() and execution continued, unconditionally clearing UINTM and setting UMCON_INT_EN. This enabled receive and transmit interrupt lines with no handler registered. On platforms where the GIC receives these asserted lines, the result is either repeated spurious-interrupt warnings or an unhandled interrupt fault.

Add an early return in the setup_irq() error branch so that the interrupt-enable writes to UINTM and UMCON are skipped when IRQ registration fails.

---

Changes in v3:
- skip clearing pending interrupts if setup_irq was failed because according to the 13.4.1.13 of the RM: it must be cleared after cleaning interrupt pending in INTC.

  xen/drivers/char/exynos4210-uart.c | 4 ++++
  1 file changed, 4 insertions(+)
xen/drivers/char/exynos4210-uart.c +0 -0
index 58901df554..2e5860ea2b 100644

xen/drivers/char/exynos4210-uart.c static void __init exynos4210_uart_init_postirq(struct serial_port *port) · line 205

Quoted 7 lines
xen/drivers/char/exynos4210-uart.c +2 -0
@@ -199,8 +199,12 @@ static void __init exynos4210_uart_init_postirq(struct serial_port *port)
      uart->irqaction.dev_id  = port;
 
      if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
+    {
          dprintk(XENLOG_ERR, "Failed to allocated exynos4210_uart IRQ %d\n",
                  uart->irq);
+        /* Don't enable interrupts if irq setup was failed */

NIT: Not sure why this comment differs from one patch to another. Preferably they should all be the same.

~Michal

#11 lore raw

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

Quoted 9 lines · Oleksii Moisieiev

Hi Michal, Oleksandr

Thank you for the fast review. Well, I don't know why the commit differs :). I haven't copied it, just wrote from scratch.

I see that overall it looks good. I can post v4 with nits fixed from you and Oleksandr, or they will be fixed on commit.

Which way is more convenient for you?

Please send a respin with tags kept.

~Michal