linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@nvidia.com>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: "ccross@android.com" <ccross@android.com>,
	"olof@lixom.net" <olof@lixom.net>,
	"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH V1] ARM: tegra: dma: Support variable transfer sizes
Date: Thu, 26 Jan 2012 08:53:45 -0800	[thread overview]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF178CB82335@HQMAIL01.nvidia.com> (raw)
In-Reply-To: <4F20B03A.3030303@nvidia.com>

Laxman Dewangan wrote at Wednesday, January 25, 2012 6:46 PM:
> On Wednesday 25 January 2012 10:33 PM, Stephen Warren wrote:
> > Laxman Dewangan wrote at Wednesday, January 25, 2012 4:20 AM:
> >> Allow the transfer size to vary in each DMA request,
> >> rather than assuming all requests to be the same size
> >> as the first request made.
> > ...
> >> diff --git a/arch/arm/mach-tegra/dma.c b/arch/arm/mach-tegra/dma.c
> > ...
> >> @@ -434,6 +435,15 @@ static void tegra_dma_update_hw_partial(struct tegra_dma_channel *ch,
> >>   	writel(apb_ptr, ch->addr + APB_DMA_CHAN_APB_PTR);
> >>   	writel(ahb_ptr, ch->addr + APB_DMA_CHAN_AHB_PTR);
> >>
> >> +	if (ch->mode&  TEGRA_DMA_MODE_CONTINOUS)
> >> +		ch->req_transfer_count = (req->size>>  3) - 1;
> >> +	else
> >> +		ch->req_transfer_count = (req->size>>  2) - 1;
> > There are cases in the current continuous mode where HW is working on
> > one buffer and the next buffer is queued in HW. Once we've written the
> > new request to HW, we don't know exactly which buffer HW is operating
> > on. Hence, we don't know which buffer ch->req_transfer_count refers to.
> > If req->size changes, might this change cause the new req->size value
> > to be used when the old buffer's final completion interrupt goes off
> > and hence the old buffer's req->bytes_transferred be wrong?
> 
> Then byte_transferred should be calculated based on req->size, not based
> on ch->req_transfer_count.

Yes, I think that makes sense.

> Still issue may come when we need to read the transfered count from dma
> through status register whether it has completed the old and started new
> one or still on old req. This can be resolved by having proper lock
> between the isr and reading status so that if isr clears the
> interrupt_done, just raise a flag that int_done arrive and so
> get-active_count() function can handle it properly before workqueu get
> scheduled. I am seeing that there is  missing synchronization between
> int_done status and get_active_count().
> I am also thinking that we can remove the work queue and handle the
> queue management in isr only

So I assume you need to make some/all of those modifications before we can
apply this patch?

> > Actually looking at the current continuous mode, I'm not convinced that
> > it correctly handles replacing an in-progress buffer with a new buffer;
> > I certainly see where handle_continuous_dma() checks for a second (SW)
> > queued buffer and tells the HW to use that buffer instead, but I don't
> > see where the (SW) queue management is done; where is the old req removed
> > from the head of ch->list and marked complete? I assume the "out of sync"
> > case is only intended to be an error condition and not part of the
> > buffer switch?
>
> We are removing the old req from list in handling of full buffer
> interrupt handling.
> 
> 660                 } else if (req->buffer_status ==
> 661                         TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL) {
> :::::::::::::::::::::::::::::::::::::::
> 670                         req->buffer_status =
> TEGRA_DMA_REQ_BUF_STATUS_FULL;
> 671                         req->bytes_transferred = bytes_transferred;
> 672                         req->status = TEGRA_DMA_REQ_SUCCESS;
> 673                         list_del(&req->node);

Oh right... Maybe I'm misunderstanding continuous mode works then; I
thought that the client driver queued a request once, and it continued
to execute forever until either a new request was queued to replace it,
or the original request for dequeued. It looks like instead, the req
is always removed from the queue once we've seen both the ping and the
pong interrupts. Am I totally misunderstanding what's happening?

-- 
nvpublic


  reply	other threads:[~2012-01-26 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 11:19 [PATCH V1] ARM: tegra: dma: Support variable transfer sizes Laxman Dewangan
2012-01-25 17:03 ` Stephen Warren
2012-01-26  1:45   ` Laxman Dewangan
2012-01-26 16:53     ` Stephen Warren [this message]
2012-01-27 10:06       ` Laxman Dewangan

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=74CDBE0F657A3D45AFBB94109FB122FF178CB82335@HQMAIL01.nvidia.com \
    --to=swarren@nvidia.com \
    --cc=ccross@android.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=olof@lixom.net \
    /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).