Skip to content

Commit deace4a

Browse files
author
Russell King
committed
ARM: dma-mapping: avoid calling dma_cache_maint_page() on dev=>cpu
Avoid calling dma_cache_maint_page() when unmapping a DMA_TO_DEVICE buffer. The L1 cache ops never do anything in this circumstance, nor do they ever need to - all that matters for this case is that the data written is visible to the device before DMA starts. What happens during the transfer (provided the buffer is not written to) is of no real consequence. We already do this optimisation for the L2 cache. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 86f4062 commit deace4a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arch/arm/mm/dma-mapping.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,11 +904,12 @@ static void __dma_page_dev_to_cpu(struct page *page, unsigned long off,
904904
unsigned long paddr = page_to_phys(page) + off;
905905

906906
/* FIXME: non-speculating: not required */
907-
/* don't bother invalidating if DMA to device */
908-
if (dir != DMA_TO_DEVICE)
907+
/* in any case, don't bother invalidating if DMA to device */
908+
if (dir != DMA_TO_DEVICE) {
909909
outer_inv_range(paddr, paddr + size);
910910

911-
dma_cache_maint_page(page, off, size, dir, dmac_unmap_area);
911+
dma_cache_maint_page(page, off, size, dir, dmac_unmap_area);
912+
}
912913

913914
/*
914915
* Mark the D-cache clean for these pages to avoid extra flushing.

0 commit comments

Comments
 (0)