All of lore.kernel.org
 help / color / mirror / Atom feed
From: karl.beldan@gmail.com (Karl Beldan)
To: linux-arm-kernel@lists.infradead.org
Subject: About dma_sync_single_for_{cpu,device}
Date: Tue, 31 Jul 2012 10:30:22 +0200	[thread overview]
Message-ID: <20120731083022.GA5026@ed-laptop> (raw)
In-Reply-To: <50178A69.8050906@ladisch.de>

On Tue, Jul 31, 2012 at 09:34:01AM +0200, Clemens Ladisch wrote:
> Karl Beldan wrote:
> > On 7/31/12, Clemens Ladisch <clemens@ladisch.de> wrote:
> >> Karl Beldan wrote:
> >>> To tx a chunk of data from the SoC => network device, we :
> >>> - prepare a buffer with a leading header embedding a pattern,
> >>> - trigger the xfer and wait for an irq
> >>> // The device updates the pattern and then triggers an irq
> >>> - upon irq we check the pattern for the xfer completion
> >>>
> >>> I was expecting the following to work:
> >>> 	addr = dma_map_single(dev, buffer, size, DMA_TO_DEVICE);
> >>
> >> Of both the CPU and the device write to the buffer, you must use
> >> DMA_BIDIRECTIONAL.
> >
> > This does not work (tested) :  seems to me BIDIRECTIONAL would just
> > add invalidate, and invalidate before the ram has been updated, as
> > stated, does not work.
> 
> Please show the exact sequence of dma_* calls, and also show when and
> how the CPU and the device access the buffer.
> 
Hmm, so I just spotted a line where we peek in the buffer after
invalidating .. cannot believe I missed it .. so sorry for the noise ..
now it's working.
I felt I would find the culprit right after posting ;)
Thanks Clemens !

WARNING: multiple messages have this Message-ID (diff)
From: Karl Beldan <karl.beldan@gmail.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: About dma_sync_single_for_{cpu,device}
Date: Tue, 31 Jul 2012 10:30:22 +0200	[thread overview]
Message-ID: <20120731083022.GA5026@ed-laptop> (raw)
In-Reply-To: <50178A69.8050906@ladisch.de>

On Tue, Jul 31, 2012 at 09:34:01AM +0200, Clemens Ladisch wrote:
> Karl Beldan wrote:
> > On 7/31/12, Clemens Ladisch <clemens@ladisch.de> wrote:
> >> Karl Beldan wrote:
> >>> To tx a chunk of data from the SoC => network device, we :
> >>> - prepare a buffer with a leading header embedding a pattern,
> >>> - trigger the xfer and wait for an irq
> >>> // The device updates the pattern and then triggers an irq
> >>> - upon irq we check the pattern for the xfer completion
> >>>
> >>> I was expecting the following to work:
> >>> 	addr = dma_map_single(dev, buffer, size, DMA_TO_DEVICE);
> >>
> >> Of both the CPU and the device write to the buffer, you must use
> >> DMA_BIDIRECTIONAL.
> >
> > This does not work (tested) :  seems to me BIDIRECTIONAL would just
> > add invalidate, and invalidate before the ram has been updated, as
> > stated, does not work.
> 
> Please show the exact sequence of dma_* calls, and also show when and
> how the CPU and the device access the buffer.
> 
Hmm, so I just spotted a line where we peek in the buffer after
invalidating .. cannot believe I missed it .. so sorry for the noise ..
now it's working.
I felt I would find the culprit right after posting ;)
Thanks Clemens !

  reply	other threads:[~2012-07-31  8:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 20:24 About dma_sync_single_for_{cpu,device} karl.beldan
2012-07-30 20:34 ` karl.beldan
2012-07-31  6:45 ` Karl Beldan
2012-07-31  6:45   ` Karl Beldan
2012-07-31  6:59   ` Clemens Ladisch
2012-07-31  6:59     ` Clemens Ladisch
2012-07-31  7:27     ` Karl Beldan
2012-07-31  7:27       ` Karl Beldan
2012-07-31  7:34       ` Clemens Ladisch
2012-07-31  7:34         ` Clemens Ladisch
2012-07-31  8:30         ` Karl Beldan [this message]
2012-07-31  8:30           ` Karl Beldan
2012-07-31  9:09   ` Russell King - ARM Linux
2012-07-31  9:09     ` Russell King - ARM Linux
2012-07-31 19:31     ` Karl Beldan
2012-07-31 19:31       ` Karl Beldan
2012-07-31 20:08       ` Russell King - ARM Linux
2012-07-31 20:08         ` Russell King - ARM Linux
2012-08-01  6:50         ` Karl Beldan
2012-08-01  6:50           ` Karl Beldan

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=20120731083022.GA5026@ed-laptop \
    --to=karl.beldan@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 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.