+++ /dev/null
-From 3a2ec9442b5813e6554b487080bfcece2ce0ee31 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 4 Jul 2022 10:51:19 +0200
-Subject: serial: 8250_fsl: Don't report FE, PE and OE twice
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit 9d3aaceb73acadf134596a2f8db9c451c1332d3d ]
-
-Some Freescale 8250 implementations have the problem that a single long
-break results in one irq per character frame time. The code in
-fsl8250_handle_irq() that is supposed to handle that uses the BI bit in
-lsr_saved_flags to detect such a situation and then skip the second
-received character. However it also stores other error bits and so after
-a single frame error the character received in the next irq handling is
-passed to the upper layer with a frame error, too.
-
-So after a spike on the data line (which is correctly recognized as a
-frame error) the following valid character is thrown away, because the
-driver reports a frame error for that one, too.
-
-To weaken this problem restrict saving LSR to only the BI bit.
-
-Note however that the handling is still broken:
-
- - lsr_saved_flags is updated using orig_lsr which is the LSR content
- for the first received char, but there might be more in the FIFO, so
- a character is thrown away that is received later and not necessarily
- the one following the break.
- - The doubled break might be the 2nd and 3rd char in the FIFO, so the
- workaround doesn't catch these, because serial8250_rx_chars() doesn't
- handle the workaround.
- - lsr_saved_flags might have set UART_LSR_BI at the entry of
- fsl8250_handle_irq() which doesn't originate from
- fsl8250_handle_irq()'s "up->lsr_saved_flags |= orig_lsr &
- UART_LSR_BI;" but from e.g. from serial8250_tx_empty().
- - For a long or a short break this isn't about two characters, but more
- or only a single one.
-
-Fixes: 9deaa53ac7fa ("serial: add irq handler for Freescale 16550 errata.")
-Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20220704085119.55900-1-u.kleine-koenig@pengutronix.de
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/tty/serial/8250/8250_fsl.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c
-index 24f540835178..cf27db0126d8 100644
---- a/drivers/tty/serial/8250/8250_fsl.c
-+++ b/drivers/tty/serial/8250/8250_fsl.c
-@@ -80,7 +80,7 @@ int fsl8250_handle_irq(struct uart_port *port)
- if ((lsr & UART_LSR_THRE) && (up->ier & UART_IER_THRI))
- serial8250_tx_chars(up);
-
-- up->lsr_saved_flags = orig_lsr;
-+ up->lsr_saved_flags |= orig_lsr & UART_LSR_BI;
-
- uart_unlock_and_check_sysrq(&up->port);
-
---
-2.35.1
-
+++ /dev/null
-From 84bfe97f821df750b136c6d4a8529466e29ed164 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 16 Apr 2021 16:05:55 +0200
-Subject: serial: do not restore interrupt state in sysrq helper
-
-From: Johan Hovold <johan@kernel.org>
-
-[ Upstream commit 75f4e830fa9c47637054a3b7201765f2a314bda2 ]
-
-The uart_unlock_and_check_sysrq() helper can be used to defer processing
-of sysrq until the interrupt handler has released the port lock and is
-about to return.
-
-Since commit 81e2073c175b ("genirq: Disable interrupts for force
-threaded handlers") interrupt handlers that are not explicitly requested
-as threaded are always called with interrupts disabled and there is no
-need to save the interrupt state when taking the port lock.
-
-Instead of adding another sysrq helper for when the interrupt state has
-not needlessly been saved, drop the state parameter from
-uart_unlock_and_check_sysrq() and update its callers to no longer
-explicitly disable interrupts in their interrupt handlers.
-
-Cc: Joel Stanley <joel@jms.id.au>
-Cc: Andrew Jeffery <andrew@aj.id.au>
-Cc: Andy Gross <agross@kernel.org>
-Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
-Signed-off-by: Johan Hovold <johan@kernel.org>
-Link: https://lore.kernel.org/r/20210416140557.25177-2-johan@kernel.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/tty/serial/8250/8250_aspeed_vuart.c | 5 ++---
- drivers/tty/serial/8250/8250_fsl.c | 11 ++++++-----
- drivers/tty/serial/8250/8250_omap.c | 6 +++---
- drivers/tty/serial/8250/8250_port.c | 6 +++---
- drivers/tty/serial/qcom_geni_serial.c | 6 +++---
- include/linux/serial_core.h | 10 +++++-----
- 6 files changed, 22 insertions(+), 22 deletions(-)
-
-diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c
-index ec0d1da71a20..dfb81b45b02c 100644
---- a/drivers/tty/serial/8250/8250_aspeed_vuart.c
-+++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c
-@@ -297,7 +297,6 @@ static int aspeed_vuart_handle_irq(struct uart_port *port)
- {
- struct uart_8250_port *up = up_to_u8250p(port);
- unsigned int iir, lsr;
-- unsigned long flags;
- int space, count;
-
- iir = serial_port_in(port, UART_IIR);
-@@ -305,7 +304,7 @@ static int aspeed_vuart_handle_irq(struct uart_port *port)
- if (iir & UART_IIR_NO_INT)
- return 0;
-
-- spin_lock_irqsave(&port->lock, flags);
-+ spin_lock(&port->lock);
-
- lsr = serial_port_in(port, UART_LSR);
-
-@@ -341,7 +340,7 @@ static int aspeed_vuart_handle_irq(struct uart_port *port)
- if (lsr & UART_LSR_THRE)
- serial8250_tx_chars(up);
-
-- uart_unlock_and_check_sysrq(port, flags);
-+ uart_unlock_and_check_sysrq(port);
-
- return 1;
- }
-diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c
-index fbcc90c31ca1..24f540835178 100644
---- a/drivers/tty/serial/8250/8250_fsl.c
-+++ b/drivers/tty/serial/8250/8250_fsl.c
-@@ -30,15 +30,14 @@ struct fsl8250_data {
- int fsl8250_handle_irq(struct uart_port *port)
- {
- unsigned char lsr, orig_lsr;
-- unsigned long flags;
- unsigned int iir;
- struct uart_8250_port *up = up_to_u8250p(port);
-
-- spin_lock_irqsave(&up->port.lock, flags);
-+ spin_lock(&up->port.lock);
-
- iir = port->serial_in(port, UART_IIR);
- if (iir & UART_IIR_NO_INT) {
-- spin_unlock_irqrestore(&up->port.lock, flags);
-+ spin_unlock(&up->port.lock);
- return 0;
- }
-
-@@ -46,7 +45,7 @@ int fsl8250_handle_irq(struct uart_port *port)
- if (unlikely(up->lsr_saved_flags & UART_LSR_BI)) {
- up->lsr_saved_flags &= ~UART_LSR_BI;
- port->serial_in(port, UART_RX);
-- spin_unlock_irqrestore(&up->port.lock, flags);
-+ spin_unlock(&up->port.lock);
- return 1;
- }
-
-@@ -82,7 +81,9 @@ int fsl8250_handle_irq(struct uart_port *port)
- serial8250_tx_chars(up);
-
- up->lsr_saved_flags = orig_lsr;
-- uart_unlock_and_check_sysrq(&up->port, flags);
-+
-+ uart_unlock_and_check_sysrq(&up->port);
-+
- return 1;
- }
- EXPORT_SYMBOL_GPL(fsl8250_handle_irq);
-diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
-index 537bee8d2258..7223e22c4b88 100644
---- a/drivers/tty/serial/8250/8250_omap.c
-+++ b/drivers/tty/serial/8250/8250_omap.c
-@@ -1179,7 +1179,6 @@ static int omap_8250_dma_handle_irq(struct uart_port *port)
- struct uart_8250_port *up = up_to_u8250p(port);
- struct omap8250_priv *priv = up->port.private_data;
- unsigned char status;
-- unsigned long flags;
- u8 iir;
-
- serial8250_rpm_get(up);
-@@ -1190,7 +1189,7 @@ static int omap_8250_dma_handle_irq(struct uart_port *port)
- return IRQ_HANDLED;
- }
-
-- spin_lock_irqsave(&port->lock, flags);
-+ spin_lock(&port->lock);
-
- status = serial_port_in(port, UART_LSR);
-
-@@ -1215,7 +1214,8 @@ static int omap_8250_dma_handle_irq(struct uart_port *port)
- }
- }
-
-- uart_unlock_and_check_sysrq(port, flags);
-+ uart_unlock_and_check_sysrq(port);
-+
- serial8250_rpm_put(up);
- return 1;
- }
-diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
-index 9d60418e4adb..f1b0a3464285 100644
---- a/drivers/tty/serial/8250/8250_port.c
-+++ b/drivers/tty/serial/8250/8250_port.c
-@@ -1895,14 +1895,13 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir)
- int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
- {
- unsigned char status;
-- unsigned long flags;
- struct uart_8250_port *up = up_to_u8250p(port);
- bool skip_rx = false;
-
- if (iir & UART_IIR_NO_INT)
- return 0;
-
-- spin_lock_irqsave(&port->lock, flags);
-+ spin_lock(&port->lock);
-
- status = serial_port_in(port, UART_LSR);
-
-@@ -1928,7 +1927,8 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
- (up->ier & UART_IER_THRI))
- serial8250_tx_chars(up);
-
-- uart_unlock_and_check_sysrq(port, flags);
-+ uart_unlock_and_check_sysrq(port);
-+
- return 1;
- }
- EXPORT_SYMBOL_GPL(serial8250_handle_irq);
-diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
-index 0d85b55ea823..00bb88a71606 100644
---- a/drivers/tty/serial/qcom_geni_serial.c
-+++ b/drivers/tty/serial/qcom_geni_serial.c
-@@ -818,7 +818,6 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev)
- u32 s_irq_status;
- u32 geni_status;
- struct uart_port *uport = dev;
-- unsigned long flags;
- bool drop_rx = false;
- struct tty_port *tport = &uport->state->port;
- struct qcom_geni_serial_port *port = to_dev_port(uport, uport);
-@@ -826,7 +825,8 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev)
- if (uport->suspended)
- return IRQ_NONE;
-
-- spin_lock_irqsave(&uport->lock, flags);
-+ spin_lock(&uport->lock);
-+
- m_irq_status = readl(uport->membase + SE_GENI_M_IRQ_STATUS);
- s_irq_status = readl(uport->membase + SE_GENI_S_IRQ_STATUS);
- geni_status = readl(uport->membase + SE_GENI_STATUS);
-@@ -861,7 +861,7 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev)
- qcom_geni_serial_handle_rx(uport, drop_rx);
-
- out_unlock:
-- uart_unlock_and_check_sysrq(uport, flags);
-+ uart_unlock_and_check_sysrq(uport);
-
- return IRQ_HANDLED;
- }
-diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
-index 9c1292ea47fd..4d593fef37b4 100644
---- a/include/linux/serial_core.h
-+++ b/include/linux/serial_core.h
-@@ -513,19 +513,19 @@ static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int c
- return 0;
- }
-
--static inline void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags)
-+static inline void uart_unlock_and_check_sysrq(struct uart_port *port)
- {
- int sysrq_ch;
-
- if (!port->has_sysrq) {
-- spin_unlock_irqrestore(&port->lock, irqflags);
-+ spin_unlock(&port->lock);
- return;
- }
-
- sysrq_ch = port->sysrq_ch;
- port->sysrq_ch = 0;
-
-- spin_unlock_irqrestore(&port->lock, irqflags);
-+ spin_unlock(&port->lock);
-
- if (sysrq_ch)
- handle_sysrq(sysrq_ch);
-@@ -539,9 +539,9 @@ static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int c
- {
- return 0;
- }
--static inline void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags)
-+static inline void uart_unlock_and_check_sysrq(struct uart_port *port)
- {
-- spin_unlock_irqrestore(&port->lock, irqflags);
-+ spin_unlock(&port->lock);
- }
- #endif /* CONFIG_MAGIC_SYSRQ_SERIAL */
-
---
-2.35.1
-