Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp123988ybg; Mon, 8 Jun 2020 18:17:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5TreUYDyS1ryrXoLeXQIm3CCLHK1suIzz69bCjzmIVlM+3L2vJ3rXjGr6E7GGcPov2iYI X-Received: by 2002:a05:6402:c95:: with SMTP id cm21mr23780802edb.255.1591665422169; Mon, 08 Jun 2020 18:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591665422; cv=none; d=google.com; s=arc-20160816; b=pXmHlin+w2iIt5lBZkDBcfD5QlRuYs0PjkmkFchZ+62jaJjL9d54tbJtFKmOYuLk0b sZUeOVhP+8daud4WB/fbbAogVpL6E2zE9yNAko4Q4saobVtSdUCYWfVRpmCkXLMfEl3K QfYhG5oumadxjBVPN8mMu9oupI2xANW/EpfM4HsX01ruUaR//U0dplJ4PVj/6ZByzBLc Cx4tBUP6hQbj+YzS9OPxntFXMNX9EQ/oTpyUQr65Jsunzb8bLwJrk5IbtGcRb47QdtIK wf8OxVmBPfpbq02lu0jWqeojjoNcFIPL6ZEOuC2AHwx70bF+GBvVGfXMSw6ker/RzVRq KpGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ykW39Wwa8sg6SyMzx6dZq7rXdYO5ZeXkxYh8Dj3IGJk=; b=bzbbIENbNOhm1TDSQrqvZKjww3bF9upcCFlaKx3GDX9vmXJlJgi895BqtoivNRl9Yh bmWHLd+Y7FgdOXNElqwOzsj+wIRHQndYAxvvUVQne/+hhFazdtSY0k+QQsg0T3UlLW7F OQyOjq6wqmju79qw7Wpr61LQLwfWLHsBO4AmhNwxJC/1ceXxh5aYv36nFQ3vtbx/j7bm FfibFYfaVAVo8iXWCjo2IksY5Q1W4X2a+VwFyYeXOPta9szxtsl0yfMUxeQ6ELK4A5f1 Yw4MX31d0+cSRuBqpbM+limsE6rlVApg/za/O13DZSd3Werd1IY+ArkW2E0OJBUGuWYz 65Zw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o12si9227086edr.155.2020.06.08.18.16.39; Mon, 08 Jun 2020 18:17:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726941AbgFIBOt (ORCPT + 99 others); Mon, 8 Jun 2020 21:14:49 -0400 Received: from lucky1.263xmail.com ([211.157.147.131]:53284 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbgFIBOt (ORCPT ); Mon, 8 Jun 2020 21:14:49 -0400 Received: from localhost (unknown [192.168.167.32]) by lucky1.263xmail.com (Postfix) with ESMTP id 7ABB3AD7D9; Tue, 9 Jun 2020 09:14:45 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P3328T139696397076224S1591665277471272_; Tue, 09 Jun 2020 09:14:45 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <71cb5e1613a1d627514ec9d43b8b166b> X-RL-SENDER: sugar.zhang@rock-chips.com X-SENDER: zxg@rock-chips.com X-LOGIN-NAME: sugar.zhang@rock-chips.com X-FST-TO: vkoul@kernel.org X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Sugar Zhang To: Vinod Koul , Heiko Stuebner Cc: linux-rockchip@lists.infradead.org, Sugar Zhang , Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP' Date: Tue, 9 Jun 2020 09:14:15 +0800 Message-Id: <1591665267-37713-2-git-send-email-sugar.zhang@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591665267-37713-1-git-send-email-sugar.zhang@rock-chips.com> References: <1591665267-37713-1-git-send-email-sugar.zhang@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no reason to limit the performance on the 'NO-FLUSHP' SoCs, cuz these platforms are just that the 'FLUSHP' instruction is broken. so, remove the limit to improve the efficiency. Signed-off-by: Sugar Zhang --- Changes in v2: None drivers/dma/pl330.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 6a158ee..ff0a91f 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1183,9 +1183,6 @@ static inline int _ldst_peripheral(struct pl330_dmac *pl330, { int off = 0; - if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) - cond = BURST; - /* * do FLUSHP at beginning to clear any stale dma requests before the * first WFP. @@ -1231,8 +1228,9 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], } /* - * transfer dregs with single transfers to peripheral, or a reduced size burst - * for mem-to-mem. + * only the unaligned bursts transfers have the dregs. + * transfer dregs with a reduced size burst to peripheral, + * or a reduced size burst for mem-to-mem. */ static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], const struct _xfer_spec *pxs, int transfer_length) @@ -1247,8 +1245,23 @@ static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], case DMA_MEM_TO_DEV: /* fall through */ case DMA_DEV_TO_MEM: - off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, - transfer_length, SINGLE); + /* + * dregs_len = (total bytes - BURST_TO_BYTE(bursts, ccr)) / + * BRST_SIZE(ccr) + * the dregs len must be smaller than burst len, + * so, for higher efficiency, we can modify CCR + * to use a reduced size burst len for the dregs. + */ + dregs_ccr = pxs->ccr; + dregs_ccr &= ~((0xf << CC_SRCBRSTLEN_SHFT) | + (0xf << CC_DSTBRSTLEN_SHFT)); + dregs_ccr |= (((transfer_length - 1) & 0xf) << + CC_SRCBRSTLEN_SHFT); + dregs_ccr |= (((transfer_length - 1) & 0xf) << + CC_DSTBRSTLEN_SHFT); + off += _emit_MOV(dry_run, &buf[off], CCR, dregs_ccr); + off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, 1, + BURST); break; case DMA_MEM_TO_MEM: @@ -2221,9 +2234,7 @@ static bool pl330_prep_slave_fifo(struct dma_pl330_chan *pch, static int fixup_burst_len(int max_burst_len, int quirks) { - if (quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) - return 1; - else if (max_burst_len > PL330_MAX_BURST) + if (max_burst_len > PL330_MAX_BURST) return PL330_MAX_BURST; else if (max_burst_len < 1) return 1; @@ -3128,8 +3139,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pd->dst_addr_widths = PL330_DMA_BUSWIDTHS; pd->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); pd->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; - pd->max_burst = ((pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) ? - 1 : PL330_MAX_BURST); + pd->max_burst = PL330_MAX_BURST; ret = dma_async_device_register(pd); if (ret) { -- 2.7.4