linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] tty:serial:msm:Do not restore Rx interrupts in DMA
       [not found] <1462896580-11554-1>
@ 2016-06-03 11:10 ` Charanya Venkatraman
  2016-06-03 15:47   ` Greg KH
  2016-06-07 10:28 ` [PATCH v3] " Charanya Venkatraman
  1 sibling, 1 reply; 5+ messages in thread
From: Charanya Venkatraman @ 2016-06-03 11:10 UTC (permalink / raw)
  To: agross, david.brown, andy.gross, gregkh
  Cc: jslaby, linux-soc, linux-serial, sricharan, architt,
	linux-arm-msm, ntelkar, galak, linux-kernel, dmaengine,
	linux-arm-kernel, absahu, njaigane, Charanya

From: Charanya <charanya@codeaurora.org>

Avoid data corruption issues that result in
CRC erros during file transfers over serial ports
at higher baud rates.

The current msm_serial driver masks the FIFO Rx
interrupts in msm_start_rx_dma() since Rx FIFO
interrupts are not required in DMA mode. However,
msm_complete_rx_dma() renables the Rx FIFO interrupt
which could cause RXSTALE event to be processed
when a TXLEV interrupt occurs.

The following is the sequence of events that
could occur resulting in data corruption

msm_start_rx_dma -> msm_complete_rx_dma -->
spin_unlock_irqrestore(&port->lock) -->  msm_uart_irq()
(For TXLEV interrupt) -->  msm_handle_rx_dm() (Read
from FIFO resulting in data corruption)

The patch fixes the issue by not restoring the RXLEV
and RXSTALE interrupts in msm_complete_rx_dma(). These
interrupts are required only in FIFO mode.

Signed-off-by: Charanya Venkatraman <charanya@codeaurora.org>
---
 drivers/tty/serial/msm_serial.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index b7d80bd..646aa3f 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -388,10 +388,6 @@ static void msm_complete_rx_dma(void *args)
 	val &= ~dma->enable_bit;
 	msm_write(port, val, UARTDM_DMEN);
 
-	/* Restore interrupts */
-	msm_port->imr |= UART_IMR_RXLEV | UART_IMR_RXSTALE;
-	msm_write(port, msm_port->imr, UART_IMR);
-
 	if (msm_read(port, UART_SR) & UART_SR_OVERRUN) {
 		port->icount.overrun++;
 		tty_insert_flip_char(tport, 0, TTY_OVERRUN);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v2] tty:serial:msm:Do not restore Rx interrupts in DMA
  2016-06-03 11:10 ` [PATCH v2] tty:serial:msm:Do not restore Rx interrupts in DMA Charanya Venkatraman
@ 2016-06-03 15:47   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2016-06-03 15:47 UTC (permalink / raw)
  To: Charanya Venkatraman
  Cc: agross, david.brown, andy.gross, jslaby, linux-soc, linux-serial,
	sricharan, architt, linux-arm-msm, ntelkar, galak, linux-kernel,
	dmaengine, linux-arm-kernel, absahu, njaigane

On Fri, Jun 03, 2016 at 04:40:32PM +0530, Charanya Venkatraman wrote:
> From: Charanya <charanya@codeaurora.org>

