Thread (9 messages) flat view 9 messages, 3 authors, 2012-08-01

About dma_sync_single_for_{cpu,device}

From: Karl Beldan <hidden>
Date: 2012-07-31 08:30:59
Also in: lkml

On Tue, Jul 31, 2012 at 09:34:01AM +0200, Clemens Ladisch wrote:
Karl Beldan wrote:
quoted
On 7/31/12, Clemens Ladisch [off-list ref] wrote:
quoted
Karl Beldan wrote:
quoted
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 !
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help