From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93AE4C433F5 for ; Mon, 6 Dec 2021 15:16:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358143AbhLFPTe (ORCPT ); Mon, 6 Dec 2021 10:19:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34488 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355756AbhLFPOP (ORCPT ); Mon, 6 Dec 2021 10:14:15 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B17166132F; Mon, 6 Dec 2021 15:10:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96A58C341C1; Mon, 6 Dec 2021 15:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1638803446; bh=v5OnXFIzNoHpTxFbEu11cJ1Cmar+jDZkPLdfGLe9UHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VhlnOJIC09MjiJBVJULqkkJS7dlEKp86pH6gsVXdlp6uXrCnlGeCk/0nkRttRAcWv IgOIfdx30CNup3+Hz3pxA4tH0L/1cBCv/iHFoMzhh48vQiYY71x1dOO19o37w01NO3 YVuI5OeZlPpO21FVqtCN3XUj2BssBkpdC3wV/+Ls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Eckelmann Subject: [PATCH 4.19 44/48] tty: serial: msm_serial: Deactivate RX DMA for polling support Date: Mon, 6 Dec 2021 15:57:01 +0100 Message-Id: <20211206145550.356021665@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211206145548.859182340@linuxfoundation.org> References: <20211206145548.859182340@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Eckelmann commit 7492ffc90fa126afb67d4392d56cb4134780194a upstream. The CONSOLE_POLLING mode is used for tools like k(g)db. In this kind of setup, it is often sharing a serial device with the normal system console. This is usually no problem because the polling helpers can consume input values directly (when in kgdb context) and the normal Linux handlers can only consume new input values after kgdb switched back. This is not true anymore when RX DMA is enabled for UARTDM controllers. Single input values can no longer be received correctly. Instead following seems to happen: * on 1. input, some old input is read (continuously) * on 2. input, two old inputs are read (continuously) * on 3. input, three old input values are read (continuously) * on 4. input, 4 previous inputs are received This repeats then for each group of 4 input values. This behavior changes slightly depending on what state the controller was when the first input was received. But this makes working with kgdb basically impossible because control messages are always corrupted when kgdboc tries to parse them. RX DMA should therefore be off when CONSOLE_POLLING is enabled to avoid these kind of problems. No such problem was noticed for TX DMA. Fixes: 99693945013a ("tty: serial: msm: Add RX DMA support") Cc: stable@vger.kernel.org Signed-off-by: Sven Eckelmann Link: https://lore.kernel.org/r/20211113121050.7266-1-sven@narfation.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/msm_serial.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -603,6 +603,9 @@ static void msm_start_rx_dma(struct msm_ u32 val; int ret; + if (IS_ENABLED(CONFIG_CONSOLE_POLL)) + return; + if (!dma->chan) return;