]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
serial: 8250: omap: Disable DMA for console UART
authorVignesh R <vigneshr@ti.com>
Sat, 22 Apr 2017 13:07:19 +0000 (18:37 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 May 2017 14:19:16 +0000 (16:19 +0200)
Kernel always writes log messages to console via
serial8250_console_write()->serial8250_console_putchar() which directly
accesses UART_TX register _without_ using DMA.

But, if other processes like systemd using same UART port, then these
writes are handled by a different code flow using 8250_omap driver where
there is provision to use DMA.

It seems that it is possible that both DMA and CPU might simultaneously
put data to UART FIFO and lead to potential loss of data due to FIFO
overflow and weird data corruption. This happens when both kernel
console and userspace tries to write simultaneously to the same UART
port. Therefore, disable DMA on kernel console port to avoid potential
race between CPU and DMA.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_omap.c

index e7e64913a748fa2a72d0df2163556d47b3a96d79..d81bac98d190908e935acec38be8ca3c22e81116 100644 (file)
@@ -613,6 +613,10 @@ static int omap_8250_startup(struct uart_port *port)
        up->lsr_saved_flags = 0;
        up->msr_saved_flags = 0;
 
+       /* Disable DMA for console UART */
+       if (uart_console(port))
+               up->dma = NULL;
+
        if (up->dma) {
                ret = serial8250_request_dma(up);
                if (ret) {