<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/drivers/dma/xilinx, branch v6.8</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>dmaengine: xilinx: xdma: Fix kernel-doc warnings</title>
<updated>2024-01-19T12:13:40+00:00</updated>
<author>
<name>Jan Kuliga</name>
<email>jankul@alatek.krakow.pl</email>
</author>
<published>2023-12-22T23:17:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f829bca2e294bc2953bd2dadb93d72a9987b3110'/>
<id>f829bca2e294bc2953bd2dadb93d72a9987b3110</id>
<content type='text'>
Replace hyphens with colons where necessary.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/oe-kbuild-all/202312230634.3AIMQ3OP-lkp@intel.com/
Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Reviewed-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Link: https://lore.kernel.org/r/20231222231728.7156-1-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace hyphens with colons where necessary.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/oe-kbuild-all/202312230634.3AIMQ3OP-lkp@intel.com/
Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Reviewed-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Link: https://lore.kernel.org/r/20231222231728.7156-1-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: Fix initialization location of desc in xdma_channel_isr()</title>
<updated>2024-01-19T11:34:02+00:00</updated>
<author>
<name>Nathan Chancellor</name>
<email>nathan@kernel.org</email>
</author>
<published>2023-12-22T18:06:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=620a7e4c1f03a84e10c8c3fa0ae1aab03ef84294'/>
<id>620a7e4c1f03a84e10c8c3fa0ae1aab03ef84294</id>
<content type='text'>
Clang warns (or errors with CONFIG_WERROR=y):

  drivers/dma/xilinx/xdma.c:894:3: error: variable 'desc' is uninitialized when used here [-Werror,-Wuninitialized]
    894 |                 desc-&gt;error = true;
        |                 ^~~~

The initialization of desc was moved too far forward, move it back so
that this assignment does not result in a potential crash at runtime
while clearing up the warning.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1972
Fixes: 2f8f90cd2f8d ("dmaengine: xilinx: xdma: Implement interleaved DMA transfers")
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Link: https://lore.kernel.org/r/20231222-dma-xilinx-xdma-clang-fixes-v1-2-84a18ff184d2@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clang warns (or errors with CONFIG_WERROR=y):

  drivers/dma/xilinx/xdma.c:894:3: error: variable 'desc' is uninitialized when used here [-Werror,-Wuninitialized]
    894 |                 desc-&gt;error = true;
        |                 ^~~~

The initialization of desc was moved too far forward, move it back so
that this assignment does not result in a potential crash at runtime
while clearing up the warning.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1972
Fixes: 2f8f90cd2f8d ("dmaengine: xilinx: xdma: Implement interleaved DMA transfers")
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Link: https://lore.kernel.org/r/20231222-dma-xilinx-xdma-clang-fixes-v1-2-84a18ff184d2@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: Fix operator precedence in xdma_prep_interleaved_dma()</title>
<updated>2024-01-19T11:34:02+00:00</updated>
<author>
<name>Nathan Chancellor</name>
<email>nathan@kernel.org</email>
</author>
<published>2023-12-22T18:06:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=fe0d495e759cee0dbfff4348b5791f21b6f56655'/>
<id>fe0d495e759cee0dbfff4348b5791f21b6f56655</id>
<content type='text'>
Clang warns (or errors with CONFIG_WERROR=y):

  drivers/dma/xilinx/xdma.c:757:68: error: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Werror,-Wparentheses]
    757 |                 src_addr += dmaengine_get_src_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;src_inc ?
        |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
  drivers/dma/xilinx/xdma.c:757:68: note: place parentheses around the '+' expression to silence this warning
    757 |                 src_addr += dmaengine_get_src_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;src_inc ?
        |                                                                                  ^
        |                             (                                                   )
  drivers/dma/xilinx/xdma.c:757:68: note: place parentheses around the '?:' expression to evaluate it first
    757 |                 src_addr += dmaengine_get_src_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;src_inc ?
        |                                                                                  ^
        |                                                                      (
    758 |                                                               xt-&gt;sgl[i].size : 0;
        |
        |                                                                                  )
  drivers/dma/xilinx/xdma.c:759:68: error: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Werror,-Wparentheses]
    759 |                 dst_addr += dmaengine_get_dst_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;dst_inc ?
        |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
  drivers/dma/xilinx/xdma.c:759:68: note: place parentheses around the '+' expression to silence this warning
    759 |                 dst_addr += dmaengine_get_dst_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;dst_inc ?
        |                                                                                  ^
        |                             (                                                   )
  drivers/dma/xilinx/xdma.c:759:68: note: place parentheses around the '?:' expression to evaluate it first
    759 |                 dst_addr += dmaengine_get_dst_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;dst_inc ?
        |                                                                                  ^
        |                                                                      (
    760 |                                                               xt-&gt;sgl[i].size : 0;
        |
        |                                                                                  )

The src_inc and dst_inc members of 'struct dma_interleaved_template' are
booleans, so it does not make sense for the addition to happen first.
Wrap the conditional operator in parantheses so it is evaluated first.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1971
Fixes: 2f8f90cd2f8d ("dmaengine: xilinx: xdma: Implement interleaved DMA transfers")
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Link: https://lore.kernel.org/r/20231222-dma-xilinx-xdma-clang-fixes-v1-1-84a18ff184d2@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clang warns (or errors with CONFIG_WERROR=y):

  drivers/dma/xilinx/xdma.c:757:68: error: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Werror,-Wparentheses]
    757 |                 src_addr += dmaengine_get_src_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;src_inc ?
        |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
  drivers/dma/xilinx/xdma.c:757:68: note: place parentheses around the '+' expression to silence this warning
    757 |                 src_addr += dmaengine_get_src_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;src_inc ?
        |                                                                                  ^
        |                             (                                                   )
  drivers/dma/xilinx/xdma.c:757:68: note: place parentheses around the '?:' expression to evaluate it first
    757 |                 src_addr += dmaengine_get_src_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;src_inc ?
        |                                                                                  ^
        |                                                                      (
    758 |                                                               xt-&gt;sgl[i].size : 0;
        |
        |                                                                                  )
  drivers/dma/xilinx/xdma.c:759:68: error: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Werror,-Wparentheses]
    759 |                 dst_addr += dmaengine_get_dst_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;dst_inc ?
        |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
  drivers/dma/xilinx/xdma.c:759:68: note: place parentheses around the '+' expression to silence this warning
    759 |                 dst_addr += dmaengine_get_dst_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;dst_inc ?
        |                                                                                  ^
        |                             (                                                   )
  drivers/dma/xilinx/xdma.c:759:68: note: place parentheses around the '?:' expression to evaluate it first
    759 |                 dst_addr += dmaengine_get_dst_icg(xt, &amp;xt-&gt;sgl[i]) + xt-&gt;dst_inc ?
        |                                                                                  ^
        |                                                                      (
    760 |                                                               xt-&gt;sgl[i].size : 0;
        |
        |                                                                                  )

The src_inc and dst_inc members of 'struct dma_interleaved_template' are
booleans, so it does not make sense for the addition to happen first.
Wrap the conditional operator in parantheses so it is evaluated first.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1971
Fixes: 2f8f90cd2f8d ("dmaengine: xilinx: xdma: Implement interleaved DMA transfers")
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Link: https://lore.kernel.org/r/20231222-dma-xilinx-xdma-clang-fixes-v1-1-84a18ff184d2@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: statify xdma_prep_interleaved_dma</title>
<updated>2023-12-22T15:47:52+00:00</updated>
<author>
<name>Vinod Koul</name>
<email>vkoul@kernel.org</email>
</author>
<published>2023-12-22T09:40:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3d0b2176e04261ab4ac095ff2a17db077fc1e46d'/>
<id>3d0b2176e04261ab4ac095ff2a17db077fc1e46d</id>
<content type='text'>
xdma_prep_interleaved_dma() was local to file but not declared static,
leading to warning:

