From: Vignesh Raghavendra <vigneshr@ti.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
<linux-serial@vger.kernel.org>, <linux-omap@vger.kernel.org>,
Linux ARM Mailing List <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] serial: 8250: 8250_omap: Fix possible interrupt storm
Date: Tue, 11 May 2021 20:49:55 +0530 [thread overview]
Message-ID: <20210511151955.28071-1-vigneshr@ti.com> (raw)
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: stable@vger.kernel.org
Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
drivers/tty/serial/8250/8250_omap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 8ac11eaeca51..c71bd766fa56 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -104,6 +104,9 @@
#define UART_OMAP_EFR2 0x23
#define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6)
+/* RX FIFO occupancy indicator */
+#define UART_OMAP_RX_LVL 0x64
+
struct omap8250_priv {
int line;
u8 habit;
@@ -625,6 +628,15 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)
serial8250_rpm_get(up);
iir = serial_port_in(port, UART_IIR);
ret = serial8250_handle_irq(port, iir);
+ /*
+ * It is possible that RX TIMEOUT is signalled after FIFO
+ * has been drained, in which case a dummy read of RX FIFO is
+ * required to clear RX TIMEOUT condition.
+ */
+ if ((iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT) {
+ if (serial_port_in(port, UART_OMAP_RX_LVL) == 0)
+ serial_port_in(port, UART_RX);
+ }
serial8250_rpm_put(up);
return IRQ_RETVAL(ret);
--
2.31.1
next reply other threads:[~2021-05-11 15:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-11 15:19 Vignesh Raghavendra [this message]
2021-05-13 14:17 ` [PATCH] serial: 8250: 8250_omap: Fix possible interrupt storm Greg Kroah-Hartman
2021-05-28 5:39 ` Tony Lindgren
2021-05-28 6:11 ` Vignesh Raghavendra
2021-05-28 9:00 ` Greg Kroah-Hartman
2021-06-22 6:15 ` Jan Kiszka
2021-06-22 6:23 ` Vignesh Raghavendra
2021-07-12 20:27 ` andy
2021-07-13 8:54 ` Vignesh Raghavendra
2021-07-13 9:09 ` Andy Shevchenko
2021-07-13 9:13 ` Andy Shevchenko
2021-07-27 10:39 ` Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210511151955.28071-1-vigneshr@ti.com \
--to=vigneshr@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=jan.kiszka@siemens.com \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).