Hi all,
I have a memory area which is written by the CPU and concurrently read
by a DMA capable device, multiple times.
Among else there are two fields in the memory area, both are 32 bits
wide. Whenever the CPU updates the fields, I have to make sure that the
device does not get to see a new value in field B before I updated field
A. Conversely, it is safe to update field A anytime before field B. The
driver has no way to know when the device is going to read any of the
fields.
My question: Do I need wmb() within the following code?
dma_sync_single_for_cpu(..., DMA_TO_DEVICE);
area->a = new_val_a;
wmb(); /* necessary? */
area->b = new_val_b;
dma_sync_single_for_device(..., DMA_TO_DEVICE);
Or are all changes to the area hidden from the device between
dma_sync_single_for_cpu and _for_device, thereby making the write order
a non-issue? Thanks,
--
Stefan Richter
-=====-=-==- -=== -=--=
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]