linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: torfl6749@gmail.com (Torsten Fleischer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH linux-next 1/1] dmaengine: at_hdmac: fix residue computation
Date: Fri, 19 Jun 2015 10:04:44 +0200	[thread overview]
Message-ID: <1922467.ZSxkKTyNbQ@linux-1fbo.site> (raw)
In-Reply-To: <2899583.NPB62C1E0l@linux-1fbo.site>

On Tuesday 16 June 2015 at 18:11:56 Torsten Fleischer wrote:
> On Monday 15 June 2015 at 17:17:51 Cyrille Pitchen wrote:
[...]
> > @@ -365,16 +371,13 @@ static int atc_get_bytes_left(struct dma_chan *chan,
> > dma_cookie_t cookie) }
> > 
> >  		/*
> > 
> > -		 * For the last descriptor in the chain we can calculate
> > +		 * For the current descriptor in the chain we can calculate
> > 
> >  		 * the remaining bytes using the channel's register.
> > 
> > -		 * Note that the transfer width of the first and last
> > -		 * descriptor may differ.
> > 
> >  		 */
> > 
> > -		if (!desc->lli.dscr)
> > -			ret = atc_calc_bytes_left_from_reg(ret, atchan, desc);
> > +		ret = atc_calc_bytes_left_from_reg(ret, atchan);
> 
> I see two issues here.
> 
> First this always returns the number if remaining bytes of the current child
> transfer and not of the entire hardware linked list transfer.
> 
Oops, I was wrong with the first issue. Please ignore this.
Sorry for that.

> Finally, for the calculation of the remaining bytes of a hardware linked
> list the value of DSCR is used to get the current child transfer.
> But regarding to a running DMA transfer, reading DSCR and CTRLA is not
> atomic. If you read CTRLA after DSCR then the value may not refer to the
> child transfer as read from DSCR, but to a subsequent one.
> Its only safe for the first transfer where CTRLA is read before DSCR and for
> the last transfer where CTRLA is read after DSCR.
> 
> >  	} else {
> >  	
> >  		/* single transfer */
> > 
> > -		ret = atc_calc_bytes_left_from_reg(ret, atchan, desc_first);
> > +		ret = atc_calc_bytes_left_from_reg(ret, atchan);
> > 
> >  	}
> >  	
> >  	return ret;
> > 
[...]

Regards,

Torsten

      reply	other threads:[~2015-06-19  8:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 15:17 [PATCH linux-next 0/1] dmaengine: at_hdmac: fix residue computation Cyrille Pitchen
2015-06-15 15:17 ` [PATCH linux-next 1/1] " Cyrille Pitchen
2015-06-16 16:11   ` Torsten Fleischer
2015-06-19  8:04     ` Torsten Fleischer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1922467.ZSxkKTyNbQ@linux-1fbo.site \
    --to=torfl6749@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).