<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pm24.git/drivers/dma/sf-pdma, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>https://git.kobert.dev/pm24.git/atom/drivers/dma/sf-pdma?h=master</id>
<link rel='self' href='https://git.kobert.dev/pm24.git/atom/drivers/dma/sf-pdma?h=master'/>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/'/>
<updated>2024-10-21T17:37:08Z</updated>
<entry>
<title>dmaengine: fix typo in the comment</title>
<updated>2024-10-21T17:37:08Z</updated>
<author>
<name>Yan Zhen</name>
<email>yanzhen@vivo.com</email>
</author>
<published>2024-09-18T03:41:14Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=39d283d146922a266e8196e7fd29b31feff528be'/>
<id>urn:sha1:39d283d146922a266e8196e7fd29b31feff528be</id>
<content type='text'>
Correctly spelled comments make it easier for the reader to understand
the code.

Replace 'enngine' with 'engine' in the comment &amp;
replace 'trascatioin' with 'transaction' in the comment &amp;
replace 'descripter' with 'descriptor' in the comment &amp;
replace 'descritpor' with 'descriptor' in the comment &amp;
replace 'rgisters' with 'registers' in the comment.

Signed-off-by: Yan Zhen &lt;yanzhen@vivo.com&gt;
Acked-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Link: https://lore.kernel.org/r/20240918034114.860132-1-yanzhen@vivo.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: Switch back to struct platform_driver::remove()</title>
<updated>2024-10-14T18:20:34Z</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@baylibre.com</email>
</author>
<published>2024-10-04T06:22:27Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=76355c25e4f71ee4667ebaadd9faf8ec29d18f23'/>
<id>urn:sha1:76355c25e4f71ee4667ebaadd9faf8ec29d18f23</id>
<content type='text'>
After commit 0edb555a65d1 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/dma after the previous
conversion commits apart from the wireless drivers to use .remove(),
with the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@baylibre.com&gt;
Link: https://lore.kernel.org/r/20241004062227.187726-2-u.kleine-koenig@baylibre.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: sf-pdma: add mpfs-pdma compatible name</title>
<updated>2023-12-11T11:03:22Z</updated>
<author>
<name>Shravan Chippa</name>
<email>shravan.chippa@microchip.com</email>
</author>
<published>2023-12-08T10:38:55Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=58eea79a1cf285a62af886851b1a91ed5aceb401'/>
<id>urn:sha1:58eea79a1cf285a62af886851b1a91ed5aceb401</id>
<content type='text'>
Sifive platform dma (sf-pdma) has both in-order and out-of-order
configurations but sf-pdam driver configured to do in-order DMA
transfers, with out-of-order configuration got better throughput
in the PolarFire SoC platform.

Add a PolarFire SoC specific compatible and code to support
for out-of-order dma transfers

Reviewed-by: Emil Renner Berthing &lt;emil.renner.berthing@canonical.com&gt;
Signed-off-by: Shravan Chippa &lt;shravan.chippa@microchip.com&gt;
Link: https://lore.kernel.org/r/20231208103856.3732998-4-shravan.chippa@microchip.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: sf-pdma: Support of_dma_controller_register()</title>
<updated>2023-12-11T11:03:22Z</updated>
<author>
<name>Shravan Chippa</name>
<email>shravan.chippa@microchip.com</email>
</author>
<published>2023-12-08T10:38:53Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=8e578b47e6d92d5e43982ddc54045973dd4a7de5'/>
<id>urn:sha1:8e578b47e6d92d5e43982ddc54045973dd4a7de5</id>
<content type='text'>
Update sf-pdma driver to adopt generic DMA device tree bindings.
It calls of_dma_controller_register() with of_dma_xlate_by_chan_id
to get the generic DMA device tree helper support and the DMA
clients can look up the sf-pdma controller using standard APIs.