drivers/dma/xilinx/xdma.c:729:1: warning: no previous prototype for 'xdma_prep_interleaved_dma' [-Wmissing-prototypes]
  729 | xdma_prep_interleaved_dma(struct dma_chan *chan

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Link: https://lore.kernel.org/r/20231222094001.731889-1-vkoul@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
xdma_prep_interleaved_dma() was local to file but not declared static,
leading to warning:

drivers/dma/xilinx/xdma.c:729:1: warning: no previous prototype for 'xdma_prep_interleaved_dma' [-Wmissing-prototypes]
  729 | xdma_prep_interleaved_dma(struct dma_chan *chan

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Link: https://lore.kernel.org/r/20231222094001.731889-1-vkoul@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: Workaround truncation compilation error</title>
<updated>2023-12-22T15:47:52+00:00</updated>
<author>
<name>Vinod Koul</name>
<email>vkoul@kernel.org</email>
</author>
<published>2023-12-22T09:40:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bbcd7b588b0bf967f90df60fccd16c9c49b768ea'/>
<id>bbcd7b588b0bf967f90df60fccd16c9c49b768ea</id>
<content type='text'>
Increase length to be copied to be large enough to overcome the
following compilation error. The buf is large enough for this purpose.

drivers/dma/xilinx/xilinx_dpdma.c: In function ‘xilinx_dpdma_debugfs_desc_done_irq_read’:
drivers/dma/xilinx/xilinx_dpdma.c:313:39: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  313 |         snprintf(buf, out_str_len, "%d",
      |                                       ^
drivers/dma/xilinx/xilinx_dpdma.c:313:9: note: ‘snprintf’ output between 2 and 6 bytes into a destination of size 5
  313 |         snprintf(buf, out_str_len, "%d",
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  314 |                  dpdma_debugfs.xilinx_dpdma_irq_done_count);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Link: https://lore.kernel.org/r/20231222094017.731917-1-vkoul@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Increase length to be copied to be large enough to overcome the
following compilation error. The buf is large enough for this purpose.

drivers/dma/xilinx/xilinx_dpdma.c: In function ‘xilinx_dpdma_debugfs_desc_done_irq_read’:
drivers/dma/xilinx/xilinx_dpdma.c:313:39: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  313 |         snprintf(buf, out_str_len, "%d",
      |                                       ^
drivers/dma/xilinx/xilinx_dpdma.c:313:9: note: ‘snprintf’ output between 2 and 6 bytes into a destination of size 5
  313 |         snprintf(buf, out_str_len, "%d",
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  314 |                  dpdma_debugfs.xilinx_dpdma_irq_done_count);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Link: https://lore.kernel.org/r/20231222094017.731917-1-vkoul@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: Implement interleaved DMA transfers</title>
<updated>2023-12-22T06:49:41+00:00</updated>
<author>
<name>Jan Kuliga</name>
<email>jankul@alatek.krakow.pl</email>
</author>
<published>2023-12-18T11:39:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2f8f90cd2f8d237c51c2775a53ef0d8c8acaa707'/>
<id>2f8f90cd2f8d237c51c2775a53ef0d8c8acaa707</id>
<content type='text'>
Interleaved DMA functionality allows dmaengine clients' to express
DMA transfers in an arbitrary way. This is extremely useful in FPGA
environments, where a greater transfer flexibility is needed. For
instance, in one FPGA design there may be need to do DMA to/from a FIFO
at a fixed address, and also to do DMA to/from a (non)contiguous RAM
memory.

Introduce separate tx preparation callback and add tx-flags handling
logic. Their behavior is based on the description of interleaved DMA
transfers in both source code and the DMAEngine's documentation.

Since XDMA is a fully-fledged scatter-gather dma engine, the logic of
xdma_prep_interleaved_dma() is fairly simple and similar to the other
tx preparation callbacks. The whole tx-flags handling logic resides in
xdma_channel_isr(). Transfer of a single frame from a interleaved DMA
transfer template is pretty similar to the single sg transaction.
Therefore, the transaction of the whole interleaved DMA transfer
template is basically a cyclic dma transaction with finite cycles/periods
(equal to the frame of count) of a single sg transfers.

Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-9-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Interleaved DMA functionality allows dmaengine clients' to express
DMA transfers in an arbitrary way. This is extremely useful in FPGA
environments, where a greater transfer flexibility is needed. For
instance, in one FPGA design there may be need to do DMA to/from a FIFO
at a fixed address, and also to do DMA to/from a (non)contiguous RAM
memory.

Introduce separate tx preparation callback and add tx-flags handling
logic. Their behavior is based on the description of interleaved DMA
transfers in both source code and the DMAEngine's documentation.

Since XDMA is a fully-fledged scatter-gather dma engine, the logic of
xdma_prep_interleaved_dma() is fairly simple and similar to the other
tx preparation callbacks. The whole tx-flags handling logic resides in
xdma_channel_isr(). Transfer of a single frame from a interleaved DMA
transfer template is pretty similar to the single sg transaction.
Therefore, the transaction of the whole interleaved DMA transfer
template is basically a cyclic dma transaction with finite cycles/periods
(equal to the frame of count) of a single sg transfers.

Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-9-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: Prepare the introduction of interleaved DMA transfers</title>
<updated>2023-12-22T06:49:41+00:00</updated>
<author>
<name>Jan Kuliga</name>
<email>jankul@alatek.krakow.pl</email>
</author>
<published>2023-12-18T11:39:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3e184e64c2e5145e51dc57872b0a64e3a6736888'/>
<id>3e184e64c2e5145e51dc57872b0a64e3a6736888</id>
<content type='text'>
Make generic code generic. As descriptor-filling logic stays the same
regardless of a dmaengine's type of transfer, it is possible to write
the descriptor-filling function in a generic way, so that it can be used
for every single type of transfer preparation callback.

Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-8-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make generic code generic. As descriptor-filling logic stays the same
regardless of a dmaengine's type of transfer, it is possible to write
the descriptor-filling function in a generic way, so that it can be used
for every single type of transfer preparation callback.

Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-8-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: Add transfer error reporting</title>
<updated>2023-12-22T06:49:41+00:00</updated>
<author>
<name>Jan Kuliga</name>
<email>jankul@alatek.krakow.pl</email>
</author>
<published>2023-12-18T11:39:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=fd0e1d83a813d48285d39eae0053b38828cf7e1a'/>
<id>fd0e1d83a813d48285d39eae0053b38828cf7e1a</id>
<content type='text'>
Extend the capability of transfer status reporting. Introduce error flag,
which allows to report error in case of a interrupt-reported error
condition.

Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-7-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Extend the capability of transfer status reporting. Introduce error flag,
which allows to report error in case of a interrupt-reported error
condition.

Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-7-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: Add error checking in xdma_channel_isr()</title>
<updated>2023-12-22T06:49:41+00:00</updated>
<author>
<name>Jan Kuliga</name>
<email>jankul@alatek.krakow.pl</email>
</author>
<published>2023-12-18T11:39:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d0f22a3f55044f91b98e5536aa2c4d51d41cf8e7'/>
<id>d0f22a3f55044f91b98e5536aa2c4d51d41cf8e7</id>
<content type='text'>
Check and clear the status register value before proceeding any
further in xdma_channel_isr(). It is necessary to do it since the
interrupt may occur on any error condition enabled at the start of a
transfer.

Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-6-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Check and clear the status register value before proceeding any
further in xdma_channel_isr(). It is necessary to do it since the
interrupt may occur on any error condition enabled at the start of a
transfer.

Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-6-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dmaengine: xilinx: xdma: Rework xdma_terminate_all()</title>
<updated>2023-12-22T06:48:12+00:00</updated>
<author>
<name>Jan Kuliga</name>
<email>jankul@alatek.krakow.pl</email>
</author>
<published>2023-12-18T11:39:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=855c2e1d1842f0101a051378094548ca581d7a7d'/>
<id>855c2e1d1842f0101a051378094548ca581d7a7d</id>
<content type='text'>
Simplify xdma_xfer_stop(). Stop the dma engine and clear its status
register unconditionally - just do what its name states. This change
also allows to call it without grabbing a lock, which minimizes
the total time spent with a spinlock held.

Delete the currently processed vd.node from the vc.desc_issued list
prior to passing it to vchan_terminate_vdesc(). In case there's more
than one descriptor pending on vc.desc_issued list, calling
vchan_terminate_desc() results in losing the link between
vc.desc_issued list head and the second descriptor on the list. Doing so
results in resources leakege, as vchan_dma_desc_free_list() won't be
able to properly free memory resources attached to descriptors,
resulting in dma_pool_destroy() failure.

Don't call vchan_dma_desc_free_list() from within xdma_terminate_all().
Move all terminated descriptors to the vc.desc_terminated list instead.
This allows to postpone freeing memory resources associated with
descriptors until the call to vchan_synchronize(), which is called from
xdma_synchronize() callback. This is the right way to do it -
xdma_terminate_all() should return as soon as possible, while freeing
resources (that may be time consuming in case of large number of
descriptors) can be done safely later.

Fixes: f5c392d106e7 ("dmaengine: xilinx: xdma: Add terminate_all/synchronize callbacks")
Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-5-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Simplify xdma_xfer_stop(). Stop the dma engine and clear its status
register unconditionally - just do what its name states. This change
also allows to call it without grabbing a lock, which minimizes
the total time spent with a spinlock held.

Delete the currently processed vd.node from the vc.desc_issued list
prior to passing it to vchan_terminate_vdesc(). In case there's more
than one descriptor pending on vc.desc_issued list, calling
vchan_terminate_desc() results in losing the link between
vc.desc_issued list head and the second descriptor on the list. Doing so
results in resources leakege, as vchan_dma_desc_free_list() won't be
able to properly free memory resources attached to descriptors,
resulting in dma_pool_destroy() failure.

Don't call vchan_dma_desc_free_list() from within xdma_terminate_all().
Move all terminated descriptors to the vc.desc_terminated list instead.
This allows to postpone freeing memory resources associated with
descriptors until the call to vchan_synchronize(), which is called from
xdma_synchronize() callback. This is the right way to do it -
xdma_terminate_all() should return as soon as possible, while freeing
resources (that may be time consuming in case of large number of
descriptors) can be done safely later.

Fixes: f5c392d106e7 ("dmaengine: xilinx: xdma: Add terminate_all/synchronize callbacks")
Signed-off-by: Jan Kuliga &lt;jankul@alatek.krakow.pl&gt;
Link: https://lore.kernel.org/r/20231218113943.9099-5-jankul@alatek.krakow.pl
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
