From: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Laxman Dewangan
<ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 2/3] dmaengine: Add driver for NVIDIA Tegra AHB DMA controller
Date: Mon, 9 Oct 2017 16:09:09 +0530 [thread overview]
Message-ID: <20171009103909.GZ30097@localhost> (raw)
In-Reply-To: <b66c06cb-a63e-b13d-02f4-f7bacfd35112-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On Mon, Oct 09, 2017 at 10:43:54AM +0100, Jon Hunter wrote:
>
>
> On 06/10/17 20:11, Dmitry Osipenko wrote:
> > On 04.10.2017 02:58, Dmitry Osipenko wrote:
> >> AHB DMA controller presents on Tegra20/30 SoC's, it supports transfers
> >> memory <-> AHB bus peripherals as well as mem-to-mem transfers. Driver
> >> doesn't yet implement transfers larger than 64K and scatter-gather
> >> transfers that have NENT > 1, HW doesn't have native support for these
> >> cases, mem-to-mem isn't implemented as well.
> >>
> >> Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >> ---
> >> drivers/dma/Kconfig | 10 +
> >> drivers/dma/Makefile | 1 +
> >> drivers/dma/tegra20-ahb-dma.c | 630 ++++++++++++++++++++++++++++++++++++++++++
> >> 3 files changed, 641 insertions(+)
> >> create mode 100644 drivers/dma/tegra20-ahb-dma.c
>
>
> ...
>
> >> +static struct tegra_ahbdma_tx_desc *tegra_ahbdma_get_next_tx(
> >> + struct tegra_ahbdma_chan *chan)
> >> +{
> >> + struct virt_dma_desc *vdesc = vchan_next_desc(&chan->vchan);
> >> +
> >> + if (vdesc)
> >> + list_del(&vdesc->node);
> >
> > I just noticed that this is incorrect. Node must be deleted after TX completion,
> > otherwise vchan_find_desc won't find TX and residual won't be reported by
> > dmaengine_tx_status.
> >
> > Jon, I think you ADMA driver has the same issue, as well as several other DMA
> > drivers that use virt-dma.
>
> Actually, I think that the above is correct. If vchan_find_desc() finds
> the descriptor then this indicates that the transfer has not started yet
> and so the residual is equal to the transfer size.
That is correct, so you can do a quick calculation and find the residue only
for current one
> If you look at the adma driver, you will see the if vchan_find_desc()
> does not find the descriptor, then we check to see if the current
> transfer is the one we are querying and if so return the bytes
> remaining. Looking at this driver again, what you have in
> tegra_ahbdma_tx_status() does not look correct. You should have
> something like ...
>
> vdesc = vchan_find_desc(&ahbdma_chan->vchan, cookie);
> if (vdesc) {
> tx = to_ahbdma_tx_desc(vdesc);
> residual = tx->csr & AHBDMA_CH_WCOUNT_MASK;
> } else if (ahbdma_chan->tx_active &&
> ahbdma_chan->tx_active->vd.tx.cookie == cookie) {
> residual = tegra_ahbdma_residual(ahbdma_chan);
> } else {
> residual = 0;
> }
>
> Cheers
> Jon
>
> --
> nvpublic
--
~Vinod
next prev parent reply other threads:[~2017-10-09 10:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 23:58 [PATCH v2 0/3] NVIDIA Tegra AHB DMA controller driver Dmitry Osipenko
[not found] ` <cover.1507073384.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03 23:58 ` [PATCH v2 1/3] dt-bindings: Add DT binding for NVIDIA Tegra AHB DMA controller Dmitry Osipenko
[not found] ` <ecf2e8248dc7b88e5fd04bebe8071027f538a40d.1507073384.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06 9:10 ` Jon Hunter
[not found] ` <542f69a2-5d70-47ae-8c04-2089b50cad30-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-06 11:40 ` Dmitry Osipenko
2017-10-06 13:56 ` Jon Hunter
[not found] ` <03810975-7eb0-aa79-964f-dcbcbaf9e4b4-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-06 15:27 ` Dmitry Osipenko
2017-10-03 23:58 ` [PATCH v2 2/3] dmaengine: Add driver " Dmitry Osipenko
[not found] ` <9ef93a0054a6a2e27b72e5bfeebe81e5ab11a224.1507073384.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06 13:11 ` Jon Hunter
[not found] ` <58f8c049-4408-d6a7-7452-f5be8041b7b5-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-06 15:26 ` Dmitry Osipenko
[not found] ` <72374a74-f6bd-256f-73c0-fa970a2e1576-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06 15:50 ` Jon Hunter
[not found] ` <d4885545-6af1-b240-a197-1ed530cc4172-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-06 17:23 ` Dmitry Osipenko
[not found] ` <fc684b85-b4a7-c68d-613c-adbe0b154c6c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06 19:25 ` Dmitry Osipenko
2017-10-09 9:51 ` Jon Hunter
[not found] ` <dd49d752-039a-464d-1638-08323d637f5a-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-09 13:28 ` Dmitry Osipenko
2017-10-06 18:02 ` Dmitry Osipenko
2017-10-06 19:11 ` Dmitry Osipenko
[not found] ` <CAOQPn8s50+XyGr2s3sQh5+qhek2n0A=3CT49YNJyftLv1pP=vg@mail.gmail.com>
[not found] ` <CAOQPn8s50+XyGr2s3sQh5+qhek2n0A=3CT49YNJyftLv1pP=vg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-07 12:43 ` Dmitry Osipenko
[not found] ` <7c44b44b-ddfa-ad67-cf18-ce182e424ea5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-07 14:42 ` Eric Pilmore (GigaIO)
[not found] ` <DDFFA839-AC6C-45AE-9536-5C68BC2DE82A-Op3I1peydIbQT0dZR+AlfA@public.gmane.org>
2017-10-07 15:50 ` Dmitry Osipenko
[not found] ` <35dd2e3a-1f97-b82e-4763-a9d064761bc8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-09 9:43 ` Jon Hunter
[not found] ` <b66c06cb-a63e-b13d-02f4-f7bacfd35112-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-09 10:39 ` Vinod Koul [this message]
2017-10-09 11:43 ` Dmitry Osipenko
2017-10-03 23:58 ` [PATCH v2 3/3] ARM: dts: tegra: Add AHB DMA controller nodes Dmitry Osipenko
2017-12-13 3:41 ` [PATCH v2 0/3] NVIDIA Tegra AHB DMA controller driver Dmitry Osipenko
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=20171009103909.GZ30097@localhost \
--to=vinod.koul-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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