Skip to contentSkip to conversation

serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.

PATCH In review delisun 3 participants 3 messages Nov 9, 2022 – Nov 17, 2022

Subsystems (2)
lore
Share & tools
lore

delisun

author
#0 lore raw

PATCH 1/1 serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.

Clearing the RX FIFO will cause data loss.
Copy the pl011_enabl_interrupts implementation, and remove the clear interrupt and FIFO part of the code.

---
 drivers/tty/serial/amba-pl011.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/tty/serial/amba-pl011.c +10 -1
index 5cdced39eafd..08034e5dcec0 100644
@@ -1828,8 +1828,17 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap)
 static void pl011_unthrottle_rx(struct uart_port *port)
 {
 	struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
+	unsigned long flags;
 
-	pl011_enable_interrupts(uap);
+	spin_lock_irqsave(&uap->port.lock, flags);
+
+	uap->im = UART011_RTIM;
+	if (!pl011_dma_rx_running(uap))
+		uap->im |= UART011_RXIM;
+
+	pl011_write(uap->im, uap, REG_IMSC);
+
+	spin_unlock_irqrestore(&uap->port.lock, flags);
 }
 
 static int pl011_startup(struct uart_port *port)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · delisun

Clearing the RX FIFO will cause data loss.
Copy the pl011_enabl_interrupts implementation, and remove the clear interrupt and FIFO part of the code.

You should add Fixes tag.

Signature · 1 line
 i.
Quoted 25 lines
---
 drivers/tty/serial/amba-pl011.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/tty/serial/amba-pl011.c +10 -1
index 5cdced39eafd..08034e5dcec0 100644
@@ -1828,8 +1828,17 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap)
 static void pl011_unthrottle_rx(struct uart_port *port)
 {
 	struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
+	unsigned long flags;
 
-	pl011_enable_interrupts(uap);
+	spin_lock_irqsave(&uap->port.lock, flags);
+
+	uap->im = UART011_RTIM;
+	if (!pl011_dma_rx_running(uap))
+		uap->im |= UART011_RXIM;
+
+	pl011_write(uap->im, uap, REG_IMSC);
+
+	spin_unlock_irqrestore(&uap->port.lock, flags);
maintainer
#2 lore raw
In reply to delisun
Quoted 37 lines · delisun

Clearing the RX FIFO will cause data loss.
Copy the pl011_enabl_interrupts implementation, and remove the clear interrupt and FIFO part of the code.

---
 drivers/tty/serial/amba-pl011.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/tty/serial/amba-pl011.c +10 -1
index 5cdced39eafd..08034e5dcec0 100644
@@ -1828,8 +1828,17 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap)
 static void pl011_unthrottle_rx(struct uart_port *port)
 {
 	struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
+	unsigned long flags;
 
-	pl011_enable_interrupts(uap);
+	spin_lock_irqsave(&uap->port.lock, flags);
+
+	uap->im = UART011_RTIM;
+	if (!pl011_dma_rx_running(uap))
+		uap->im |= UART011_RXIM;
+
+	pl011_write(uap->im, uap, REG_IMSC);
+
+	spin_unlock_irqrestore(&uap->port.lock, flags);
 }
 
 static int pl011_startup(struct uart_port *port)
Signature · 1 line
2.25.1

How was this tested?

What commit id does this fix?

And your email is showing up as unvalidated, please fix your email infrastructure to properly verify messages.

thanks,

greg k-h