dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs.
@ 2020-06-09  1:14 Sugar Zhang
  2020-06-09  1:14 ` [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP' Sugar Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Sugar Zhang @ 2020-06-09  1:14 UTC (permalink / raw)
  To: Vinod Koul, Heiko Stuebner
  Cc: linux-rockchip, Sugar Zhang, devicetree, Andy Yan,
	Enric Balletbo i Serra, Miquel Raynal, Leonidas P. Papadakos,
	Jonas Karlman, Johan Jonker, linux-kernel, Dan Williams,
	Robin Murphy, Rob Herring, Carlos de Paula, dmaengine,
	Chen-Yu Tsai, linux-arm-kernel, Daniel Lezcano



Changes in v2:
- fix FATAL ERROR: Unable to parse input tree

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




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP'
  2020-06-09  1:14 [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Sugar Zhang
@ 2020-06-09  1:14 ` Sugar Zhang
  2020-06-24  7:54   ` Vinod Koul
  2020-06-09  1:14 ` [PATCH v2 02/13] dmaengine: pl330: Add quirk 'arm,pl330-periph-burst' Sugar Zhang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Sugar Zhang @ 2020-06-09  1:14 UTC (permalink / raw)
  To: Vinod Koul, Heiko Stuebner
  Cc: linux-rockchip, Sugar Zhang, Dan Williams, dmaengine, linux-kernel

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 <sugar.zhang@rock-chips.com>
---

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




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 02/13] dmaengine: pl330: Add quirk 'arm,pl330-periph-burst'
  2020-06-09  1:14 [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Sugar Zhang
  2020-06-09  1:14 ` [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP' Sugar Zhang
@ 2020-06-09  1:14 ` Sugar Zhang
  2020-06-24  8:19   ` Vinod Koul
  2020-06-09  1:14 ` [PATCH v2 03/13] dt-bindings: dma: pl330: Document the " Sugar Zhang
  2020-06-12  1:06 ` [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Peter Geis
  3 siblings, 1 reply; 11+ messages in thread
From: Sugar Zhang @ 2020-06-09  1:14 UTC (permalink / raw)
  To: Vinod Koul, Heiko Stuebner
  Cc: linux-rockchip, Sugar Zhang, Dan Williams, dmaengine, linux-kernel

This patch adds the qurik to use busrt transfers only
for pl330 controller, even for request with a length of 1.

Although, the correct way should be: if the peripheral request
length is 1, the peripheral should use SINGLE request, and then
notify the dmac using SINGLE mode by src/dst_maxburst with 1.

For example, on the Rockchip SoCs, all the peripherals can use
SINGLE or BURST request by setting GRF registers. it is possible
that if these peripheral drivers are used only for Rockchip SoCs.
Unfortunately, it's not, such as dw uart, which is used so widely,
and we can't set src/dst_maxburst according to the SoCs' specific
to compatible with all the other SoCs.

So, for convenience, all the peripherals are set as BURST request
by default on the Rockchip SoCs. even for request with a length of 1.
the current pl330 driver will perform SINGLE transfer if the client's
maxburst is 1, which still should be working according to chapter 2.6.6
of datasheet which describe how DMAC performs SINGLE transfers for
a BURST request. unfortunately, it's broken on the Rockchip SoCs,
which support only matching transfers, such as BURST transfer for
BURST request, SINGLE transfer for SINGLE request.

Finaly, we add the quirk to specify pl330 to use burst transfers only.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
---

Changes in v2: None

 drivers/dma/pl330.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index ff0a91f..1941ec6 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -33,7 +33,8 @@
 #define PL330_MAX_PERI		32
 #define PL330_MAX_BURST         16
 
-#define PL330_QUIRK_BROKEN_NO_FLUSHP BIT(0)
+#define PL330_QUIRK_BROKEN_NO_FLUSHP	BIT(0)
+#define PL330_QUIRK_PERIPH_BURST	BIT(1)
 
 enum pl330_cachectrl {
 	CCTRL0,		/* Noncacheable and nonbufferable */
@@ -509,6 +510,10 @@ static struct pl330_of_quirks {
 	{
 		.quirk = "arm,pl330-broken-no-flushp",
 		.id = PL330_QUIRK_BROKEN_NO_FLUSHP,
+	},
+	{
+		.quirk = "arm,pl330-periph-burst",
+		.id = PL330_QUIRK_PERIPH_BURST,
 	}
 };
 
@@ -1206,6 +1211,9 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
 	int off = 0;
 	enum pl330_cond cond = BRST_LEN(pxs->ccr) > 1 ? BURST : SINGLE;
 
+	if (pl330->quirks & PL330_QUIRK_PERIPH_BURST)
+		cond = BURST;
+
 	switch (pxs->desc->rqtype) {
 	case DMA_MEM_TO_DEV:
 		/* fall through */
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 03/13] dt-bindings: dma: pl330: Document the quirk 'arm,pl330-periph-burst'
  2020-06-09  1:14 [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Sugar Zhang
  2020-06-09  1:14 ` [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP' Sugar Zhang
  2020-06-09  1:14 ` [PATCH v2 02/13] dmaengine: pl330: Add quirk 'arm,pl330-periph-burst' Sugar Zhang
@ 2020-06-09  1:14 ` Sugar Zhang
  2020-06-17 20:58   ` Rob Herring
  2020-06-12  1:06 ` [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Peter Geis
  3 siblings, 1 reply; 11+ messages in thread
From: Sugar Zhang @ 2020-06-09  1:14 UTC (permalink / raw)
  To: Vinod Koul, Heiko Stuebner
  Cc: linux-rockchip, Sugar Zhang, Rob Herring, dmaengine, devicetree,
	linux-kernel

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

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
---

Changes in v2: None

 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




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs.
  2020-06-09  1:14 [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Sugar Zhang
                   ` (2 preceding siblings ...)
  2020-06-09  1:14 ` [PATCH v2 03/13] dt-bindings: dma: pl330: Document the " Sugar Zhang
@ 2020-06-12  1:06 ` Peter Geis
  2020-06-12  1:15   ` Peter Geis
  3 siblings, 1 reply; 11+ messages in thread
From: Peter Geis @ 2020-06-12  1:06 UTC (permalink / raw)
  To: Sugar Zhang
  Cc: Vinod Koul, Heiko Stuebner, devicetree, Carlos de Paula,
	dmaengine, Jonas Karlman, Daniel Lezcano, linux-kernel,
	open list:ARM/Rockchip SoC...,
	Chen-Yu Tsai, Rob Herring, linux-arm-kernel, Miquel Raynal,
	Enric Balletbo i Serra, Andy Yan, Johan Jonker, Robin Murphy,
	Dan Williams, Leonidas P. Papadakos

Good Evening,

I am currently testing this on the rk3399-rockpro64, and it appears to
fully fix the gmac problem without using txpbl.
PCIe also seems to be more stable at high load.
I need to conduct long term testing, but it seems to be doing very well.

Unfortunately it doesn't fix the rk3328 gmac controller.

Tested-by: Peter Geis <pgwipeout@gmail.com>

On Mon, Jun 8, 2020 at 9:15 PM Sugar Zhang <sugar.zhang@rock-chips.com> wrote:
>
>
>
> Changes in v2:
> - fix FATAL ERROR: Unable to parse input tree
>
> 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
>
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs.
  2020-06-12  1:06 ` [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Peter Geis
@ 2020-06-12  1:15   ` Peter Geis
  2020-06-12  8:58     ` sugar zhang
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Geis @ 2020-06-12  1:15 UTC (permalink / raw)
  To: Sugar Zhang
  Cc: Vinod Koul, Heiko Stuebner, devicetree, Carlos de Paula,
	dmaengine, Jonas Karlman, Daniel Lezcano, linux-kernel,
	open list:ARM/Rockchip SoC...,
	Chen-Yu Tsai, Rob Herring, linux-arm-kernel, Miquel Raynal,
	Enric Balletbo i Serra, Andy Yan, Johan Jonker, Robin Murphy,
	Dan Williams, Leonidas P. Papadakos

On Thu, Jun 11, 2020 at 9:06 PM Peter Geis <pgwipeout@gmail.com> wrote:
>
> Good Evening,
>
> I am currently testing this on the rk3399-rockpro64, and it appears to
> fully fix the gmac problem without using txpbl.
> PCIe also seems to be more stable at high load.
> I need to conduct long term testing, but it seems to be doing very well.

Belay that, it does make it harder to trigger, but the issue still
remains on the rk3399.

>
> Unfortunately it doesn't fix the rk3328 gmac controller.
>
> Tested-by: Peter Geis <pgwipeout@gmail.com>
>
> On Mon, Jun 8, 2020 at 9:15 PM Sugar Zhang <sugar.zhang@rock-chips.com> wrote:
> >
> >
> >
> > Changes in v2:
> > - fix FATAL ERROR: Unable to parse input tree
> >
> > 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
> >
> >
> >
> >
> > _______________________________________________
> > Linux-rockchip mailing list
> > Linux-rockchip@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs.
  2020-06-12  1:15   ` Peter Geis
@ 2020-06-12  8:58     ` sugar zhang
  0 siblings, 0 replies; 11+ messages in thread
From: sugar zhang @ 2020-06-12  8:58 UTC (permalink / raw)
  To: Peter Geis
  Cc: Vinod Koul, Heiko Stuebner, devicetree, Carlos de Paula,
	dmaengine, Jonas Karlman, Daniel Lezcano, linux-kernel,
	open list:ARM/Rockchip SoC...,
	Chen-Yu Tsai, Rob Herring, linux-arm-kernel, Miquel Raynal,
	Enric Balletbo i Serra, Andy Yan, Johan Jonker, Robin Murphy,
	Dan Williams, Leonidas P. Papadakos

Hi Peter,

Thanks for testing! but, as I know, GMAC does not use the general 
dma(pl330) for data transfer,

so, these patchs should not be helpful for your case.

在 2020/6/12 9:15, Peter Geis 写道:
> On Thu, Jun 11, 2020 at 9:06 PM Peter Geis <pgwipeout@gmail.com> wrote:
>> Good Evening,
>>
>> I am currently testing this on the rk3399-rockpro64, and it appears to
>> fully fix the gmac problem without using txpbl.
>> PCIe also seems to be more stable at high load.
>> I need to conduct long term testing, but it seems to be doing very well.
> Belay that, it does make it harder to trigger, but the issue still
> remains on the rk3399.
>
>> Unfortunately it doesn't fix the rk3328 gmac controller.
>>
>> Tested-by: Peter Geis <pgwipeout@gmail.com>
>>
>> On Mon, Jun 8, 2020 at 9:15 PM Sugar Zhang <sugar.zhang@rock-chips.com> wrote:
>>>
>>>
>>> Changes in v2:
>>> - fix FATAL ERROR: Unable to parse input tree
>>>
>>> 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
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Linux-rockchip mailing list
>>> Linux-rockchip@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>
-- 
Best Regards!
张学广/Sugar
福州瑞芯微电子股份有限公司
Fuzhou Rockchip Electronics Co.Ltd




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 03/13] dt-bindings: dma: pl330: Document the quirk 'arm,pl330-periph-burst'
  2020-06-09  1:14 ` [PATCH v2 03/13] dt-bindings: dma: pl330: Document the " Sugar Zhang
@ 2020-06-17 20:58   ` Rob Herring
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2020-06-17 20:58 UTC (permalink / raw)
  To: Sugar Zhang
  Cc: devicetree, Heiko Stuebner, linux-kernel, Vinod Koul,
	linux-rockchip, Rob Herring, dmaengine

On Tue, 09 Jun 2020 09:14:17 +0800, Sugar Zhang wrote:
> This patch Adds the quirk 'arm,pl330-periph-burst' for pl330.
> 
> Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
> ---
> 
> Changes in v2: None
> 
>  Documentation/devicetree/bindings/dma/arm-pl330.txt | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP'
  2020-06-09  1:14 ` [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP' Sugar Zhang
@ 2020-06-24  7:54   ` Vinod Koul
  2020-06-29  1:38     ` sugar zhang
  0 siblings, 1 reply; 11+ messages in thread
From: Vinod Koul @ 2020-06-24  7:54 UTC (permalink / raw)
  To: Sugar Zhang
  Cc: Heiko Stuebner, linux-rockchip, Dan Williams, dmaengine, linux-kernel

On 09-06-20, 09:14, Sugar Zhang wrote:
> There is no reason to limit the performance on the 'NO-FLUSHP' SoCs,
> cuz these platforms are just that the 'FLUSHP' instruction is broken.

Lets not use terms like cuz... 'because' is perfect term :)

It can rephrased to:
There is no reason to limit the performance on the 'NO-FLUSHP' SoCs
beacuse 'FLUSHP' instruction is broken on these platforms, so remove the
limit to improve the efficiency


> so, remove the limit to improve the efficiency.
> 
> Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
> ---
> 
> 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.

This is not related to broken flush and should be a different patch
explaining why this changes were done

>   */
>  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
> 
> 

-- 
~Vinod

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 02/13] dmaengine: pl330: Add quirk 'arm,pl330-periph-burst'
  2020-06-09  1:14 ` [PATCH v2 02/13] dmaengine: pl330: Add quirk 'arm,pl330-periph-burst' Sugar Zhang
@ 2020-06-24  8:19   ` Vinod Koul
  0 siblings, 0 replies; 11+ messages in thread
From: Vinod Koul @ 2020-06-24  8:19 UTC (permalink / raw)
  To: Sugar Zhang
  Cc: Heiko Stuebner, linux-rockchip, Dan Williams, dmaengine, linux-kernel

On 09-06-20, 09:14, Sugar Zhang wrote:
> This patch adds the qurik to use busrt transfers only

s/busrt/burst

> for pl330 controller, even for request with a length of 1.
> 
> Although, the correct way should be: if the peripheral request
> length is 1, the peripheral should use SINGLE request, and then
> notify the dmac using SINGLE mode by src/dst_maxburst with 1.
> 
> For example, on the Rockchip SoCs, all the peripherals can use
> SINGLE or BURST request by setting GRF registers. it is possible
> that if these peripheral drivers are used only for Rockchip SoCs.
> Unfortunately, it's not, such as dw uart, which is used so widely,
> and we can't set src/dst_maxburst according to the SoCs' specific
> to compatible with all the other SoCs.
> 
> So, for convenience, all the peripherals are set as BURST request
> by default on the Rockchip SoCs. even for request with a length of 1.
> the current pl330 driver will perform SINGLE transfer if the client's
> maxburst is 1, which still should be working according to chapter 2.6.6
> of datasheet which describe how DMAC performs SINGLE transfers for
> a BURST request. unfortunately, it's broken on the Rockchip SoCs,

s/unfortunately/Unfortunately

> which support only matching transfers, such as BURST transfer for
> BURST request, SINGLE transfer for SINGLE request.
> 
> Finaly, we add the quirk to specify pl330 to use burst transfers only.

s/Finaly/Finally

Below looks fine, pls reorder the series and have binding patch come
first and then the use of binding. Below looks fine though

-- 
~Vinod

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP'
  2020-06-24  7:54   ` Vinod Koul
@ 2020-06-29  1:38     ` sugar zhang
  0 siblings, 0 replies; 11+ messages in thread
From: sugar zhang @ 2020-06-29  1:38 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Heiko Stuebner, linux-rockchip, Dan Williams, dmaengine, linux-kernel


On 2020/6/24 15:54, Vinod Koul wrote:
> On 09-06-20, 09:14, Sugar Zhang wrote:
>> There is no reason to limit the performance on the 'NO-FLUSHP' SoCs,
>> cuz these platforms are just that the 'FLUSHP' instruction is broken.
> Lets not use terms like cuz... 'because' is perfect term :)
>
> It can rephrased to:
> There is no reason to limit the performance on the 'NO-FLUSHP' SoCs
> beacuse 'FLUSHP' instruction is broken on these platforms, so remove the
> limit to improve the efficiency
Thanks, I will send a v3 including these.
>
>> so, remove the limit to improve the efficiency.
>>
>> Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
>> ---
>>
>> 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.
> This is not related to broken flush and should be a different patch
> explaining why this changes were done
ok, I will split this patch in v3.
>>    */
>>   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
>>
>>
-- 




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-06-29  1:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09  1:14 [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Sugar Zhang
2020-06-09  1:14 ` [PATCH v2 01/13] dmaengine: pl330: Remove the burst limit for quirk 'NO-FLUSHP' Sugar Zhang
2020-06-24  7:54   ` Vinod Koul
2020-06-29  1:38     ` sugar zhang
2020-06-09  1:14 ` [PATCH v2 02/13] dmaengine: pl330: Add quirk 'arm,pl330-periph-burst' Sugar Zhang
2020-06-24  8:19   ` Vinod Koul
2020-06-09  1:14 ` [PATCH v2 03/13] dt-bindings: dma: pl330: Document the " Sugar Zhang
2020-06-17 20:58   ` Rob Herring
2020-06-12  1:06 ` [PATCH v2 0/13] Patches to improve transfer efficiency for Rockchip SoCs Peter Geis
2020-06-12  1:15   ` Peter Geis
2020-06-12  8:58     ` sugar zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).