Roland> Just to make sure I'm reading this correctly, you're
Roland> saying that as long as a buffer is OK for DMA, it should
Roland> be OK to use a sub-cache-line chunk as a DMA buffer via
Roland> pci_map_single(), and accessing the rest of the cache line
Roland> should be OK at any time before, during and after the DMA.
David> Yes.
Roland> What alternate implementation are you proposing?
David> For non-cacheline aligned chunks in the range "start" to
David> "end" you must perform a cache writeback and invalidate. To
David> preserve the data outside of the DMA range.
Doesn't this still have a problem if you touch data in the same cache
line as the DMA buffer after the pci_map but before the DMA takes
place? The CPU will pull the cache line back in and it might not see
the data the DMA brought in.
It seems to me that to be totally safe, pci_unmap would have to save
the non-aligned part outside the buffer to temporary storage, do an
invalidate, and then copy back the non-aligned part.
In any case if this is what pci_map is supposed to do then we have to
fix up several architectures at least...
Thanks,
Roland
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/