2020-06-08 07:52:18

by Sugar Zhang

[permalink] [raw]
Subject: [PATCH v1 0/13] Patches to improve dma transfer efficiency for Rockchip SoCs.




Sugar Zhang (13):
dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP'
dmaengine: pl330: Add quirk 'arm,pl330-periph-burst'
dt-bindings: dma: pl330: Document the quirk 'arm,pl330-periph-burst'
ARM: dts: rk3036: Add 'arm,pl330-periph-burst' for dmac
ARM: dts: rk322x: Add 'arm,pl330-periph-burst' for dmac
ARM: dts: rk3288: Add 'arm,pl330-periph-burst' for dmac
ARM: dts: rk3xxx: Add 'arm,pl330-periph-burst' for dmac
ARM: dts: rv1108: Add 'arm,pl330-periph-burst' for dmac
arm64: dts: px30: Add 'arm,pl330-periph-burst' for dmac
arm64: dts: rk3308: Add 'arm,pl330-periph-burst' for dmac
arm64: dts: rk3328: Add 'arm,pl330-periph-burst' for dmac
arm64: dts: rk3368: Add 'arm,pl330-periph-burst' for dmac
arm64: dts: rk3399: Add 'arm,pl330-periph-burst' for dmac

.../devicetree/bindings/dma/arm-pl330.txt | 1 +
arch/arm/boot/dts/rk3036.dtsi | 1 +
arch/arm/boot/dts/rk322x.dtsi | 1 +
arch/arm/boot/dts/rk3288.dtsi | 3 ++
arch/arm/boot/dts/rk3xxx.dtsi | 3 ++
arch/arm/boot/dts/rv1108.dtsi | 1 +
arch/arm64/boot/dts/rockchip/px30.dtsi | 1 +
arch/arm64/boot/dts/rockchip/rk3308.dtsi | 2 +
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 1 +
arch/arm64/boot/dts/rockchip/rk3368.dtsi | 2 +
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +
drivers/dma/pl330.c | 44 +++++++++++++++-------
12 files changed, 49 insertions(+), 13 deletions(-)

--
2.7.4




2020-06-08 07:52:36

by Sugar Zhang

[permalink] [raw]
Subject: [PATCH v1 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP'

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 <[email protected]>
---

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



2020-06-08 07:53:00

by Sugar Zhang

[permalink] [raw]
Subject: [PATCH v1 04/13] ARM: dts: rk3036: Add 'arm,pl330-periph-burst' for dmac

This patch Add the quirk to specify to use burst transfer
for better compatible and higher performance.

Signed-off-by: Sugar Zhang <[email protected]>
---

arch/arm/boot/dts/rk3036.dtsi | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/rk3036.dtsi b/arch/arm/boot/dts/rk3036.dtsi
index d9a0c9a2..cfec7d6 100644
--- a/arch/arm/boot/dts/rk3036.dtsi
+++ b/arch/arm/boot/dts/rk3036.dtsi
@@ -67,6 +67,7 @@
<GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
#dma-cells = <1>;
arm,pl330-broken-no-flushp;
++ arm,pl330-periph-burst;
clocks = <&cru ACLK_DMAC2>;
clock-names = "apb_pclk";
};
--
2.7.4



2020-06-08 07:53:52

by Sugar Zhang

[permalink] [raw]
Subject: [PATCH v1 03/13] dt-bindings: dma: pl330: Document the quirk 'arm,pl330-periph-burst'

This patch Adds the quirk 'arm,pl330-periph-burst' for pl330.

Signed-off-by: Sugar Zhang <[email protected]>
---

Documentation/devicetree/bindings/dma/arm-pl330.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/dma/arm-pl330.txt b/Documentation/devicetree/bindings/dma/arm-pl330.txt
index 2c7fd19..315e901 100644
--- a/Documentation/devicetree/bindings/dma/arm-pl330.txt
+++ b/Documentation/devicetree/bindings/dma/arm-pl330.txt
@@ -16,6 +16,7 @@ Optional properties:
- dma-channels: contains the total number of DMA channels supported by the DMAC
- dma-requests: contains the total number of DMA requests supported by the DMAC
- arm,pl330-broken-no-flushp: quirk for avoiding to execute DMAFLUSHP
+ - arm,pl330-periph-burst: quirk for performing burst transfer only
- resets: contains an entry for each entry in reset-names.
See ../reset/reset.txt for details.
- reset-names: must contain at least "dma", and optional is "dma-ocp".
--
2.7.4



2020-06-08 17:33:36

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 04/13] ARM: dts: rk3036: Add 'arm,pl330-periph-burst' for dmac

Hi Sugar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on rockchip/for-next]
[also build test ERROR on slave-dma/next robh/for-next v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Sugar-Zhang/Patches-to-improve-dma-transfer-efficiency-for-Rockchip-SoCs/20200608-181049
base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> Error: arch/arm/boot/dts/rk3036.dtsi:70.3-4 syntax error
FATAL ERROR: Unable to parse input tree

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (1.42 kB)
.config.gz (49.28 kB)
Download all attachments