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);