spi: dw-mid: set DMA burst on memory side
PATCH 1/1 spi: dw-mid: set DMA burst on memory side
To optimize amount of bus writes on memory side set burst to be the same amount of data on both sides.
--- drivers/spi/spi-dw-mid.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-dw-mid.c +2 -0
@@ -157,6 +157,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws, txconf.direction =DMA_MEM_TO_DEV ; txconf.dst_addr = dws->dma_addr; + txconf.src_maxburst =4 * dws->dma_width; txconf.dst_maxburst =16 ; txconf.src_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; txconf.dst_addr_width =convert_dma_width (dws->dma_width);
@@ -203,6 +204,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws, rxconf.direction =DMA_DEV_TO_MEM ; rxconf.src_addr = dws->dma_addr; + rxconf.dst_maxburst =4 * dws->dma_width; rxconf.src_maxburst =16 ; rxconf.dst_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; rxconf.src_addr_width =convert_dma_width (dws->dma_width);
Signature · 6 lines
2.8.0.rc3 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1460392212-101116-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]
drivers/spi/spi-dw-mid.c static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws, · line 161
Quoted 5 lines · Andy Shevchenko
To optimize amount of bus writes on memory side set burst to be the same amount of data on both sides.
drivers/spi/spi-dw-mid.c +1
-0+ txconf.src_maxburst =4 * dws->dma_width; txconf.dst_maxburst =16 ;
This doesn't seem to do what the subject says (at least not always, it'll align for a dma_width of 4)?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 2 lines · Mark Brown
On Mon, Apr 11, 2016 at 07:30:12PM +0300, Andy Shevchenko wrote:
+Vinod and dmaengine@
Quoted 9 lines
Quoted 7 lines
To optimize amount of bus writes on memory side set burst to be the same amount
of data on both sides.drivers/spi/spi-dw-mid.c +1
-0+ txconf.src_maxburst =4 * dws->dma_width;txconf.dst_maxburst = 16;
This doesn't seem to do what the subject says (at least not always, it'll align for a
dma_widthof 4)?
Thanks you didn't apply the patch.
I think the approach itself is wrong.
The peripheral drivers usually have no idea and shouldn't know about DMA engine memory side characteristics (bus width, bursts, etc).
This should be fixed in certain DMA engine drivers.
Also, as you may have noticed when we get maximum length of the segment we take into consideration what DMA device supports. Many of them report something like 2^n - 1, which is apparently unaligned and thus in the poorly written DMA driver leads to performance degradation.
Looks like all Intel related DMA drivers should be fixed (HSU, iDMA64, dw_dmac).
Vinod, am I right?
Signature · 7 lines
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1460462195.6620.100.camel-VuQAYsv1563Yd54FQh9/[email protected]
Quoted 16 lines · Andy Shevchenko
Quoted 2 lines · Mark Brown
On Mon, Apr 11, 2016 at 07:30:12PM +0300, Andy Shevchenko wrote:
+Vinod and dmaengine@
Quoted 9 lines
Quoted 7 lines
To optimize amount of bus writes on memory side set burst to be the same amount
of data on both sides.drivers/spi/spi-dw-mid.c +1
-0+ txconf.src_maxburst =4 * dws->dma_width;txconf.dst_maxburst = 16;
This doesn't seem to do what the subject says (at least not always, it'll align for a
dma_widthof 4)?
Quoted 6 lines
Thanks you didn't apply the patch.
I think the approach itself is wrong.
The peripheral drivers usually have no idea and shouldn't know about DMA engine memory side characteristics (bus width, bursts, etc).
These are typically you system characterstics, like 32 bit or 64 bit bus to memory and rest (burst etc) should be maximum as the data will go from/to dmaengine FIFO to/from memory, so you would want to push as fast as possible
Said that, maximun burst with 32bit wide should be saner value in modern systems.
Quoted 7 lines
This should be fixed in certain DMA engine drivers.
Also, as you may have noticed when we get maximum length of the segment we take into consideration what DMA device supports. Many of them report something like 2^n - 1, which is apparently unaligned and thus in the poorly written DMA driver leads to performance degradation.
Which Intel controller supports 2^n - 1? AFAIK the dw and idma don't.
Quoted 9 lines
Looks like all Intel related DMA drivers should be fixed (HSU, iDMA64,
dw_dmac).Vinod, am I right?
Signature · 2 lines
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]> Intel Finland Oy
Signature · 5 lines
~Vinod -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · Vinod Koul
Quoted 15 lines · Andy Shevchenko
Quoted 8 lines · Mark Brown
On Mon, Apr 11, 2016 at 07:30:12PM +0300, Andy Shevchenko wrote:
To optimize amount of bus writes on memory side set burst to be
Quoted 4 lines
the
same amount
of data on both sides.Quoted 5 lines
Quoted 2 lines
(quoted diff) +1
-0+ txconf.src_maxburst = 4 * dws->dma_width;txconf.dst_maxburst = 16;
This doesn't seem to do what the subject says (at least not always,
it'll align for adma_widthof 4)?Quoted 7 lines
Thanks you didn't apply the patch.
I think the approach itself is wrong.
The peripheral drivers usually have no idea and shouldn't know about DMA
engine memory side characteristics (bus width, bursts, etc).These are typically you system characterstics, like 32 bit or 64 bit bus to
memory and rest (burst etc) should be maximum as the data will go from/to
dmaengine FIFO to/from memory, so you would want to push as fast as possible
Quoted 3 lines
Said that, maximun burst with 32bit wide should be saner value in modern
systems.
My point that peripheral driver does not and _should not_ care about memory side of the transfer. This is property of DMAengine controller and platform that has it installed.
Documentation tells nothing how clients should setup _memory side_ of the transfer.
Thus, I propose to update documentation to tell that there are two sides of the transfer in case of mem2dev, dev2mem, where one of them is _memory side_, and it's DMAengine controller's responsibility to rightfully set the transfer width and burst size.
I would make a patch if we would agree on this.
Quoted 5 lines
Quoted 5 lines
This should be fixed in certain DMA engine drivers.
Quoted 8 lines
Quoted 7 lines
Also, as you may have noticed when we get maximum length of the segment
we take into consideration what DMA device supports. Many of them report
something like 2^n - 1, which is apparently unaligned and thus in the
poorly written DMA driver leads to performance degradation.Which Intel controller supports 2^n - 1? AFAIK the dw and idma don't.
All three mentioned below takes block size as [0 .. 2 ^ number of bits in the register - 1]. If transfer width is 1 byte (which is calculated automatically now, the burst will be 1 byte on memory side!
Quoted 3 lines
Quoted 3 lines
Looks like all Intel related DMA drivers should be fixed (HSU, iDMA64,
dw_dmac).
Signature · 7 lines
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1460477161.6620.120.camel-VuQAYsv1563Yd54FQh9/[email protected]
Quoted 39 lines · Andy Shevchenko
Quoted 30 lines · Vinod Koul
Quoted 15 lines · Andy Shevchenko
Quoted 8 lines · Mark Brown
On Mon, Apr 11, 2016 at 07:30:12PM +0300, Andy Shevchenko wrote:
To optimize amount of bus writes on memory side set burst to be
Quoted 4 lines
the
same amount
of data on both sides.Quoted 5 lines
Quoted 2 lines
(quoted diff) +1
-0+ txconf.src_maxburst = 4 * dws->dma_width;txconf.dst_maxburst = 16;
This doesn't seem to do what the subject says (at least not always,
it'll align for adma_widthof 4)?Quoted 7 lines
Thanks you didn't apply the patch.
I think the approach itself is wrong.
The peripheral drivers usually have no idea and shouldn't know about DMA
engine memory side characteristics (bus width, bursts, etc).These are typically you system characterstics, like 32 bit or 64 bit bus to
memory and rest (burst etc) should be maximum as the data will go from/to
dmaengine FIFO to/from memory, so you would want to push as fast as possibleQuoted 3 lines
Said that, maximun burst with 32bit wide should be saner value in modern
systems.My point that peripheral driver does not and
_shouldnot_care about memory side of the transfer. This is property of DMAengine controller and platform that has it installed.
Quoted 7 lines
Documentation tells nothing how clients should setup
_memoryside_of the transfer.Thus, I propose to update documentation to tell that there are two sides of the transfer in case of mem2dev, dev2mem, where one of them is
_memoryside_, and it's DMAengine controller's responsibility to rightfully set the transfer width and burst size.
Well a dmaengine maybe operating in a 32bit or 64 bit bus. Doing 64bit will not help in former case. How do we guess?
I do agree that clients shouldn't be bothered with this
Quoted 15 lines
I would make a patch if we would agree on this.
Quoted 12 lines
Quoted 12 lines
This should be fixed in certain DMA engine drivers.
Also, as you may have noticed when we get maximum length of the segment
we take into consideration what DMA device supports. Many of them report
something like 2^n - 1, which is apparently unaligned and thus in the
poorly written DMA driver leads to performance degradation.
Quoted 5 lines
Quoted 1 line
Which Intel controller supports 2^n - 1? AFAIK the dw and idma don't.
All three mentioned below takes block size as [0 .. 2 ^ number of bits in the register - 1]. If transfer width is 1 byte (which is calculated automatically now, the burst will be 1 byte on memory side!
That is not correct :)
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Looks like all Intel related DMA drivers should be fixed (HSU, iDMA64,
dw_dmac).Signature · 2 lines
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]> Intel Finland Oy
Signature · 5 lines
~Vinod -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html