From patchwork Tue Mar 7 16:44:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 65701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2537730wrd; Tue, 7 Mar 2023 08:52:39 -0800 (PST) X-Google-Smtp-Source: AK7set+5DM4jLYtkBOxGinZJ33I8ZXzu4cJ1EGNc+kaAFBR6YES0LndT94uyL23esKustpg8bVMu X-Received: by 2002:a17:906:a14:b0:8b1:7de3:cfb3 with SMTP id w20-20020a1709060a1400b008b17de3cfb3mr14241551ejf.1.1678207959036; Tue, 07 Mar 2023 08:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678207959; cv=none; d=google.com; s=arc-20160816; b=qRsO54HX3RIYHU9RzgMcNIh7p6r/BYxw32AZIC41DZd+Wxtx6cnXLurgOaar/Egrqh /j7hFGCTdzHTx+i1RR/sywOiuLneG+AGbzzHUGwBO6pByTK023/dPhVMbe4VIHjvkgwq zWosrWwBXadq64V3Mw2xnSm8ZaI8QpBhqse9v7t8vPRBhoSN9WU5GPkKcmO0639ybcsh SJh+oQ0YQKZzbn9klGi9Yk0cUu+oTTP8QgcBfiAPDxcdS645Lt632kSieKAwLsQWcRBT l/GXHP7/iGc+XroQXciGQcOMGEXINleO8mavt93P4B0hTEgtmDcPL1U0knsfQo6xbFgl Xnig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=og2bJFZYTWC27fXWGlJ2eZxj6MIJufT13z+NvRyZcpc=; b=nRV0O3kyo7jxzYPlJWT6ubxh/Adp//ge9+OXLrDPXVitCjga7PsfGk4IBq8N7+auuP vK8nXYJwqM9BDR05mWuv5rEYZ5Sqd1SxQdISzASi95q2fJmVEkSqAofVMOptkgzmwMSn lhfyZxOAbqqsme1LXZjxoEAEPK1SpbKRoOykZnjowEK3dv9RanI2H8X5gGTJuf9JukBp p0d1JsiIkWMnsAiQYjDb6KMyocRPntelnXEHIlY6b9EqmiLCbs8mKvl/8oucyOIWvgng fd+JABe73y5IcXqjdJcMRpMW92mrRU2hV40OMO/aMX6xQ4j3nKsN4qGG5wLvjQt4Dni0 WQMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G6i/dTXZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs20-20020a1709072d1400b008de9287d513si18328454ejc.7.2023.03.07.08.52.10; Tue, 07 Mar 2023 08:52:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G6i/dTXZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231206AbjCGQrC (ORCPT + 99 others); Tue, 7 Mar 2023 11:47:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229973AbjCGQqg (ORCPT ); Tue, 7 Mar 2023 11:46:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AA9596C2F; Tue, 7 Mar 2023 08:43:38 -0800 (PST) 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 C1F82614DF; Tue, 7 Mar 2023 16:43:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FC29C433B4; Tue, 7 Mar 2023 16:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678207417; bh=YjMTLeqUrjD3XZwpoLNymTfC9unMud9yDlDAEDjzs2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G6i/dTXZ9vd1pcjWL1vwbzOt3WQ0cnyPYlHSN4wG2WigiFGDIZ97wiYCw9tjrL69S /3o5tXP6e9nwGRYuY21FaxZje5XxUsTtD36CzApzwQsUyCDHnzT/BnimU+sz9/EeRg mZBN4837pTcZt8XzHCULsRREs2n3+vcja7AJFQmM8Cdx7w6CDouhxINQ/gkidc4Sby rIwHehqOxIjxuCLrPD1tEzyg67IQZdEhX1+dVBapqrOyeJvqNh3fnNVhfRFA14/4Zx 7nSB3y+zWZtTHb+lMvx7mQFrttS4vRknRa2M4o9hYWsRfX2fDL5SoEbFOY/7JVqXSX xqKa77+PSN++w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZaQG-0003hq-UG; Tue, 07 Mar 2023 17:44:20 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Bjorn Andersson , Andy Gross , Konrad Dybcio , Jiri Slaby , Bartosz Golaszewski , Douglas Anderson , Daniel Thompson , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/4] serial: qcom-geni: fix console shutdown hang Date: Tue, 7 Mar 2023 17:44:02 +0100 Message-Id: <20230307164405.14218-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307164405.14218-1-johan+linaro@kernel.org> References: <20230307164405.14218-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759728588438708760?= X-GMAIL-MSGID: =?utf-8?q?1759728588438708760?= A recent commit added back the calls top stop tx and rx to shutdown() which had previously been removed by commit e83766334f96 ("tty: serial: qcom_geni_serial: No need to stop tx/rx on UART shutdown") in order to be able to use kgdb after stopping the getty. Not only did this again break kgdb, but it also broke serial consoles more generally by hanging TX when stopping the getty during reboot. The underlying problem has been there since the driver was first merged and fixing it is going to be a bit involved so simply stop calling the broken stop functions during shutdown for consoles for now. Fixes: d8aca2f96813 ("tty: serial: qcom-geni-serial: stop operations in progress at shutdown") Cc: Bartosz Golaszewski Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index d69592e5e2ec..11da05d8f848 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1070,6 +1070,10 @@ static int setup_fifos(struct qcom_geni_serial_port *port) static void qcom_geni_serial_shutdown(struct uart_port *uport) { disable_irq(uport->irq); + + if (uart_console(uport)) + return; + qcom_geni_serial_stop_tx(uport); qcom_geni_serial_stop_rx(uport); } From patchwork Tue Mar 7 16:44:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 65710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2540786wrd; Tue, 7 Mar 2023 08:59:20 -0800 (PST) X-Google-Smtp-Source: AK7set+34jtEqkc2cA8elZrU9G0rKWYn9SEa29xcP3gTttOUbm/fEsynyrSecljE6dqBfjoO+Sq2 X-Received: by 2002:a05:6402:3448:b0:4be:c6b:7436 with SMTP id l8-20020a056402344800b004be0c6b7436mr12285859edc.30.1678208360172; Tue, 07 Mar 2023 08:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678208360; cv=none; d=google.com; s=arc-20160816; b=gKJzLq4yj/1vH7/fTSlLz8WOGFlzWh9gr5I0Kvy5YrQ4zolRxQ09UW5cAUTxMH2eyk xxQluHAsRWFec6O9zOmDdAT6Jdriy8v/PtjDXqqfIOU8xjtFT9xn0LJ23HZa0ze8934A TdtbcEKTMA9iUVbiSrLStG4TAjkfouRzZtJEA5l+Ek0TN9ZuDb5PbxR8/Q4h+0DWjta+ wAh52c2cwuhjbeyYTs5ztuDDkLIjpgtMrEyta1JzE0tStOzmIgyAZ2wbQE5IMtG6HKar ywMgPVhPOBMkpApi/ueZn+yucidGCalvpmuPnm56Qp1cxY/3SBvID4ABYU3PWs4pv2ye RI8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xwyFu0k9MQVcdwy/jN6DGEPdkr8zW3JkNlhB71g2vo4=; b=cKY3kkxcY1VMkUFlGclf8AYTyrLvRcu1hsaYI8boDTu82XABmEOjw9Z2e/xozBFUlG HT4WG/+hLhKjUJAOWWyDpLrNJDrKuJ7/3oj/vyQyOnAhs4h2N0Na36UojJTjcCOLPdR9 D6XgiraZC3Y+P/fcgWVx+logTdPZlJVQMbSiv1XYDkUes7fVSFV2WmizagVnMOIsaw+i Bm/rJw9/K5csmxxqEJ/bqdpp56gRllU4xqTo/WgoAmXcOrkBJfMmDWIKd64IVqG+PmbE UMy2ukoFHhy6aaPE73NW9ADxsHjmauy8WoC7P8aWsbTEUMR09KGn3BloT447DKkVNB6X kMeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XhYOkPxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a056402038500b004ab4d3c234csi1529987edv.430.2023.03.07.08.58.56; Tue, 07 Mar 2023 08:59:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XhYOkPxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230180AbjCGQrJ (ORCPT + 99 others); Tue, 7 Mar 2023 11:47:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjCGQqh (ORCPT ); Tue, 7 Mar 2023 11:46:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A621096C3C; Tue, 7 Mar 2023 08:43:39 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 58EE9B81986; Tue, 7 Mar 2023 16:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19355C433A0; Tue, 7 Mar 2023 16:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678207417; bh=Wq+5k8oC8/u0yNH/aD78uhUqCmSvOQM4I4ENgYqsEkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XhYOkPxMndsBoqpJdPajozRgjCCsjGLj0y+V/ZVU/9aDc86ZemRCxx7mXr6pJeSJn ll9lZraCSfgs4jCVxyJ3CRZc5fDlbqo9yzMJqq3/Ys4wY7YFo+2PuZ7wasndQGUKPe FKk2LVMbG+sxgGjPq07K58XcVTDPqdh8Kc4PuSkZvtoEwmMJKrh9tXdkjalA6e70OZ Bqu1F+Jn/+t/lM2S1ZjI/nlVY78qvn/4QMCJNsb9HMKuIdjPOPbl16gKdJw7xU+1xm D2UjkyW4nofslpdcSIgxxnm9v5zPLoz8oKTa0yob8KPBL+qoVU6MWKTuzN9OWwSS/x dxeG21NqNDNHw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZaQH-0003hs-0z; Tue, 07 Mar 2023 17:44:21 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Bjorn Andersson , Andy Gross , Konrad Dybcio , Jiri Slaby , Bartosz Golaszewski , Douglas Anderson , Daniel Thompson , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/4] serial: qcom-geni: fix DMA mapping leak on shutdown Date: Tue, 7 Mar 2023 17:44:03 +0100 Message-Id: <20230307164405.14218-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307164405.14218-1-johan+linaro@kernel.org> References: <20230307164405.14218-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759729009512912685?= X-GMAIL-MSGID: =?utf-8?q?1759729009512912685?= Fix what appears to be a copy-paste error that can lead to a leaked DMA mapping on close() and failure to restart TX after the port is reopened. Note that rx_dma_addr is generally NULL when qcom_geni_serial_stop_tx_dma() is called as part of shutdown() (but tx_dma_addr need not be). Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA") Cc: Bartosz Golaszewski Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 11da05d8f848..2aa3872e6283 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -596,7 +596,7 @@ static void qcom_geni_serial_stop_tx_dma(struct uart_port *uport) if (!qcom_geni_serial_main_active(uport)) return; - if (port->rx_dma_addr) { + if (port->tx_dma_addr) { geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, port->tx_remaining); port->tx_dma_addr = 0; From patchwork Tue Mar 7 16:44:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 65702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2537736wrd; Tue, 7 Mar 2023 08:52:39 -0800 (PST) X-Google-Smtp-Source: AK7set9ZinAGmnCtglXed1SvUpydU3Xfg2rbcAGBAVavh1FvbYV81qFNGY2PBOEzNlPSDtlK9xpp X-Received: by 2002:a17:906:1c0a:b0:8b1:79ce:a629 with SMTP id k10-20020a1709061c0a00b008b179cea629mr15202099ejg.18.1678207959195; Tue, 07 Mar 2023 08:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678207959; cv=none; d=google.com; s=arc-20160816; b=fB4uh/Clj3G3viQLbVK+IeD9okDVst/77dPjBNSEtnjHE6wwdjbnXilzicGZzplvri UBavnOeR1xdAE/9jMdjOfkcCUOEd9IFxttOlgG1oXaEv79AMMAKti+VuXXfJFQ7/Ba3T /ylbOw9xGZZ98YysznXxB1DaRrRGQRcDR/N+cpvpaMzk1YMQRR2x7kIYCxpV0Qqrtvnl 1XbS8fGQjhWeP+VL+COGg/uTKWWyHKsugxJxBmcMrGs129+H4bvu89F9H6LCKR8R+hZj w3xj0k3Kia7DB8AxnYYxrVC/jZcZzdm034GWJc0pE1ooSfKnij/OuccHCG+CBFf8q2ge fm+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oisiPwo8X7QKi3Va9+J5MlwVDWJIadz58EAaU5Krtsg=; b=03PeaABP4HFtFqSPYbsP8dk1C1MULx2iFXc2OuCh67c+riV1EOMxEyq7Hx8FTCDSg6 OnrzyNv6gblIW6wPHC6Juoz74ftNFXbH6iwHlhfCUmrlfXNDwDcrQ4WVoIAqGtxmC04R EFCEnEARkAmBMIdCdH52cd+sWR1K05EvtbG09DcqMIMKKQnA94RMVFnMomTOO/cnyBA9 s8wvGJkmbFN2NkcoF4/ZmLrhiDlD4Is6AYHAT+ioVGc/RQ7+NR5MUMHqKOWrjt9RkAKP YH9LIpz7qxb7kYGUYf55mpmaZu3RolfCMf0rUCjLUjw3BmLOsUclYlibIdb4BI5YIjmz IAPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tRqzPZIf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs25-20020a170906d1d900b008e1cbdcd3c6si1659611ejb.462.2023.03.07.08.52.08; Tue, 07 Mar 2023 08:52:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tRqzPZIf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231224AbjCGQrF (ORCPT + 99 others); Tue, 7 Mar 2023 11:47:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbjCGQqg (ORCPT ); Tue, 7 Mar 2023 11:46:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A174196C32; Tue, 7 Mar 2023 08:43:39 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 6A36BB81928; Tue, 7 Mar 2023 16:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DBAAC433D2; Tue, 7 Mar 2023 16:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678207417; bh=PAB2kcyznKkTzA0a1Jv3xHQl7lhPaWOJlLVm7w2vvWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tRqzPZIfbElBEPP9RwjoCEqhk+gxtlXEDVAS2dhQxL9M9EDEpnm86M63FLMU36M5O 3cyzzxxaUhDqOi1krJ9nIlRANbgCU/Du3DdiYpLCPKpTbJfeSQaPdCKDQyJwHSTHQP SfpTMcbklQGdz4bScORVvcRZGA7dVoxpTr2vsGJN+1I9zA7eYzR8okM65CnbmY4JuR ujNT7S6mxvPV+ZYsYTbusn5WZfi3HBoAhXUVJy/hbJU6ix62tj307MrbE3V89TcLqY ZLvIftZh7nGe0q1QKIQL6PbRVmhhJYkAupeqNzr1QFhnt9+KuQxyAHlFwPwsWY1DBs om4GKEuU/BMYA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZaQH-0003i7-45; Tue, 07 Mar 2023 17:44:21 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Bjorn Andersson , Andy Gross , Konrad Dybcio , Jiri Slaby , Bartosz Golaszewski , Douglas Anderson , Daniel Thompson , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/4] serial: qcom-geni: fix mapping of empty DMA buffer Date: Tue, 7 Mar 2023 17:44:04 +0100 Message-Id: <20230307164405.14218-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307164405.14218-1-johan+linaro@kernel.org> References: <20230307164405.14218-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759728588981907288?= X-GMAIL-MSGID: =?utf-8?q?1759728588981907288?= Make sure that there is data in the ring buffer before trying to set up a zero-length DMA transfer. This specifically fixes the following warning when unmapping the empty buffer on the sc8280xp-crd: WARNING: CPU: 0 PID: 138 at drivers/iommu/dma-iommu.c:1046 iommu_dma_unmap_page+0xbc/0xd8 ... Call trace: iommu_dma_unmap_page+0xbc/0xd8 dma_unmap_page_attrs+0x30/0x1c8 geni_se_tx_dma_unprep+0x28/0x38 qcom_geni_serial_isr+0x358/0x75c Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA") Cc: Bartosz Golaszewski Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 2aa3872e6283..9871225b2f9b 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -631,6 +631,9 @@ static void qcom_geni_serial_start_tx_dma(struct uart_port *uport) if (port->tx_dma_addr) return; + if (uart_circ_empty(xmit)) + return; + xmit_size = uart_circ_chars_pending(xmit); if (xmit_size < WAKEUP_CHARS) uart_write_wakeup(uport); From patchwork Tue Mar 7 16:44:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 65708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2540450wrd; Tue, 7 Mar 2023 08:58:37 -0800 (PST) X-Google-Smtp-Source: AK7set9LeBtz6TigqBboRikL7Z2UyqD2jTqZUAShzqrqWVAE8epuzO9VlYElpk0sbITwRj/ZAbAc X-Received: by 2002:aa7:c589:0:b0:4af:6e08:319 with SMTP id g9-20020aa7c589000000b004af6e080319mr19227021edq.15.1678208316878; Tue, 07 Mar 2023 08:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678208316; cv=none; d=google.com; s=arc-20160816; b=QzBoIiORTFJSDNG9JZIPhFZKTdAskyzdxJZ6TUJNHEC6EJMF6DmWYtIc46zT2F5R1L BYR43ughEvrRe+EuHAoCW28+M1WhKcDVW1gOBaQ0dti3wXBeOWKl+uQz2i3jLO5h+tfw 4qbUQh6cTT0WSgnnaUPJjwxNFggO+Jqm4jpuNAIsRIP9uHv/srgpRFStThJbzuKNTAuG BsGlgtYxMTS1Pea8wPr0hFx+jHTnnVgqqxTVvEUW1o1sGfppqJ4/54eLZ06Wtxvor6qO Eh7mD8cMzXkTjXYAbTUpXTw475zDWPODFZbyQq/bpq4dQEG8aZT/OzErbiXuR3iOd/ct jdSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/5j+uLA9hx0qhDY/pP8ftBODCp74kQCH4cYymHokHLU=; b=nxuH+WfeP4Y2+Vask4o5iGsJRRBBFiCQmrz0ya9DYTh74FkB8ZgA9zFfogzqIx0jfT SdtdtlqlDFZiIv9IxZUYneBpsXF2erMbJOtilIUPF6/7h1Ex3inYei8EvaEfgqz6GPcy bacQ2bfYE0tWAvQ9YxsTNIs6EPG5Lr95ATIpjVXVblxdigZd9JXpdTPu29uD8LjlYvPF jwXmvziwlasxZVF0dFi3mbaPrHCoAtB8U0+MQp8C1ZGKTs5uQh2GxtG0CwVD/cBwrTmq /gDeZN4BwL95E+lhK+UHZMHnKuJz0urpU5okICuKvnkFJKAowfTvK8WqMWaENed9w5Gq 38lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s5eQ16Pb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a1709066d0900b008b17ac3edb8si11044381ejr.675.2023.03.07.08.58.13; Tue, 07 Mar 2023 08:58:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s5eQ16Pb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230434AbjCGQrN (ORCPT + 99 others); Tue, 7 Mar 2023 11:47:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbjCGQqh (ORCPT ); Tue, 7 Mar 2023 11:46:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6701D211D5; Tue, 7 Mar 2023 08:43:38 -0800 (PST) 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 BB288614D1; Tue, 7 Mar 2023 16:43:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18C71C4339C; Tue, 7 Mar 2023 16:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678207417; bh=nr7223xxoM6+3D2kuSbPhGCYTqq1ERzivz361j3EF3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5eQ16PbFgS8bt+xxIG7HhBp99LyC48qMXEOdCl6Hkw4Snt938cXBRWAhRcYqo6PZ Uyw4joS7AXANqJSP4HrrzO3WfSkYU/HtVtalesDI1LMXLdxZd2koXkS2+j5+6hePsp zdWLa9GAT9L33Z+KN7+wHKUxde0AgkIpV3CF/ZpRgQkQYZL5Cdo59YJQMUfBBX0VWZ CbnjgDNhd4VFNUr/4KTCyee1nhqjsgHtp4NaGC5w4EliWWd1i1YaI0L2Al6YXzh+1g TuQcTLtcN1+z0gtCENyv8dueZI4J55Ljn1jCiyhqoOF/Fa7+M4zlSe15sirQp0yjXA +X723GnvHb8sQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZaQH-0003i9-6y; Tue, 07 Mar 2023 17:44:21 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Bjorn Andersson , Andy Gross , Konrad Dybcio , Jiri Slaby , Bartosz Golaszewski , Douglas Anderson , Daniel Thompson , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 4/4] serial: qcom-geni: drop bogus uart_write_wakeup() Date: Tue, 7 Mar 2023 17:44:05 +0100 Message-Id: <20230307164405.14218-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307164405.14218-1-johan+linaro@kernel.org> References: <20230307164405.14218-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759728963907080333?= X-GMAIL-MSGID: =?utf-8?q?1759728963907080333?= Drop the bogus uart_write_wakeup() from when setting up a new DMA transfer, which does not free up any more space in the ring buffer. Any pending writers will be woken up when the transfer completes. Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 9871225b2f9b..28fbc927a546 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -634,10 +634,6 @@ static void qcom_geni_serial_start_tx_dma(struct uart_port *uport) if (uart_circ_empty(xmit)) return; - xmit_size = uart_circ_chars_pending(xmit); - if (xmit_size < WAKEUP_CHARS) - uart_write_wakeup(uport); - xmit_size = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); qcom_geni_serial_setup_tx(uport, xmit_size);