From: zonque@gmail•com (Daniel Mack)
To: linux-arm-kernel@lists•infradead.org
Subject: [v3 1/2] dma: mmp_pdma: add support for residue reporting
Date: Thu, 15 Aug 2013 05:44:24 +0200 [thread overview]
Message-ID: <520C4E98.6020001@gmail.com> (raw)
In-Reply-To: <CADApbegKj=AMGx4OFOBVsyk71BGis97Gw9QM_-0EsNi90pS+Hw@mail.gmail.com>
Hi Chao,
On 15.08.2013 03:57, Chao Xie wrote:
> On Thu, Aug 15, 2013 at 12:19 AM, Daniel Mack <zonque@gmail•com> wrote:
>> +static unsigned int mmp_pdma_residue(struct mmp_pdma_chan *chan)
>> +{
>> + struct mmp_pdma_desc_sw *sw;
>> + u32 curr, done = 0;
>> +
>> + if (chan->dir == DMA_DEV_TO_MEM)
>> + curr = readl(chan->phy->base + DTADR(chan->phy->idx));
>> + else
>> + curr = readl(chan->phy->base + DSADR(chan->phy->idx));
>> +
>> + list_for_each_entry(sw, &chan->chain_running, node) {
>> + u32 start;
>> + u32 len = sw->desc.dcmd & DCMD_LENGTH;
>> +
>> + if (chan->dir == DMA_DEV_TO_MEM)
>> + start = sw->desc.dtadr;
>> + else
>> + start = sw->desc.dsadr;
>> +
>> + if (curr >= start && curr <= (start + len)) {
>> + done += curr - start;
>> + break;
>> + }
>> +
>> + done += len;
>> + }
>> +
>> + return chan->total_len - done;
>> +}
>> +
>
> It seems that you will get all the residue bytes in the channel.
> For DMA transfer, user may submit many trasaction.
> The transaction will be composed by mutiple desctiptors. So it means
> that chan->chain_running includes
> the descriptors from all ongoing transactions.
> When user try to get the tx_status, user will pass the cookie to
> identify which transaction it want to get the status.
> So for mmp_pdma_residue, it need care about the cookie, and find out
> the transaction, then calculate the residue bytes.
Ok, right.
> The orignal driver has a issue, it will assign cookie for all
> descriptors, not the transaction. I think that need to be changed.
Not necessarily. If all the linked descriptors are assigned the same
cookie, we can as well just walk all entries in chain_running and ignore
the ones that don't match the cookie we're looking for,
The problem with your proposed approach is that the driver will
currently dispose desc->tx_list via list_splice_tail_init() once the
transaction has been submitted, so we can't access it later. But what I
have in mind should work equally well. I'll post an updated patch later.
Thanks for the review,
Daniel
next prev parent reply other threads:[~2013-08-15 3:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 16:19 [v3 1/2] dma: mmp_pdma: add support for residue reporting Daniel Mack
2013-08-14 16:23 ` Russell King - ARM Linux
2013-08-15 1:57 ` Chao Xie
2013-08-15 3:44 ` Daniel Mack [this message]
2013-08-15 8:08 ` Chao Xie
2013-08-15 18:12 ` Daniel Mack
2013-08-16 2:21 ` Chao Xie
2013-08-16 7:57 ` Xiang Wang
2013-08-16 15:40 ` Daniel Mack
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=520C4E98.6020001@gmail.com \
--to=zonque@gmail$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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