* [PATCH] dmaengine: pl330: fix residual for non-running BUSY descriptors
@ 2016-08-19 0:59 Stephen Barber
2016-09-09 11:49 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Barber @ 2016-08-19 0:59 UTC (permalink / raw)
To: Vinod Koul
Cc: Dan Williams, dmaengine, linux-kernel, Douglas Anderson,
Hsin-Yu Chao, Stephen Barber
Only one descriptor in the work list should be running at
any given time, but it's possible to have an enqueued BUSY
descriptor that has not yet transferred any data, or for
a BUSY descriptor to linger briefly before transitioning
to DONE. These cases should be handled to keep residual
calculations consistent even with the non-running BUSY
descriptors in the work list.
Signed-off-by: Stephen Barber <smbarber@chromium.org>
---
drivers/dma/pl330.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 372b435..ff8f889 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2274,7 +2274,7 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
{
enum dma_status ret;
unsigned long flags;
- struct dma_pl330_desc *desc, *running = NULL;
+ struct dma_pl330_desc *desc, *running = NULL, *last_enq = NULL;
struct dma_pl330_chan *pch = to_pchan(chan);
unsigned int transferred, residual = 0;
@@ -2291,6 +2291,8 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
if (pch->thread->req_running != -1)
running = pch->thread->req[pch->thread->req_running].desc;
+ last_enq = pch->thread->req[pch->thread->lstenq].desc;
+
/* Check in pending list */
list_for_each_entry(desc, &pch->work_list, node) {
if (desc->status == DONE)
@@ -2298,6 +2300,15 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
else if (running && desc == running)
transferred =
pl330_get_current_xferred_count(pch, desc);
+ else if (desc->status == BUSY)
+ /*
+ * Busy but not running means either just enqueued,
+ * or finished and not yet marked done
+ */
+ if (desc == last_enq)
+ transferred = 0;
+ else
+ transferred = desc->bytes_requested;
else
transferred = 0;
residual += desc->bytes_requested - transferred;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dmaengine: pl330: fix residual for non-running BUSY descriptors
2016-08-19 0:59 [PATCH] dmaengine: pl330: fix residual for non-running BUSY descriptors Stephen Barber
@ 2016-09-09 11:49 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2016-09-09 11:49 UTC (permalink / raw)
To: Stephen Barber
Cc: Dan Williams, dmaengine, linux-kernel, Douglas Anderson, Hsin-Yu Chao
On Thu, Aug 18, 2016 at 05:59:59PM -0700, Stephen Barber wrote:
> Only one descriptor in the work list should be running at
> any given time, but it's possible to have an enqueued BUSY
> descriptor that has not yet transferred any data, or for
> a BUSY descriptor to linger briefly before transitioning
> to DONE. These cases should be handled to keep residual
> calculations consistent even with the non-running BUSY
> descriptors in the work list.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-09 11:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19 0:59 [PATCH] dmaengine: pl330: fix residual for non-running BUSY descriptors Stephen Barber
2016-09-09 11:49 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.