Skip to content

Commit 31fae7c

Browse files
r-vigneshgregkh
authored andcommitted
serial: 8250: 8250_omap: Fix possible interrupt storm
It is possible that RX TIMEOUT is signalled after RX FIFO has been drained, in which case a dummy read of RX FIFO is required to clear RX TIMEOUT condition. Otherwise, RX TIMEOUT condition is not cleared leading to an interrupt storm Cc: [email protected] Reported-by: Jan Kiszka <[email protected]> Signed-off-by: Vignesh Raghavendra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1f06f57 commit 31fae7c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/tty/serial/8250/8250_omap.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@
104104
#define UART_OMAP_EFR2 0x23
105105
#define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6)
106106

107+
/* RX FIFO occupancy indicator */
108+
#define UART_OMAP_RX_LVL 0x64
109+
107110
struct omap8250_priv {
108111
int line;
109112
u8 habit;
@@ -625,6 +628,15 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)
625628
serial8250_rpm_get(up);
626629
iir = serial_port_in(port, UART_IIR);
627630
ret = serial8250_handle_irq(port, iir);
631+
/*
632+
* It is possible that RX TIMEOUT is signalled after FIFO
633+
* has been drained, in which case a dummy read of RX FIFO is
634+
* required to clear RX TIMEOUT condition.
635+
*/
636+
if ((iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT) {
637+
if (serial_port_in(port, UART_OMAP_RX_LVL) == 0)
638+
serial_port_in(port, UART_RX);
639+
}
628640
serial8250_rpm_put(up);
629641

630642
return IRQ_RETVAL(ret);

0 commit comments

Comments
 (0)