All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: Vinod Koul <vinod.koul@intel.com>
Cc: linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Stephen Warren <swarren@wwwdotorg.org>,
	Lee Jones <lee@kernel.org>,
	dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: bcm2835: Fix polling for completion of DMA with interrupts masked.
Date: Mon, 06 Jun 2016 23:10:38 -0700	[thread overview]
Message-ID: <87k2i1leap.fsf@eliezer.anholt.net> (raw)
In-Reply-To: <20160607052405.GC16910@localhost>

[-- Attachment #1: Type: text/plain, Size: 2362 bytes --]

Vinod Koul <vinod.koul@intel.com> writes:

> On Mon, Jun 06, 2016 at 10:33:18AM -0700, Eric Anholt wrote:
>> Vinod Koul <vinod.koul@intel.com> writes:
>> 
>> > On Fri, Jun 03, 2016 at 07:29:11PM -0700, Eric Anholt wrote:
>> >> The tx_status hook is supposed to be safe to call from interrupt
>> >> context, but it wouldn't ever return completion for the last transfer,
>> >> meaning you couldn't poll for DMA completion with interrupts masked.
>> >
>> > and why is that?
>> 
>> Maybe this was poorly worded.  How about:
>> 
>> The tx_status hook is supposed to be safe to call from interrupt
>> context.  However, the current transfer currently only gets marked
>> complete by the IRQ handler, so if interrupts were masked then polling
>> for completion would never finish.
>
> Sound better :)
>
>> 
>> >> This fixes IRQ handling for bcm2835's DSI1, which requires using the
>> >> DMA engine to write its registers due to a bug in the AXI bridge.
>> >> 
>> >> Signed-off-by: Eric Anholt <eric@anholt.net>
>> >> ---
>> >>  drivers/dma/bcm2835-dma.c | 24 +++++++++++++++++++-----
>> >>  1 file changed, 19 insertions(+), 5 deletions(-)
>> >> 
>> >> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
>> >> index 6149b27c33ad..320461c578e3 100644
>> >> --- a/drivers/dma/bcm2835-dma.c
>> >> +++ b/drivers/dma/bcm2835-dma.c
>> >> @@ -570,16 +570,16 @@ static enum dma_status bcm2835_dma_tx_status(struct dma_chan *chan,
>> >>  	struct virt_dma_desc *vd;
>> >>  	enum dma_status ret;
>> >>  	unsigned long flags;
>> >> +	u32 residue;
>> >>  
>> >>  	ret = dma_cookie_status(chan, cookie, txstate);
>> >> -	if (ret == DMA_COMPLETE || !txstate)
>> >> +	if (ret == DMA_COMPLETE)
>> >
>> > Why do you change this? txstate can be NULL, so no point calculating reside
>> > for those cases
>> 
>> The point was to go into the "Calculate where we're at in our current
>> DMA (if the current DMA is the one we're asking about status for)" path,
>> so that we could note when the DMA is complete even when there's no
>> txstate passed in.
>
> Can you explain what you mean by current DMA!
>
> The claulation is always done for 'descriptor' represnted by the cookie. So
> it doesnt not matter...!

By current I mean the current descriptor that has been submitted to the
hardware, in bcm2835_chan->desc.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: eric@anholt.net (Eric Anholt)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] dmaengine: bcm2835: Fix polling for completion of DMA with interrupts masked.
Date: Mon, 06 Jun 2016 23:10:38 -0700	[thread overview]
Message-ID: <87k2i1leap.fsf@eliezer.anholt.net> (raw)
In-Reply-To: <20160607052405.GC16910@localhost>

Vinod Koul <vinod.koul@intel.com> writes:

> On Mon, Jun 06, 2016 at 10:33:18AM -0700, Eric Anholt wrote:
>> Vinod Koul <vinod.koul@intel.com> writes:
>> 
>> > On Fri, Jun 03, 2016 at 07:29:11PM -0700, Eric Anholt wrote:
>> >> The tx_status hook is supposed to be safe to call from interrupt
>> >> context, but it wouldn't ever return completion for the last transfer,
>> >> meaning you couldn't poll for DMA completion with interrupts masked.
>> >
>> > and why is that?
>> 
>> Maybe this was poorly worded.  How about:
>> 
>> The tx_status hook is supposed to be safe to call from interrupt
>> context.  However, the current transfer currently only gets marked
>> complete by the IRQ handler, so if interrupts were masked then polling
>> for completion would never finish.
>
> Sound better :)
>
>> 
>> >> This fixes IRQ handling for bcm2835's DSI1, which requires using the
>> >> DMA engine to write its registers due to a bug in the AXI bridge.
>> >> 
>> >> Signed-off-by: Eric Anholt <eric@anholt.net>
>> >> ---
>> >>  drivers/dma/bcm2835-dma.c | 24 +++++++++++++++++++-----
>> >>  1 file changed, 19 insertions(+), 5 deletions(-)
>> >> 
>> >> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
>> >> index 6149b27c33ad..320461c578e3 100644
>> >> --- a/drivers/dma/bcm2835-dma.c
>> >> +++ b/drivers/dma/bcm2835-dma.c
>> >> @@ -570,16 +570,16 @@ static enum dma_status bcm2835_dma_tx_status(struct dma_chan *chan,
>> >>  	struct virt_dma_desc *vd;
>> >>  	enum dma_status ret;
>> >>  	unsigned long flags;
>> >> +	u32 residue;
>> >>  
>> >>  	ret = dma_cookie_status(chan, cookie, txstate);
>> >> -	if (ret == DMA_COMPLETE || !txstate)
>> >> +	if (ret == DMA_COMPLETE)
>> >
>> > Why do you change this? txstate can be NULL, so no point calculating reside
>> > for those cases
>> 
>> The point was to go into the "Calculate where we're at in our current
>> DMA (if the current DMA is the one we're asking about status for)" path,
>> so that we could note when the DMA is complete even when there's no
>> txstate passed in.
>
> Can you explain what you mean by current DMA!
>
> The claulation is always done for 'descriptor' represnted by the cookie. So
> it doesnt not matter...!

By current I mean the current descriptor that has been submitted to the
hardware, in bcm2835_chan->desc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160606/8dc60835/attachment-0001.sig>

  reply	other threads:[~2016-06-07  6:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-04  2:29 [PATCH] dmaengine: bcm2835: Fix polling for completion of DMA with interrupts masked Eric Anholt
2016-06-04  2:29 ` Eric Anholt
2016-06-06  4:26 ` Vinod Koul
2016-06-06  4:26   ` Vinod Koul
2016-06-06 17:33   ` Eric Anholt
2016-06-06 17:33     ` Eric Anholt
2016-06-07  5:24     ` Vinod Koul
2016-06-07  5:24       ` Vinod Koul
2016-06-07  6:10       ` Eric Anholt [this message]
2016-06-07  6:10         ` Eric Anholt
2016-06-07  7:21         ` Vinod Koul
2016-06-07  7:21           ` Vinod Koul
2016-06-07 20:56           ` Eric Anholt
2016-06-07 20:56             ` Eric Anholt

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=87k2i1leap.fsf@eliezer.anholt.net \
    --to=eric@anholt.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=swarren@wwwdotorg.org \
    --cc=vinod.koul@intel.com \
    /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 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.