<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/dma/cppi41.c, branch v4.11</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.11</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.11'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2017-02-09T12:35:05Z</updated>
<entry>
<title>usb: musb: dsps: Manage CPPI 4.1 DMA interrupt in DSPS</title>
<updated>2017-02-09T12:35:05Z</updated>
<author>
<name>Alexandre Bailon</name>
<email>abailon@baylibre.com</email>
</author>
<published>2017-02-07T04:53:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=255348289f714b96e0e95f9b702f435a638e6fd4'/>
<id>urn:sha1:255348289f714b96e0e95f9b702f435a638e6fd4</id>
<content type='text'>
Despite the CPPI 4.1 is a generic DMA, it is tied to USB.
On the DSPS, CPPI 4.1 interrupt's registers are in USBSS (the MUSB glue).
Currently, to enable / disable and clear interrupts, the CPPI 4.1 driver
maps and accesses to USBSS's register, which making CPPI 4.1 driver not
really generic.
Move the interrupt management to DSPS driver.

Signed-off-by: Alexandre Bailon &lt;abailon@baylibre.com&gt;
Acked-by: Vinod Koul &lt;vinod.koul@intel.com&gt;
Signed-off-by: Bin Liu &lt;b-liu@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>dmaengine: cppi41: Clean up pointless warnings</title>
<updated>2017-01-25T06:00:50Z</updated>
<author>
<name>Tony Lindgren</name>
<email>tony@atomide.com</email>
</author>
<published>2017-01-20T20:07:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6610d0edf6dc7ee97e46ab3a538a565c79d26199'/>
<id>urn:sha1:6610d0edf6dc7ee97e46ab3a538a565c79d26199</id>
<content type='text'>
With patches "dmaengine: cppi41: Fix runtime PM timeouts with USB mass
storage", and "dmaengine: cppi41: Fix oops in cppi41_runtime_resume",
the pm_runtime_get/put() in cppi41_irq() is no longer needed. We now
guarantee that cppi41 is enabled when dma is in use.

We can still get pointless error -115 when musb is configured as a
usb peripheral. That's because we should now check for the state of
is_suspended instead.

Let's just remove the now useless code and replace it with a WARN().

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 oops in cppi41_runtime_resume</title>
<updated>2017-01-25T05:59:22Z</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.shady.money/linux/commit/?id=362f4562466c3b9490e733e06999025638310d4a'/>
<id>urn:sha1:362f4562466c3b9490e733e06999025638310d4a</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>dmaengine: cppi41: Fix runtime PM timeouts with USB mass storage</title>
<updated>2017-01-25T05:59:11Z</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.shady.money/linux/commit/?id=ae4a3e028bb8b59e7cfeb0cc9ef03d885182ce8b'/>
<id>urn:sha1:ae4a3e028bb8b59e7cfeb0cc9ef03d885182ce8b</id>
<content type='text'>
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;
</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.shady.money/linux/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.shady.money/linux/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.shady.money/linux/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>
<entry>
<title>dmaengine: cppi41: Fix list not empty warning on module removal</title>
<updated>2016-11-14T05:27:21Z</updated>
<author>
<name>Tony Lindgren</name>
<email>tony@atomide.com</email>
</author>
<published>2016-11-09T16:47:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=12f5908080bdccca2cb2f7ad850cb360c92f481a'/>
<id>urn:sha1:12f5908080bdccca2cb2f7ad850cb360c92f481a</id>
<content type='text'>
If musb controller is configured with USB peripherals and we have
enumerated with a USB host, we can get warnings on removal of the
modules:

WARNING: CPU: 0 PID: 1269 at drivers/dma/cppi41.c:391
cppi41_dma_free_chan_resources

Fix the issue by adding the missing pm_runtime_get to
cppi41_dma_free_chan_resources to make sure the pending work
list is cleared on removal.

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>
<entry>
<title>Merge branch 'topic/err_reporting' into for-linus</title>
<updated>2016-10-03T03:47:33Z</updated>
<author>
<name>Vinod Koul</name>
<email>vinod.koul@intel.com</email>
</author>
<published>2016-10-03T03:47:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=11bfedff5594eef74617e6aa02986cf517526b98'/>
<id>urn:sha1:11bfedff5594eef74617e6aa02986cf517526b98</id>
<content type='text'>
Signed-off-by: Vinod Koul &lt;vinod.koul@intel.com&gt;

Conflicts:
	drivers/dma/cppi41.c
</content>
</entry>
<entry>
<title>dmaengine: cppi41: Ignore EINPROGRESS for PM runtime</title>
<updated>2016-09-14T13:43:22Z</updated>
<author>
<name>Tony Lindgren</name>
<email>tony@atomide.com</email>
</author>
<published>2016-09-13T17:22:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f2f6f828fc79509d7582d5f338ecf0795250d8b5'/>
<id>urn:sha1:f2f6f828fc79509d7582d5f338ecf0795250d8b5</id>
<content type='text'>
We can occasionally get -EINPROGRESS for pm_runtime_get. In that case
we can just continue as we're queueing transfers anyways when
pm_runtime_active is not set.

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>
