linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.
@ 2022-11-09 10:58 delisun
  2022-11-09 11:55 ` Ilpo Järvinen
  2022-11-17 21:10 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: delisun @ 2022-11-09 10:58 UTC (permalink / raw)
  To: linux; +Cc: gregkh, jirislaby, linux-serial, linux-kernel, 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.

Signed-off-by: delisun <delisun@pateo.com.cn>
---
 drivers/tty/serial/amba-pl011.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 5cdced39eafd..08034e5dcec0 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -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)
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.
  2022-11-09 10:58 [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle delisun
@ 2022-11-09 11:55 ` Ilpo Järvinen
  2022-11-17 21:10 ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2022-11-09 11:55 UTC (permalink / raw)
  To: delisun; +Cc: linux, Greg Kroah-Hartman, Jiri Slaby, linux-serial, LKML

On Wed, 9 Nov 2022, delisun wrote:

> 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.

-- 
 i.


> Signed-off-by: delisun <delisun@pateo.com.cn>
> ---
>  drivers/tty/serial/amba-pl011.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 5cdced39eafd..08034e5dcec0 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -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);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.
  2022-11-09 10:58 [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle delisun
  2022-11-09 11:55 ` Ilpo Järvinen
@ 2022-11-17 21:10 ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2022-11-17 21:10 UTC (permalink / raw)
  To: delisun; +Cc: linux, jirislaby, linux-serial, linux-kernel

On Wed, Nov 09, 2022 at 06:58:22PM +0800, delisun wrote:
> 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.
> 
> Signed-off-by: delisun <delisun@pateo.com.cn>
> ---
>  drivers/tty/serial/amba-pl011.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 5cdced39eafd..08034e5dcec0 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -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)
> -- 
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.
  2022-11-10  2:01 delisun
@ 2022-11-10 10:24 ` Ilpo Järvinen
  0 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2022-11-10 10:24 UTC (permalink / raw)
  To: delisun; +Cc: linux, Greg Kroah-Hartman, Jiri Slaby, linux-serial, LKML

[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]

On Thu, 10 Nov 2022, delisun wrote:

> 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.
> 
> Fixes: 211565b10099 ("serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle")
> Signed-off-by: delisun <delisun@pateo.com.cn>
> ---
>  drivers/tty/serial/amba-pl011.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 5cdced39eafd..08034e5dcec0 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -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)

Thanks.

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> 

-- 
 i.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.
@ 2022-11-10  2:01 delisun
  2022-11-10 10:24 ` Ilpo Järvinen
  0 siblings, 1 reply; 5+ messages in thread
From: delisun @ 2022-11-10  2:01 UTC (permalink / raw)
  To: linux; +Cc: gregkh, jirislaby, linux-serial, linux-kernel, 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.

Fixes: 211565b10099 ("serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle")
Signed-off-by: delisun <delisun@pateo.com.cn>
---
 drivers/tty/serial/amba-pl011.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 5cdced39eafd..08034e5dcec0 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -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)
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-17 21:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 10:58 [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle delisun
2022-11-09 11:55 ` Ilpo Järvinen
2022-11-17 21:10 ` Greg KH
2022-11-10  2:01 delisun
2022-11-10 10:24 ` Ilpo Järvinen

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).