-------- Original-Nachricht --------
> Datum: Thu, 26 Jun 2008 17:29:05 +0800
> Von: Andrew Lewis <[EMAIL PROTECTED]>
> An: linuxppc-dev@ozlabs.org
> CC: \'Andrew Lewis\' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Betreff: [PATCH/RFC] powerpc: prevent memory corruption due to cache  
> invalidation of unaligned DMA buffer

> On PowerPC processors with non-coherent cache architectures the DMA
> subsystem calls invalidate_dcache_range() before performing a DMA read
> operation.  If the address and length of the DMA buffer are not aligned
> to a cache-line boundary this can result in memory outside of the DMA
> buffer being invalidated in the cache.  If this memory has an
> uncommitted store then the data will be lost and a subsequent read of
> that address will result in an old value being returned from main memory.
> 
> Only when the DMA buffer starts on a cache-line boundary and is an exact
> mutiple of the cache-line size can invalidate_dcache_range() be called,
> otherwise flush_dcache_range() must be called.  flush_dcache_range()
> will first flush uncommitted writes, and then invalidate the cache.
I have a similar problem, but with a network driver (which uses cacheable
skbuffers as DMA memory). The SLUB allocator should return cache line
aligned memory, but that doesn't prevent data corruption. I fixed it by
setting NET_SKB_PAD (default 16)  to L1_CACHE_BYTES (32 on my 7455
non coherent DMA system).
It looks like your patch could solve my problem without changing
NET_SKB_PAD. I'll have to try that out.

regards,

Gerhard
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to