Skip to contentSkip to conversation

serial: amba-pl011: Fix RX stall when DMA is used

PATCH In review Kartik Rajput 3 participants 3 messages Nov 13, 2024

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

PATCH v2 1/1 serial: amba-pl011: Fix RX stall when DMA is used

Function pl011_throttle_rx() calls pl011_stop_rx() to disable RX, which also disables the RX DMA by clearing the RXDMAE bit of the DMACR register. However, to properly unthrottle RX when DMA is used, the function pl011_unthrottle_rx() is expected to set the RXDMAE bit of the DMACR register, which it currently lacks. This causes RX to stall after the throttle API is called.

Set RXDMAE bit in the DMACR register while unthrottling RX if RX DMA is used.

Fixes 211565b10099 ("serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle")

---
v1 -> v2:
* Updated my Signed-off-by tag.
* Added Cc: stable tag in the commit message.

---
 drivers/tty/serial/amba-pl011.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/tty/serial/amba-pl011.c +5 -0
index 7d0134ecd82f..abd789c93c6b 100644
@@ -1819,6 +1819,11 @@ static void pl011_unthrottle_rx(struct uart_port *port)
 
 	pl011_write(uap->im, uap, REG_IMSC);
 
+	if (uap->using_rx_dma) {
+		uap->dmacr |= UART011_RXDMAE;
+		pl011_write(uap->dmacr, uap, REG_DMACR);
+	}
+
 	uart_port_unlock_irqrestore(&uap->port, flags);
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Kartik Rajput

Function pl011_throttle_rx() calls pl011_stop_rx() to disable RX, which also disables the RX DMA by clearing the RXDMAE bit of the DMACR register. However, to properly unthrottle RX when DMA is used, the function pl011_unthrottle_rx() is expected to set the RXDMAE bit of the DMACR register, which it currently lacks. This causes RX to stall after the throttle API is called.

Quoted 6 lines

Set RXDMAE bit in the DMACR register while unthrottling RX if RX DMA is used.

Fixes 211565b10099 ("serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle")

Looks right to me, thanks Kartik!

Yours,
Linus Walleij

#2 lore raw
In reply to Kartik Rajput
kernel test robot noticed the following build errors:

Hi Kartik,

kernel test robot noticed the following build errors:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on tty/tty-next tty/tty-linus usb/usb-testing usb/usb-next usb/usb-linus soc/for-next linus/master v6.12-rc7 next-20241113] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Kartik-Rajput/serial-amba-pl011-Fix-RX-stall-when-DMA-is-used/20241113-172830
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link:    https://lore.kernel.org/r/20241113092629.60226-1-kkartik%40nvidia.com
patch subject: [PATCH v2] serial: amba-pl011: Fix RX stall when DMA is used
config: arm-randconfig-004-20241114 (https://download.01.org/0day-ci/archive/20241114/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241114/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/tty/serial/amba-pl011.c:1822:11: error: no member named 'using_rx_dma' in 'struct uart_amba_port'
           if (uap->using_rx_dma) {
               ~~~  ^
>> drivers/tty/serial/amba-pl011.c:1823:8: error: no member named 'dmacr' in 'struct uart_amba_port'
                   uap->dmacr |= UART011_RXDMAE;
                   ~~~  ^
   drivers/tty/serial/amba-pl011.c:1824:20: error: no member named 'dmacr' in 'struct uart_amba_port'
                   pl011_write(uap->dmacr, uap, REG_DMACR);
                               ~~~  ^

3 errors generated.

vim +1822 drivers/tty/serial/amba-pl011.c

1808
1809 static void pl011_unthrottle_rx(struct uart_port *port)
1810 {
1811 struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
1812 unsigned long flags;
1813
1814 uart_port_lock_irqsave(&uap->port, &flags);
1815
1816 uap->im = UART011_RTIM;
1817 if (!pl011_dma_rx_running(uap))
1818 uap->im |= UART011_RXIM;
1819
1820 pl011_write(uap->im, uap, REG_IMSC);
1821

> 1822		if (uap->using_rx_dma) {
> 1823			uap->dmacr |= UART011_RXDMAE;

1824 pl011_write(uap->dmacr, uap, REG_DMACR);
1825 }
1826
1827 uart_port_unlock_irqrestore(&uap->port, flags);
1828 }
1829

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki