ARM: dma-mapping: avoid calling dma_cache_maint_page() on dev=>cpu
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 3 May 2014 10:06:55 +0000 (11:06 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 22 May 2014 15:33:14 +0000 (16:33 +0100)
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>
arch/arm/mm/dma-mapping.c

index f62aa0677e5c4b69918d1ab36e39fada230d3d59..137463bcbeac4ea2941a907610a450ff72cbb344 100644 (file)
@@ -904,11 +904,12 @@ static void __dma_page_dev_to_cpu(struct page *page, unsigned long off,
        unsigned long paddr = page_to_phys(page) + off;
 
        /* FIXME: non-speculating: not required */
-       /* don't bother invalidating if DMA to device */
-       if (dir != DMA_TO_DEVICE)
+       /* in any case, don't bother invalidating if DMA to device */
+       if (dir != DMA_TO_DEVICE) {
                outer_inv_range(paddr, paddr + size);
 
-       dma_cache_maint_page(page, off, size, dir, dmac_unmap_area);
+               dma_cache_maint_page(page, off, size, dir, dmac_unmap_area);
+       }
 
        /*
         * Mark the D-cache clean for these pages to avoid extra flushing.
This page took 0.02634 seconds and 5 git commands to generate.