<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/dma, branch v4.9.16</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.16</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.16'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-03-15T02:02:49Z</updated>
<entry>
<title>dmaengine: imx-sdma - correct the dma transfer residue calculation</title>
<updated>2017-03-15T02:02:49Z</updated>
<author>
<name>Nandor Han</name>
<email>nandor.han@ge.com</email>
</author>
<published>2016-10-11T11:13:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3a654a85932fa7a909b11934df7657c1a2cb3609'/>
<id>urn:sha1:3a654a85932fa7a909b11934df7657c1a2cb3609</id>
<content type='text'>
commit 85f57752b33cf12f1d583f0c10b752292de00abe upstream.

The residue calculation was taking in consideration that dma
transaction status will be always retrieved in the dma callback
used to inform that dma transfer is complete. However this is not
the case for all subsystems that use dma. Some subsystems use a
timer to check the dma status periodically.

Therefore the calculation was updated and residue is calculated
accordingly by a) update the residue calculation taking in
consideration the last used buffer index by using *buf_ptail* variable
and b) chn_real_count (number of bytes transferred) is initialized to
zero, when dma channel is created, to avoid using an uninitialized
value in residue calculation when dma status is checked without
waiting dma complete event.

Signed-off-by: Nandor Han &lt;nandor.han@ge.com&gt;
Acked-by: Peter Senna Tschudin &lt;peter.senna@collabora.com&gt;
Tested-by: Peter Senna Tschudin &lt;peter.senna@collabora.com&gt;
Tested-by: Marek Vasut &lt;marex@denx.de&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Cc: Fabio Estevam &lt;festevam@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dmaengine: ipu: Make sure the interrupt routine checks all interrupts.</title>
<updated>2017-03-12T05:41:52Z</updated>
<author>
<name>Magnus Lilja</name>
<email>lilja.magnus@gmail.com</email>
</author>
<published>2016-12-21T21:13:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=788d81d4e5d43ffc2dbcd4513dfec2808f5ff616'/>
<id>urn:sha1:788d81d4e5d43ffc2dbcd4513dfec2808f5ff616</id>
<content type='text'>
commit adee40b265d7568296e218f079f478197ffa15bf upstream.

Commit 3d8cc00073d6 ("dmaengine: ipu: Consolidate duplicated irq handlers")
consolidated the two interrupts routines into one, but the remaining
interrupt routine only checks the status of the error interrupts, not the
normal interrupts.

This patch fixes that problem (tested on i.MX31 PDK board).

Fixes: 3d8cc00073d6 ("dmaengine: ipu: Consolidate duplicated irq handlers")
Cc: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Magnus Lilja &lt;lilja.magnus@gmail.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dmaengine: cppi41: Fix oops in cppi41_runtime_resume</title>
<updated>2017-02-09T07:08:29Z</updated>
<author>
<name>Tony Lindgren</name>
<email>tony@atomide.com</email>
</author>
<published>2017-01-19T16:49:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bc05a2e940fe96fbacf879e73139d8a66c39ab8e'/>
<id>urn:sha1:bc05a2e940fe96fbacf879e73139d8a66c39ab8e</id>
<content type='text'>
commit 362f4562466c3b9490e733e06999025638310d4a upstream.

Commit fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
together with recent MUSB changes allowed USB and DMA on BeagleBone to idle
when no cable is connected. But looks like few corner case issues still
remain.

Looks like just by re-plugging USB cable about ten or so times on BeagleBone
when configured in USB peripheral mode we can get warnings and eventually
trigger an oops in cppi41 DMA:

WARNING: CPU: 0 PID: 14 at drivers/dma/cppi41.c:1154 cppi41_runtime_suspend+
x28/0x38 [cppi41]
...

WARNING: CPU: 0 PID: 14 at drivers/dma/cppi41.c:452
push_desc_queue+0x94/0x9c [cppi41]
...

