diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2015-05-20 20:34:09 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2015-05-22 08:31:03 -0400 |
commit | 81cc6edc08705ac0146fe6ac14a0982a31ce6f3d (patch) | |
tree | a2f9eba6363f198527f5553aef5ed72a005c10fc /drivers/dma | |
parent | 5ebe6afaf0057ac3eaeb98defd5456894b446d22 (diff) |
dmaengine: pl330: Fix hang on dmaengine_terminate_all on certain boards
The pl330 device could hang infinitely on certain boards when DMA
channels are terminated.
It was caused by lack of runtime resume when executing
pl330_terminate_all() which calls the _stop() function. _stop() accesses
device register and can loop infinitely while checking for device state.
The hang was confirmed by Dinh Nguyen on Altera SOCFPGA Cyclone V
board during boot. It can be also triggered with:
$ echo 1 > /sys/module/dmatest/parameters/iterations
$ echo dma1chan0 > /sys/module/dmatest/parameters/channel
$ echo 1 > /sys/module/dmatest/parameters/run
$ sleep 1
$ cat /sys/module/dmatest/parameters/run
Reported-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12")
Cc: <stable@vger.kernel.org>
Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/pl330.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index a7d9d3029b14..340f9e607cd8 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -2127,6 +2127,7 @@ static int pl330_terminate_all(struct dma_chan *chan) | |||
2127 | struct pl330_dmac *pl330 = pch->dmac; | 2127 | struct pl330_dmac *pl330 = pch->dmac; |
2128 | LIST_HEAD(list); | 2128 | LIST_HEAD(list); |
2129 | 2129 | ||
2130 | pm_runtime_get_sync(pl330->ddma.dev); | ||
2130 | spin_lock_irqsave(&pch->lock, flags); | 2131 | spin_lock_irqsave(&pch->lock, flags); |
2131 | spin_lock(&pl330->lock); | 2132 | spin_lock(&pl330->lock); |
2132 | _stop(pch->thread); | 2133 | _stop(pch->thread); |
@@ -2151,6 +2152,8 @@ static int pl330_terminate_all(struct dma_chan *chan) | |||
2151 | list_splice_tail_init(&pch->work_list, &pl330->desc_pool); | 2152 | list_splice_tail_init(&pch->work_list, &pl330->desc_pool); |
2152 | list_splice_tail_init(&pch->completed_list, &pl330->desc_pool); | 2153 | list_splice_tail_init(&pch->completed_list, &pl330->desc_pool); |
2153 | spin_unlock_irqrestore(&pch->lock, flags); | 2154 | spin_unlock_irqrestore(&pch->lock, flags); |
2155 | pm_runtime_mark_last_busy(pl330->ddma.dev); | ||
2156 | pm_runtime_put_autosuspend(pl330->ddma.dev); | ||
2154 | 2157 | ||
2155 | return 0; | 2158 | return 0; |
2156 | } | 2159 | } |