[PATCH] armv6: invalidate cache on DMA_FROM_DEVICE/DMA_BIDIRECTIONAL
Russell King - ARM Linux
linux at arm.linux.org.uk
Mon Dec 21 16:29:35 EST 2009
On Mon, Dec 21, 2009 at 12:47:56PM +0000, Jamie Iles wrote:
> On Mon, Dec 21, 2009 at 12:44:38PM +0000, Russell King - ARM Linux wrote:
> > On Mon, Dec 21, 2009 at 09:08:17AM +0000, Jamie Iles wrote:
> > > Some ARMv6 cores will use speculative prefetching. This can be a problem
> > > when devices DMA to memory and the core prefetches data before the
> > > device has written it. This can result in stale data being stored in the
> > > cache. The DMA API will request the invalidation but this is currently a
> > > no-op on v6. Use the same dma_unmap_area implementation as for v7.
> > >
> > > Additionally, simplify v6_dma_map_area() so that we clean the cache lines
> > > for DMA_TO_DEVICE and DMA_FROM_DEVICE but don't do any invalidation. This
> > > will be done when we unmap.
> >
> > I was thinking about doing this for ARMv6, but I thought the concensus
> > was that ARMv6 didn't have speculative prefetching.
> I couldn't find the words in the TRM that categorically stated it either way,
> but on the 1176JZ-S platform that I'm using this definitely needs to be done.
> >
> > Nevertheless, the patch is fine, can I just combine it with the other
> > DMA patches - it is after all just a copy of the ARMv7 code.
> Sure, fine with me.
Actually, it isn't - on map, you don't invalidate at all for
DMA_FROM_DEVICE which means dirty writebacks can corrupt DMA.
I'll copy what I did for ARMv7 to ARMv6.
More information about the linux-arm-kernel
mailing list