dmaengine: pl330: Return DMA_PAUSED when transaction is paused
commit 8cda3ececf07d374774f6a13e5a94bc2dc04c26c upstream.
pl330_pause() does not set anything to indicate paused condition which
causes pl330_tx_status() to return DMA_IN_PROGRESS. This breaks 8250
DMA flush after the fix in commit 57e9af7831dc ("serial: 8250_dma: Fix
DMA Rx rearm race"). The function comment for pl330_pause() claims
pause is supported but resume is not which is enough for 8250 DMA flush
to work as long as DMA status reports DMA_PAUSED when appropriate.
Add PAUSED state for descriptor and mark BUSY descriptors with PAUSED
in pl330_pause(). Return DMA_PAUSED from pl330_tx_status() when the
descriptor is PAUSED.
Reported-by: Richard Tresidder <rtresidd@electromag.com.au>
Tested-by: Richard Tresidder <rtresidd@electromag.com.au>
Fixes: 88987d2c75
("dmaengine: pl330: add DMA_PAUSE feature")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/linux-serial/f8a86ecd-64b1-573f-c2fa-59f541083f1a@electromag.com.au/
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230526105434.14959-1-ilpo.jarvinen@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
7328c5319e
commit
8362ad5367
@@ -403,6 +403,12 @@ enum desc_status {
|
|||||||
* of a channel can be BUSY at any time.
|
* of a channel can be BUSY at any time.
|
||||||
*/
|
*/
|
||||||
BUSY,
|
BUSY,
|
||||||
|
/*
|
||||||
|
* Pause was called while descriptor was BUSY. Due to hardware
|
||||||
|
* limitations, only termination is possible for descriptors
|
||||||
|
* that have been paused.
|
||||||
|
*/
|
||||||
|
PAUSED,
|
||||||
/*
|
/*
|
||||||
* Sitting on the channel work_list but xfer done
|
* Sitting on the channel work_list but xfer done
|
||||||
* by PL330 core
|
* by PL330 core
|
||||||
@@ -2043,7 +2049,7 @@ static inline void fill_queue(struct dma_pl330_chan *pch)
|
|||||||
list_for_each_entry(desc, &pch->work_list, node) {
|
list_for_each_entry(desc, &pch->work_list, node) {
|
||||||
|
|
||||||
/* If already submitted */
|
/* If already submitted */
|
||||||
if (desc->status == BUSY)
|
if (desc->status == BUSY || desc->status == PAUSED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = pl330_submit_req(pch->thread, desc);
|
ret = pl330_submit_req(pch->thread, desc);
|
||||||
@@ -2328,6 +2334,7 @@ static int pl330_pause(struct dma_chan *chan)
|
|||||||
{
|
{
|
||||||
struct dma_pl330_chan *pch = to_pchan(chan);
|
struct dma_pl330_chan *pch = to_pchan(chan);
|
||||||
struct pl330_dmac *pl330 = pch->dmac;
|
struct pl330_dmac *pl330 = pch->dmac;
|
||||||
|
struct dma_pl330_desc *desc;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
pm_runtime_get_sync(pl330->ddma.dev);
|
pm_runtime_get_sync(pl330->ddma.dev);
|
||||||
@@ -2337,6 +2344,10 @@ static int pl330_pause(struct dma_chan *chan)
|
|||||||
_stop(pch->thread);
|
_stop(pch->thread);
|
||||||
spin_unlock(&pl330->lock);
|
spin_unlock(&pl330->lock);
|
||||||
|
|
||||||
|
list_for_each_entry(desc, &pch->work_list, node) {
|
||||||
|
if (desc->status == BUSY)
|
||||||
|
desc->status = PAUSED;
|
||||||
|
}
|
||||||
spin_unlock_irqrestore(&pch->lock, flags);
|
spin_unlock_irqrestore(&pch->lock, flags);
|
||||||
pm_runtime_mark_last_busy(pl330->ddma.dev);
|
pm_runtime_mark_last_busy(pl330->ddma.dev);
|
||||||
pm_runtime_put_autosuspend(pl330->ddma.dev);
|
pm_runtime_put_autosuspend(pl330->ddma.dev);
|
||||||
@@ -2427,7 +2438,7 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
|
|||||||
else if (running && desc == running)
|
else if (running && desc == running)
|
||||||
transferred =
|
transferred =
|
||||||
pl330_get_current_xferred_count(pch, desc);
|
pl330_get_current_xferred_count(pch, desc);
|
||||||
else if (desc->status == BUSY)
|
else if (desc->status == BUSY || desc->status == PAUSED)
|
||||||
/*
|
/*
|
||||||
* Busy but not running means either just enqueued,
|
* Busy but not running means either just enqueued,
|
||||||
* or finished and not yet marked done
|
* or finished and not yet marked done
|
||||||
@@ -2444,6 +2455,9 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
|
|||||||
case DONE:
|
case DONE:
|
||||||
ret = DMA_COMPLETE;
|
ret = DMA_COMPLETE;
|
||||||
break;
|
break;
|
||||||
|
case PAUSED:
|
||||||
|
ret = DMA_PAUSED;
|
||||||
|
break;
|
||||||
case PREP:
|
case PREP:
|
||||||
case BUSY:
|
case BUSY:
|
||||||
ret = DMA_IN_PROGRESS;
|
ret = DMA_IN_PROGRESS;
|
||||||
|
Reference in New Issue
Block a user