lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL for 4.9 071/281] serial: 8250: omap: Disable DMA for console UART
    Date
    From: Vignesh R <vigneshr@ti.com>

    [ Upstream commit 84b40e3b57eef1417479c00490dd4c9f6e5ffdbc ]

    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>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    ---
    drivers/tty/serial/8250/8250_omap.c | 4 ++++
    1 file changed, 4 insertions(+)

    diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
    index da31159a03ec..e8b34f16ba2c 100644
    --- a/drivers/tty/serial/8250/8250_omap.c
    +++ b/drivers/tty/serial/8250/8250_omap.c
    @@ -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) {
    --
    2.14.1
    \
     
     \ /
      Last update: 2018-03-19 22:31    [W:4.103 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site