Skip to contentSkip to conversation

tty: serial: 8250: omap: convert to using cyclic transfers

PATCH In review John Ogness 3 participants 4 messages Jan 22, 2016 – Jan 23, 2016 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 tty: serial: 8250: omap: convert to using cyclic transfers

By using cyclic transfers it is possible to sustain long running DMA transfers at 3Mbit, even without flow control.

The ring buffer used for cyclic dma transfers will grow according to the baud rate to allow at least 1 second of buffering. This way a large (367KiB) ring buffer would only be allocated if very high baud rates are used (3Mbit).

A hrtimer is used as a watchdog to monitor that data in the ring buffer is not overwritten before being processed by the tty layer.

Note that an ugly device-tree lookup hack is implemented in order to detect if the sDMA engine is being used. This is necessary because the sDMA driver does not implement pause/resume correctly and therefore requires slightly different logic for the UART driver.

---
patch against next-20160122

 drivers/tty/serial/8250/8250.h      |    2 +
 drivers/tty/serial/8250/8250_omap.c |  420 ++++++++++++++++++++++++-----------
 2 files changed, 293 insertions(+), 129 deletions(-)
drivers/tty/serial/8250/8250.h +2 -0
index d54dcd8..61b5a52 100644
@@ -42,6 +42,8 @@ struct uart_8250_dma {
 	size_t			rx_size;
 	size_t			tx_size;
 
+	unsigned int		rx_pos;
+
 	unsigned char		tx_running;
 	unsigned char		tx_err;
 	unsigned char		rx_running;
drivers/tty/serial/8250/8250_omap.c +291 -129

635 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#1 lore raw

Hi John,

Quoted 5 lines · John Ogness

Note that an ugly device-tree lookup hack is implemented in order to detect if the sDMA engine is being used. This is necessary because the sDMA driver does not implement pause/resume correctly and therefore requires slightly different logic for the UART driver.

No, this is not acceptable.

Please work with Vinod to refine the dma_get_slave_caps() interface so that dmaengine drivers that don't provide the _documented_ pause/resume support can be identified generically.

Regards,
Peter Hurley

#2 lore raw
Quoted 9 lines · Peter Hurley

Hi John,

Quoted 5 lines · John Ogness

Note that an ugly device-tree lookup hack is implemented in order to detect if the sDMA engine is being used. This is necessary because the sDMA driver does not implement pause/resume correctly and therefore requires slightly different logic for the UART driver.

Quoted 5 lines

No, this is not acceptable.

Please work with Vinod to refine the dma_get_slave_caps() interface so that dmaengine drivers that don't provide the _documented_ pause/resume support can be identified generically.

But we could implement the pause/resume bits correctly wait until it is merge and post this and rely on the fact that it works (including error checking). RMK requested that he wants the UART driver fixed before touching the DMA driver and this has been done in meantime. So we could go ahead and add the missing pieces to SDMA.

Quoted 3 lines

Regards,
Peter Hurley

Sebastian

#3 lore raw
Quoted 16 lines · Sebastian Andrzej Siewior
Quoted 9 lines · Peter Hurley

Hi John,

Quoted 5 lines · John Ogness

Note that an ugly device-tree lookup hack is implemented in order to detect if the sDMA engine is being used. This is necessary because the sDMA driver does not implement pause/resume correctly and therefore requires slightly different logic for the UART driver.

Quoted 5 lines

No, this is not acceptable.

Please work with Vinod to refine the dma_get_slave_caps() interface so that dmaengine drivers that don't provide the _documented_ pause/resume support can be identified generically.

Quoted 5 lines

But we could implement the pause/resume bits correctly wait until it is merge and post this and rely on the fact that it works (including error checking). RMK requested that he wants the UART driver fixed before touching the DMA driver and this has been done in meantime. So we could go ahead and add the missing pieces to SDMA.

There is zero chance of backporting this.
Let's move forward and fix the problem.

At a minimum, the reason this code needs to know which DMA slave driver is because the sDMA driver lies about pause support. Rather than continuing to hide this broken behavior behind the dmaengine API, expose a method of generically determining what the slave driver actually does. It's the only sane choice.

Regards,
Peter Hurley

FWIW, I'm not convinced about cyclic transfers. But doing a complete review of that is a bit off.