This name must match up with your Signed-off-by name :(

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

* [PATCH v3] tty:serial:msm:Do not restore Rx interrupts in DMA
       [not found] <1462896580-11554-1>
  2016-06-03 11:10 ` [PATCH v2] tty:serial:msm:Do not restore Rx interrupts in DMA Charanya Venkatraman
@ 2016-06-07 10:28 ` Charanya Venkatraman
  2016-06-07 23:08   ` Stephen Boyd
  2016-06-09 19:27   ` Andy Gross
  1 sibling, 2 replies; 5+ messages in thread
From: Charanya Venkatraman @ 2016-06-07 10:28 UTC (permalink / raw)
  To: agross, david.brown, andy.gross, gregkh
  Cc: jslaby, linux-soc, linux-serial, sricharan, architt,
	linux-arm-msm, ntelkar, galak, linux-kernel, dmaengine,
	linux-arm-kernel, absahu, njaigane, Charanya Venkatraman

Avoid data corruption issues that result in CRC errors during file
transfers over serial ports at higher baud rates.

The current msm_serial driver masks the FIFO Rx interrupts in
msm_start_rx_dma() since Rx FIFO interrupts are not required in DMA
mode. However, msm_complete_rx_dma() re-enables the Rx FIFO interrupts
which could cause RXSTALE event to be processed when a TXLEV interrupt
occurs.

The following is the sequence of events that could occur resulting in
data corruption.

msm_start_rx_dma -> msm_complete_rx_dma -->
spin_unlock_irqrestore(&port->lock) -->
msm_uart_irq()(For TXLEV interrupt) -->  msm_handle_rx_dm() (Read from
FIFO resulting in data corruption)

The patch fixes the issue by not restoring the RXLEV and RXSTALE
interrupts in msm_complete_rx_dma(). These interrupts are required only
in FIFO mode.

Signed-off-by: Charanya Venkatraman <charanya@codeaurora.org>
---
Changes in v2:
	- Make commit message more clearer.
Changes in v3:
	- Fix typos in commit message.

 drivers/tty/serial/msm_serial.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index b7d80bd..646aa3f 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -388,10 +388,6 @@ static void msm_complete_rx_dma(void *args)
 	val &= ~dma->enable_bit;
 	msm_write(port, val, UARTDM_DMEN);
 
-	/* Restore interrupts */
-	msm_port->imr |= UART_IMR_RXLEV | UART_IMR_RXSTALE;
-	msm_write(port, msm_port->imr, UART_IMR);
-
 	if (msm_read(port, UART_SR) & UART_SR_OVERRUN) {
 		port->icount.overrun++;
 		tty_insert_flip_char(tport, 0, TTY_OVERRUN);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v3] tty:serial:msm:Do not restore Rx interrupts in DMA
  2016-06-07 10:28 ` [PATCH v3] " Charanya Venkatraman
@ 2016-06-07 23:08   ` Stephen Boyd
  2016-06-09 19:27   ` Andy Gross
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2016-06-07 23:08 UTC (permalink / raw)
  To: Charanya Venkatraman
  Cc: agross, david.brown, andy.gross, gregkh, jslaby, linux-soc,
	linux-serial, sricharan, architt, linux-arm-msm, ntelkar, galak,
	linux-kernel, dmaengine, linux-arm-kernel, absahu, njaigane

On 06/07, Charanya Venkatraman wrote:
> Avoid data corruption issues that result in CRC errors during file
> transfers over serial ports at higher baud rates.
> 
> The current msm_serial driver masks the FIFO Rx interrupts in
> msm_start_rx_dma() since Rx FIFO interrupts are not required in DMA
> mode. However, msm_complete_rx_dma() re-enables the Rx FIFO interrupts
> which could cause RXSTALE event to be processed when a TXLEV interrupt
> occurs.
> 
> The following is the sequence of events that could occur resulting in
> data corruption.
> 
> msm_start_rx_dma -> msm_complete_rx_dma -->
> spin_unlock_irqrestore(&port->lock) -->
> msm_uart_irq()(For TXLEV interrupt) -->  msm_handle_rx_dm() (Read from
> FIFO resulting in data corruption)
> 
> The patch fixes the issue by not restoring the RXLEV and RXSTALE
> interrupts in msm_complete_rx_dma(). These interrupts are required only
> in FIFO mode.
> 
> Signed-off-by: Charanya Venkatraman <charanya@codeaurora.org>
> ---

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v3] tty:serial:msm:Do not restore Rx interrupts in DMA
  2016-06-07 10:28 ` [PATCH v3] " Charanya Venkatraman
  2016-06-07 23:08   ` Stephen Boyd
@ 2016-06-09 19:27   ` Andy Gross
  1 sibling, 0 replies; 5+ messages in thread
From: Andy Gross @ 2016-06-09 19:27 UTC (permalink / raw)
  To: Charanya Venkatraman
  Cc: agross, david.brown, gregkh, jslaby, linux-soc, linux-serial,
	sricharan, architt, linux-arm-msm, ntelkar, galak, linux-kernel,
	dmaengine, linux-arm-kernel, absahu, njaigane

On Tue, Jun 07, 2016 at 03:58:41PM +0530, Charanya Venkatraman wrote:
> Avoid data corruption issues that result in CRC errors during file
> transfers over serial ports at higher baud rates.
> 
> The current msm_serial driver masks the FIFO Rx interrupts in
> msm_start_rx_dma() since Rx FIFO interrupts are not required in DMA
> mode. However, msm_complete_rx_dma() re-enables the Rx FIFO interrupts
> which could cause RXSTALE event to be processed when a TXLEV interrupt
> occurs.
> 
> The following is the sequence of events that could occur resulting in
> data corruption.
> 
> msm_start_rx_dma -> msm_complete_rx_dma -->
> spin_unlock_irqrestore(&port->lock) -->
> msm_uart_irq()(For TXLEV interrupt) -->  msm_handle_rx_dm() (Read from
> FIFO resulting in data corruption)
> 
> The patch fixes the issue by not restoring the RXLEV and RXSTALE
> interrupts in msm_complete_rx_dma(). These interrupts are required only
> in FIFO mode.
> 
> Signed-off-by: Charanya Venkatraman <charanya@codeaurora.org>

Acked-by: Andy Gross <andy.gross@linaro.org>

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

end of thread, other threads:[~2016-06-09 19:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1462896580-11554-1>
2016-06-03 11:10 ` [PATCH v2] tty:serial:msm:Do not restore Rx interrupts in DMA Charanya Venkatraman
2016-06-03 15:47   ` Greg KH
2016-06-07 10:28 ` [PATCH v3] " Charanya Venkatraman
2016-06-07 23:08   ` Stephen Boyd
2016-06-09 19:27   ` Andy Gross

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