/* * The affected CPUs below in 'cpu_needs_post_dma_flush()' can speculatively * fill random cachelines with stale data at any time, requiring an extra * flush post-DMA. * * Warning on the terminology - Linux calls an uncached area coherent; MIPS * terminology calls memory areas with hardware maintained coherency coherent. * * Note that the R14000 and R16000 should also be checked for in this condition. * However this function is only called on non-I/O-coherent systems and only the * R10000 and R12000 are used in such systems, the SGI IP28 Indigo² rsp. * SGI IP32 aka O2.
*/ staticinlinebool cpu_needs_post_dma_flush(void)
{ switch (boot_cpu_type()) { case CPU_R10000: case CPU_R12000: case CPU_BMIPS5000: case CPU_LOONGSON2EF: case CPU_XBURST: returntrue; default: /* * Presence of MAARs suggests that the CPU supports * speculatively prefetching data, and therefore requires * the post-DMA flush/invalidate.
*/ return cpu_has_maar;
}
}
staticinlinevoid dma_sync_virt_for_cpu(void *addr, size_t size, enum dma_data_direction dir)
{ switch (dir) { case DMA_TO_DEVICE: break; case DMA_FROM_DEVICE: case DMA_BIDIRECTIONAL:
dma_cache_inv((unsignedlong)addr, size); break; default:
BUG();
}
}
/* * A single sg entry may refer to multiple physically contiguous pages. But * we still need to process highmem pages individually. If highmem is not * configured then the bulk of this loop gets optimized out.
*/ staticinlinevoid dma_sync_phys(phys_addr_t paddr, size_t size, enum dma_data_direction dir, bool for_device)
{ struct page *page = pfn_to_page(paddr >> PAGE_SHIFT); unsignedlong offset = paddr & ~PAGE_MASK;
size_t left = size;
do {
size_t len = left; void *addr;
if (PageHighMem(page)) { if (offset + len > PAGE_SIZE)
len = PAGE_SIZE - offset;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.