m68k: Implement arch_dma_prep_coherent()
authorChristoph Hellwig <hch@lst.de>
Tue, 25 Jun 2019 09:01:35 +0000 (11:01 +0200)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 1 Jul 2019 09:17:00 +0000 (11:17 +0200)
When we remap memory as non-cached, to be used as a DMA coherent buffer,
we should writeback all cache and invalidate the cache lines so that we
make sure we have a clean slate.  Implement this using the cache_push()
helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/Kconfig
arch/m68k/kernel/dma.c

index 3a52bf46e0433f658613b04cf6c05aae1b849fe9..00f5c98a5e05d7efe4f24a6c116a53cf64af5848 100644 (file)
@@ -4,6 +4,7 @@ config M68K
        default y
        select ARCH_32BIT_OFF_T
        select ARCH_HAS_DMA_MMAP_PGPROT if MMU && !COLDFIRE
+       select ARCH_HAS_DMA_PREP_COHERENT
        select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
        select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
        select ARCH_NO_COHERENT_DMA_MMAP if !MMU
index e7bf355589e780dc3cf977322433b6bbacad7504..30cd59caf037ee8490097677408532529c123b58 100644 (file)
 #include <asm/pgalloc.h>
 
 #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
+void arch_dma_prep_coherent(struct page *page, size_t size)
+{
+       cache_push(page_to_phys(page), size);
+}
+
 pgprot_t arch_dma_mmap_pgprot(struct device *dev, pgprot_t prot,
                unsigned long attrs)
 {