Unable to handle kernel NULL pointer dereference at virtual
address 00000104
pgd = c0004000
[00000104] *pgd=00000000
Internal error: Oops: 805 [#1] SMP ARM
...
[&lt;bf0d92cc&gt;] (cppi41_runtime_resume [cppi41]) from [&lt;c0589838&gt;]
(__rpm_callback+0xc0/0x214)
[&lt;c0589838&gt;] (__rpm_callback) from [&lt;c05899ac&gt;] (rpm_callback+0x20/0x80)
[&lt;c05899ac&gt;] (rpm_callback) from [&lt;c0589460&gt;] (rpm_resume+0x504/0x78c)
[&lt;c0589460&gt;] (rpm_resume) from [&lt;c058a1a0&gt;] (pm_runtime_work+0x60/0xa8)
[&lt;c058a1a0&gt;] (pm_runtime_work) from [&lt;c0156120&gt;] (process_one_work+0x2b4/0x808)

This is because of a race with runtime PM and cppi41_dma_issue_pending()
as reported by Alexandre Bailon &lt;abailon@baylibre.com&gt; in earlier
set of patches. Based on mailing list discussions we however came to the
conclusion that a different fix from Alexandre's fix is needed in order
to guarantee that DMA is really active when we try to use it.

To fix the issue, we need to add a driver specific flag as we otherwise
can have -EINPROGRESS state set by runtime PM and can't rely on
pm_runtime_active() to tell us when we can use the DMA.

And we need to make sure the DMA transfers get triggered in the queued
order. So let's always queue the transfers, then flush the queue
from both cppi41_dma_issue_pending() and cppi41_runtime_resume()
as suggested by Grygorii Strashko &lt;grygorii.strashko@ti.com&gt; in an
earlier example patch.

For reference, this is also documented in Documentation/power/runtime_pm.txt
in the example at the end of the file as pointed out by Grygorii Strashko
&lt;grygorii.strashko@ti.com&gt;.

Based on earlier patches from Alexandre Bailon &lt;abailon@baylibre.com&gt;
and Grygorii Strashko &lt;grygorii.strashko@ti.com&gt; modified based on
testing and what was discussed on the mailing lists.

Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Cc: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Cc: Bin Liu &lt;b-liu@ti.com&gt;
Cc: Grygorii Strashko &lt;grygorii.strashko@ti.com&gt;
Cc: Kevin Hilman &lt;khilman@baylibre.com&gt;
Cc: Patrick Titiano &lt;ptitiano@baylibre.com&gt;
Cc: Sergei Shtylyov &lt;sergei.shtylyov@cogentembedded.com&gt;
Reported-by: Alexandre Bailon &lt;abailon@baylibre.com&gt;
Signed-off-by: Tony Lindgren &lt;tony@atomide.com&gt;
Tested-by: Bin Liu &lt;b-liu@ti.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dmaengine: cppi41: Fix runtime PM timeouts with USB mass storage</title>
<updated>2017-02-09T07:08:29Z</updated>
<author>
<name>Tony Lindgren</name>
<email>tony@atomide.com</email>
</author>
<published>2017-01-19T16:49:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2c2e7fe7c9c5524914772b2d44febbf5b98546d3'/>
<id>urn:sha1:2c2e7fe7c9c5524914772b2d44febbf5b98546d3</id>
<content type='text'>
commit ae4a3e028bb8b59e7cfeb0cc9ef03d885182ce8b upstream.

Commit fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
added runtime PM support for cppi41, but had corner case issues. Some of
the issues were fixed with commit 098de42ad670 ("dmaengine: cppi41: Fix
unpaired pm runtime when only a USB hub is connected"). That fix however
caused a new regression where we can get error -115 messages with USB on
BeagleBone when connecting a USB mass storage device to a hub.

This is because when connecting a USB mass storage device to a hub, the
initial DMA transfers can take over 200ms to complete and cppi41
autosuspend delay times out.

To fix the issue, we want to implement refcounting for chan_busy array
that contains the active dma transfers. Increasing the autosuspend delay
won't help as that the delay could be potentially seconds, and it's best
to let the USB subsystem to deal with the timeouts on errors.

The earlier attempt for runtime PM was buggy as the pm_runtime_get/put()
calls could get unpaired easily as they did not follow the state of
the chan_busy array as described in commit 098de42ad670 ("dmaengine:
cppi41: Fix unpaired pm runtime when only a USB hub is connected".

Let's fix the issue by adding pm_runtime_get() to where a new transfer
is added to the chan_busy array, and calls to pm_runtime_put() where
chan_busy array entry is cleared. This prevents any autosuspend timeouts
from happening while dma transfers are active.

Fixes: 098de42ad670 ("dmaengine: cppi41: Fix unpaired pm runtime when
only a USB hub is connected")
Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Cc: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Cc: Bin Liu &lt;b-liu@ti.com&gt;
Cc: Grygorii Strashko &lt;grygorii.strashko@ti.com&gt;
Cc: Kevin Hilman &lt;khilman@baylibre.com&gt;
Cc: Patrick Titiano &lt;ptitiano@baylibre.com&gt;
Cc: Sergei Shtylyov &lt;sergei.shtylyov@cogentembedded.com&gt;
Signed-off-by: Tony Lindgren &lt;tony@atomide.com&gt;
Tested-by: Bin Liu &lt;b-liu@ti.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dmaengine: pl330: Fix runtime PM support for terminated transfers</title>
<updated>2017-01-26T07:24:45Z</updated>
<author>
<name>Marek Szyprowski</name>
<email>m.szyprowski@samsung.com</email>
</author>
<published>2016-12-16T10:39:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d21814a8068ae5a006453f6c2c0b687a87249b24'/>
<id>urn:sha1:d21814a8068ae5a006453f6c2c0b687a87249b24</id>
<content type='text'>
commit 5c9e6c2b2ba3ec3a442e2fb5b4286498f8b4dcb7 upstream.

PL330 DMA engine driver is leaking a runtime reference after any terminated
DMA transactions. This patch fixes this issue by tracking runtime PM state
of the device and making additional call to pm_runtime_put() in terminate_all
callback if needed.

Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12")
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Reviewed-by: Krzysztof Kozlowski &lt;krzk@kernel.org&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dmaengine: rcar-dmac: unmap slave resource when channel is freed</title>
<updated>2017-01-26T07:24:45Z</updated>
<author>
<name>Niklas Söderlund</name>
<email>niklas.soderlund+renesas@ragnatech.se</email>
</author>
<published>2017-01-11T14:39:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=172270c743487ec24cc145949a77bd57136ffff9'/>
<id>urn:sha1:172270c743487ec24cc145949a77bd57136ffff9</id>
<content type='text'>
commit 3139dc8ded6f27552a248d23fe9f086e3027fa12 upstream.

The slave mapping should be removed together with other channel
resources when the channel is freed. If it's not unmapped it will hang
around forever after the channel is freed.

Fixes: 9f878603dbdb7db3 ("dmaengine: rcar-dmac: add iommu support for slave transfers")
Reported-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Niklas Söderlund &lt;niklas.soderlund+renesas@ragnatech.se&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dmaengine: omap-dma: Fix dynamic lch_map allocation</title>
<updated>2017-01-19T19:18:03Z</updated>
<author>
<name>Peter Ujfalusi</name>
<email>peter.ujfalusi@ti.com</email>
</author>
<published>2017-01-02T10:07:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6c6ae8c43df99284b3260082b43b5858b701bd5e'/>
<id>urn:sha1:6c6ae8c43df99284b3260082b43b5858b701bd5e</id>
<content type='text'>
commit 836c3ce2566fb8c1754f8d7c9534cad9bc8a6879 upstream.

The original patch did not done what it was supposed to be doing and even
worst it broke legacy boot (OMAP1).

The lch_map size should be the number of available logical channels in sDMA
and the od-&gt;dma_requests should store the number of available DMA request
lines usable in sDMA.

In legacy mode we do not have a way to get the DMA request count, in that
case we use OMAP_SDMA_REQUESTS (127), despite the fact that OMAP1510 have
only 31 DMA request line.

Fixes: 2d1a9a946fae ("dmaengine: omap-dma: Dynamically allocate memory for lch_map")
Reported-by: Aaro Koskinen &lt;aaro.koskinen@iki.fi&gt;
Signed-off-by: Peter Ujfalusi &lt;peter.ujfalusi@ti.com&gt;
Tested-by: Aaro Koskinen &lt;aaro.koskinen@iki.fi&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dmaengine: cppi41: More PM runtime fixes</title>
<updated>2016-11-17T10:39:23Z</updated>
<author>
<name>Tony Lindgren</name>
<email>tony@atomide.com</email>
</author>
<published>2016-11-16T18:24:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d5afc1b68a6ddc27746d31f775025afe75ec8122'/>
<id>urn:sha1:d5afc1b68a6ddc27746d31f775025afe75ec8122</id>
<content type='text'>
Fix use of u32 instead of int for checking for negative errors values
as pointed out by Dan Carpenter &lt;dan.carpenter@oracle.com&gt;.

And while testing the PM runtime error path by randomly returning
failed values in runtime resume, I noticed two more places that need
fixing:

- If pm_runtime_get_sync() fails in probe, we still need to do
  pm_runtime_put_sync() to keep the use count happy. We could call
  pm_runtime_put_noidle() on the error path, but we're just going
  to call pm_runtime_disable() after that so pm_runtime_put_sync()
  will do what we want

- We should print an error if pm_runtime_get_sync() fails in
  cppi41_dma_alloc_chan_resources() so we know where it happens

Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Fixes: 740b4be3f742 ("dmaengine: cpp41: Fix handling of error path")
Signed-off-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
</content>
</entry>
<entry>
<title>dmaengine: cpp41: Fix handling of error path</title>
<updated>2016-11-14T08:30:16Z</updated>
<author>
<name>Tony Lindgren</name>
<email>tony@atomide.com</email>
</author>
<published>2016-11-11T19:28:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=740b4be3f742100ea66f0f9ee9715b10ee304a90'/>
<id>urn:sha1:740b4be3f742100ea66f0f9ee9715b10ee304a90</id>
<content type='text'>
If we return early on pm_runtime_get() error, we need to also call
pm_runtime_put_noidle() as pointed out in a musb related thread
by Johan Hovold &lt;johan@kernel.org&gt;. This is to keep the PM runtime
use counts happy.

Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Cc: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
</content>
</entry>
<entry>
<title>dmaengine: cppi41: Fix unpaired pm runtime when only a USB hub is connected</title>
<updated>2016-11-14T05:27:32Z</updated>
<author>
<name>Tony Lindgren</name>
<email>tony@atomide.com</email>
</author>
<published>2016-11-09T16:47:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=098de42ad6708866501a00155ba85350bc0b29e5'/>
<id>urn:sha1:098de42ad6708866501a00155ba85350bc0b29e5</id>
<content type='text'>
On am335x with musb host we can end up with unpaired pm runtime calls
if a hub with no devices is connected and disconnected.

This is because of the conditional pm runtime calls which are always
a bad idea. Let's fix the issue by making them unconditional and
paired in each function.

Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Signed-off-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
</content>
</entry>
</feed>
