summaryrefslogtreecommitdiffstats
path: root/kernel/dma
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-02-21 12:35:05 -0800
committerChristoph Hellwig <hch@lst.de>2020-03-16 10:48:12 +0100
commit999a5d1203baa7cff00586361feae263ee3f23a5 (patch)
treeb04c578a71b961394e7fe87567684bf0caefbe8b /kernel/dma
parentfa7e2247c5729f990c7456fe09f3af99c8f2571b (diff)
downloadlinux-999a5d1203baa7cff00586361feae263ee3f23a5.tar.gz
linux-999a5d1203baa7cff00586361feae263ee3f23a5.tar.bz2
linux-999a5d1203baa7cff00586361feae263ee3f23a5.zip
dma-direct: provide a arch_dma_clear_uncached hook
This allows the arch code to reset the page tables to cached access when freeing a dma coherent allocation that was set to uncached using arch_dma_set_uncached. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/direct.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index baf4e93735c3..412f560dc69f 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -231,6 +231,8 @@ void dma_direct_free_pages(struct device *dev, size_t size, void *cpu_addr,
if (IS_ENABLED(CONFIG_DMA_REMAP) && is_vmalloc_addr(cpu_addr))
vunmap(cpu_addr);
+ else if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_CLEAR_UNCACHED))
+ arch_dma_clear_uncached(cpu_addr, size);
dma_free_contiguous(dev, dma_direct_to_page(dev, dma_addr), size);
}