>> so,the problem is,can we use wback_inv instead of inv in pci_dma_sync_single
>> when the direction is FROMDEVICE? I don't think so,but that would mean many
>> current drivers are broken...
>If I understand this correctly, a writeback means only modified
>cachelines (i.e. data cache lines with a dirty bit, like 'W', set) will
>be written back to main memory. Since the driver never actually writes
>to any of these buffers (and their contents are invalidated on the
>pci_map_single()), nothing should ever be written back to main memory.
>If this were not the case, you would surely see packet corruption as the
>stale cachelines from a re-used buffer would be written back. I tend not
>to think that it's just coincidence and that MIPS caches tend to be
>So, writeback-invalidate is not incorrect, but it's not efficient for
>all platforms. Ralf explained to me that some CPUs cannot do indexed
>invalidates separately from writebacks.
>I think all three (dma_cache_wback, dma_cache_wback_inv,
>dma_cache_inv) of these calls should be implemented for all CPUs and
>default to dma_cache_wback_inv() if not available. I can come up with a
>patch if people agree (that wback_inv is a suitable replacement for
>either _inv or _wback; MIPS-specific code than can be written to use
>whatever is most optimal if present on that architecture...
Why not? We have many different c-xxx.c for caches anyway.
= = = = = = = = = = = = = = = = = = = =
System Architecture Lab
Institute of Computing Technology
Chinese Academy of Sciences,China