Skip to contentSkip to conversation

tty:serial:msm:Do not restore Rx interrupts in DMA

PATCH Superseded Charanya Venkatraman 4 participants 5 messages Jun 3, 2016 – Jun 9, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH v2 1/1 tty:serial:msm:Do not restore Rx interrupts in DMA

In reply to a message not in the archive

From: Charanya <[email protected]>

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.

---
 drivers/tty/serial/msm_serial.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/tty/serial/msm_serial.c +0 -4
index b7d80bd..646aa3f 100644
@@ -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);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#2 lore raw
Quoted 1 line · Charanya Venkatraman

From: Charanya <[email protected]>

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

#3 lore raw

PATCH v3 1/1 tty:serial:msm:Do not restore Rx interrupts in DMA

In reply to a message not in the archive

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.

---
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(-)
drivers/tty/serial/msm_serial.c +0 -4
index b7d80bd..646aa3f 100644
@@ -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);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Reviewed-by on v3 1/1
#4 lore raw
Quoted 17 lines · 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)

Quoted 6 lines

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.

---

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
Acked-by on v3 1/1
#5 lore raw
In reply to Charanya Venkatraman
Quoted 17 lines · 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)

Quoted 5 lines

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.