Signed-off-by: Shravan Chippa &lt;shravan.chippa@microchip.com&gt;
Link: https://lore.kernel.org/r/20231208103856.3732998-2-shravan.chippa@microchip.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: sf-pdma: Annotate struct sf_pdma with __counted_by</title>
<updated>2023-09-28T11:12:14Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2023-08-17T23:58:46Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=1539a22e144106eefc0ef05e7b91f68ad20a71ad'/>
<id>urn:sha1:1539a22e144106eefc0ef05e7b91f68ad20a71ad</id>
<content type='text'>
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct sf_pdma.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Vinod Koul &lt;vkoul@kernel.org&gt;
Cc: Green Wan &lt;green.wan@sifive.com&gt;
Cc: dmaengine@vger.kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: "Gustavo A. R. Silva" &lt;gustavoars@kernel.org&gt;
Link: https://lore.kernel.org/r/20230817235859.49846-9-keescook@chromium.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: sf-pdma: sf-pdma: Convert to platform remove callback returning void</title>
<updated>2023-09-28T07:40:54Z</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2023-09-19T13:31:46Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=3d97deeb3b3077b3a6f9636f3ea312fef7f54059'/>
<id>urn:sha1:3d97deeb3b3077b3a6f9636f3ea312fef7f54059</id>
<content type='text'>
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20230919133207.1400430-39-u.kleine-koenig@pengutronix.de
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: sf-pdma: pdma_desc memory leak fix</title>
<updated>2023-02-16T13:15:48Z</updated>
<author>
<name>Shravan Chippa</name>
<email>shravan.chippa@microchip.com</email>
</author>
<published>2023-01-20T10:06:23Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=b02e07015a5ac7bbc029da931ae17914b8ae0339'/>
<id>urn:sha1:b02e07015a5ac7bbc029da931ae17914b8ae0339</id>
<content type='text'>
Commit b2cc5c465c2c ("dmaengine: sf-pdma: Add multithread support for a
DMA channel") changed sf_pdma_prep_dma_memcpy() to unconditionally
allocate a new sf_pdma_desc each time it is called.

The driver previously recycled descs, by checking the in_use flag, only
allocating additional descs if the existing one was in use. This logic
was removed in commit b2cc5c465c2c ("dmaengine: sf-pdma: Add multithread
support for a DMA channel"), but sf_pdma_free_desc() was not changed to
handle the new behaviour.

As a result, each time sf_pdma_prep_dma_memcpy() is called, the previous
descriptor is leaked, over time leading to memory starvation:

  unreferenced object 0xffffffe008447300 (size 192):
  comm "irq/39-mchp_dsc", pid 343, jiffies 4294906910 (age 981.200s)
  hex dump (first 32 bytes):
    00 00 00 ff 00 00 00 00 b8 c1 00 00 00 00 00 00  ................
    00 00 70 08 10 00 00 00 00 00 00 c0 00 00 00 00  ..p.............
  backtrace:
    [&lt;00000000064a04f4&gt;] kmemleak_alloc+0x1e/0x28
    [&lt;00000000018927a7&gt;] kmem_cache_alloc+0x11e/0x178
    [&lt;000000002aea8d16&gt;] sf_pdma_prep_dma_memcpy+0x40/0x112

Add the missing kfree() to sf_pdma_free_desc(), and remove the redundant
in_use flag.

Fixes: b2cc5c465c2c ("dmaengine: sf-pdma: Add multithread support for a DMA channel")
Signed-off-by: Shravan Chippa &lt;shravan.chippa@microchip.com&gt;
Reviewed-by: Conor Dooley &lt;conor.dooley@microchip.com&gt;
Link: https://lore.kernel.org/r/20230120100623.3530634-1-shravan.chippa@microchip.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: drivers: Use devm_platform_ioremap_resource()</title>
<updated>2023-01-18T16:46:47Z</updated>
<author>
<name>Tudor Ambarus</name>
<email>tudor.ambarus@microchip.com</email>
</author>
<published>2022-11-10T15:25:28Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=4b23603a251d24022f2fa48ee67610eb245a4115'/>
<id>urn:sha1:4b23603a251d24022f2fa48ee67610eb245a4115</id>
<content type='text'>
platform_get_resource() and devm_ioremap_resource() are wrapped up in the
devm_platform_ioremap_resource() helper. Use the helper and get rid of the
local variable for struct resource *. We now have a function call less.

Signed-off-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Acked-by: Jernej Skrabec &lt;jernej.skrabec@gmail.com&gt;
Acked-by: Peter Ujfalusi &lt;peter.ujfalusi@gmail.com&gt;
Link: https://lore.kernel.org/r/20221110152528.7821-1-tudor.ambarus@microchip.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: sf-pdma:Remove the print function dev_err()</title>
<updated>2022-09-05T06:20:38Z</updated>
<author>
<name>ye xingchen</name>
<email>ye.xingchen@zte.com.cn</email>
</author>
<published>2022-08-10T06:25:32Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=7d81afd2690400f8fb7d9bec0532624562634766'/>
<id>urn:sha1:7d81afd2690400f8fb7d9bec0532624562634766</id>
<content type='text'>
&gt;From the coccinelle check:

./drivers/dma/sf-pdma/sf-pdma.c
Error:line 409 is redundant because platform_get_irq() already prints an
error

./drivers/dma/sf-pdma/sf-pdma.c
Error:line 424 is redundant because platform_get_irq() already prints an
error

So,remove the unnecessary print function dev_err()

Reported-by: Zeal Robot &lt;zealci@zte.com.cn&gt;
Signed-off-by: ye xingchen &lt;ye.xingchen@zte.com.cn&gt;
Link: https://lore.kernel.org/r/20220810062532.13425-1-ye.xingchen@zte.com.cn
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: sf-pdma: Add multithread support for a DMA channel</title>
<updated>2022-07-06T12:40:34Z</updated>
<author>
<name>Viacheslav Mitrofanov</name>
<email>v.v.mitrofanov@yadro.com</email>
</author>
<published>2022-07-01T08:29:42Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=b2cc5c465c2cb8ab697c3fd6583c614e3f6cfbcc'/>
<id>urn:sha1:b2cc5c465c2cb8ab697c3fd6583c614e3f6cfbcc</id>
<content type='text'>
When we get a DMA channel and try to use it in multiple threads it
will cause oops and hanging the system.

% echo 64 &gt; /sys/module/dmatest/parameters/threads_per_chan
% echo 10000 &gt; /sys/module/dmatest/parameters/iterations
% echo 1 &gt; /sys/module/dmatest/parameters/run
[   89.480664] Unable to handle kernel NULL pointer dereference at virtual
               address 00000000000000a0
[   89.488725] Oops [#1]
[   89.494708] CPU: 2 PID: 1008 Comm: dma0chan0-copy0 Not tainted
               5.17.0-rc5
[   89.509385] epc : vchan_find_desc+0x32/0x46
[   89.513553]  ra : sf_pdma_tx_status+0xca/0xd6

This happens because of data race. Each thread rewrite channels's
descriptor as soon as device_prep_dma_memcpy() is called. It leads to the
situation when the driver thinks that it uses right descriptor that
actually is freed or substituted for other one.

With current fixes a descriptor changes its value only when it has
been used. A new descriptor is acquired from vc-&gt;desc_issued queue that
is already filled with descriptors that are ready to be sent. Threads
have no direct access to DMA channel descriptor. Now it is just possible
to queue a descriptor for further processing.

Fixes: 6973886ad58e ("dmaengine: sf-pdma: add platform DMA support for HiFive Unleashed A00")
Signed-off-by: Viacheslav Mitrofanov &lt;v.v.mitrofanov@yadro.com&gt;
Link: https://lore.kernel.org/r/20220701082942.12835-1-v.v.mitrofanov@yadro.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
</feed>
