Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1124400pxx; Tue, 27 Oct 2020 08:48:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbO2N0RyFH5ZxkglRJXALr6cfis9QYEded/JdAZwFKugwQtVzK9kSMEGA0fPd87fyk3KfD X-Received: by 2002:a17:906:31cb:: with SMTP id f11mr3021225ejf.142.1603813719336; Tue, 27 Oct 2020 08:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603813719; cv=none; d=google.com; s=arc-20160816; b=tARbmD7ngMNryDP8jatB1oMvnSl6NO8xDzGqvr150N6F3pERNgI7N/g0MtFFCh0FFm YV7HdLW8izfG7F3UnzOrDyxLpowO133MUi+l1x7HggL6slcznZyBZkkf8QDYBtwrXxyu 3cqQsnoi57h+JeQduJxoBfOAvk8+wWBTNVIGhpev30eo1Ce77yQ4L/v61c0qSIfhHPSi gJ2ZJmVu/7E3RQwI0wJHJVimgex0Mli/YsG8VDo7bwczga0FL8fpK7T2JkgFc/f1TOO2 38fnB4VRRr/5X/yExhgLXe3END+xQDuI3Wdu8bDuSNBrLq82oiL+PqxvYF0H9k8kkqEp wNag== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q9/EI4iSCgBpZaRVgRdS9TkbSlsDa9+JrB+z8gGxqyc=; b=Qb41owLwrVu2NPEGF9LkLfsRpkWLPmqpWPrBlk7fM6DB4ePcDB4hFQd6gzzonho6cX RltKfJbckeDds3Sv1eD1LtFdi2EmmRcxDs7iy48pIc3vGAIK4D8r5KrZeSvzOy8lKVDp oo/cjrkvrqm9OHbN8WHhoF4jf7o1jiW6Wcsh0kZ/LWL0mDrkyUy/2MTCosC/ThJG5idw A2gudGpWxZims3/A8kQRc3KtFKu3WmdHPZ/TC3A2/J/6gyeW2ut8y8tutGGPGIRsebdU +sWlKUkwn7sJq/R9gtBiy3DIccq5KXKWfHknpaTcGM+00uYAM+zH98iHNHMjR7lnQL6d CPXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y9+nruSD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si1126583edr.134.2020.10.27.08.48.14; Tue, 27 Oct 2020 08:48:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y9+nruSD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1781714AbgJ0O4G (ORCPT + 99 others); Tue, 27 Oct 2020 10:56:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:46738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764410AbgJ0Oqu (ORCPT ); Tue, 27 Oct 2020 10:46:50 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4855022258; Tue, 27 Oct 2020 14:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810009; bh=X3yF2WEk7jjodg1N+eVjY14Uiapn2eIHGyzVg1Pa178=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y9+nruSDtgZOGvShi2O6n3qrcYLP+q+V0R6A68H/GQ3tnf1B5QdE4TG1XmrvbaVv0 diltv8wKYGQ3YUeGtIUaC7Ag3XEVfmt20HAZwlxWdUhUKltSC7Rd51E3GXBMgECHcs doJNGrkssgd9bzVondFAUwnV3RFzHJDUaxbI54Xs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Andy Shevchenko , Vinod Koul , Sasha Levin Subject: [PATCH 5.4 398/408] dmaengine: dw: Activate FIFO-mode for memory peripherals only Date: Tue, 27 Oct 2020 14:55:36 +0100 Message-Id: <20201027135513.467042031@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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: Serge Semin [ Upstream commit 6d9459d04081c796fc67c2bb771f4e4ebb5744c4 ] CFGx.FIFO_MODE field controls a DMA-controller "FIFO readiness" criterion. In other words it determines when to start pushing data out of a DW DMAC channel FIFO to a destination peripheral or from a source peripheral to the DW DMAC channel FIFO. Currently FIFO-mode is set to one for all DW DMAC channels. It means they are tuned to flush data out of FIFO (to a memory peripheral or by accepting the burst transaction requests) when FIFO is at least half-full (except at the end of the block transfer, when FIFO-flush mode is activated) and are configured to get data to the FIFO when it's at least half-empty. Such configuration is a good choice when there is no slave device involved in the DMA transfers. In that case the number of bursts per block is less than when CFGx.FIFO_MODE = 0 and, hence, the bus utilization will improve. But the latency of DMA transfers may increase when CFGx.FIFO_MODE = 1, since DW DMAC will wait for the channel FIFO contents to be either half-full or half-empty depending on having the destination or the source transfers. Such latencies might be dangerous in case if the DMA transfers are expected to be performed from/to a slave device. Since normally peripheral devices keep data in internal FIFOs, any latency at some critical moment may cause one being overflown and consequently losing data. This especially concerns a case when either a peripheral device is relatively fast or the DW DMAC engine is relatively slow with respect to the incoming data pace. In order to solve problems, which might be caused by the latencies described above, let's enable the FIFO half-full/half-empty "FIFO readiness" criterion only for DMA transfers with no slave device involved. Thanks to the commit 99ba8b9b0d97 ("dmaengine: dw: Initialize channel before each transfer") we can freely do that in the generic dw_dma_initialize_chan() method. Signed-off-by: Serge Semin Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20200731200826.9292-3-Sergey.Semin@baikalelectronics.ru Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/dw/dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dw/dw.c b/drivers/dma/dw/dw.c index 7a085b3c1854c..d9810980920a1 100644 --- a/drivers/dma/dw/dw.c +++ b/drivers/dma/dw/dw.c @@ -14,7 +14,7 @@ static void dw_dma_initialize_chan(struct dw_dma_chan *dwc) { struct dw_dma *dw = to_dw_dma(dwc->chan.device); - u32 cfghi = DWC_CFGH_FIFO_MODE; + u32 cfghi = is_slave_direction(dwc->direction) ? 0 : DWC_CFGH_FIFO_MODE; u32 cfglo = DWC_CFGL_CH_PRIOR(dwc->priority); bool hs_polarity = dwc->dws.hs_polarity; -- 2.25.1