aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/dma-noncoherent.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-06-14 16:17:27 +0200
committerChristoph Hellwig <hch@lst.de>2019-06-25 14:28:05 +0200
commitd98849aff87911013aadb730138ab728b52fc547 (patch)
tree14dbf44779970bf7754648fb04c5b2c9bf40ba6f /include/linux/dma-noncoherent.h
parentdma-direct: handle DMA_ATTR_NON_CONSISTENT in common code (diff)
downloadwireguard-linux-d98849aff87911013aadb730138ab728b52fc547.tar.xz
wireguard-linux-d98849aff87911013aadb730138ab728b52fc547.zip
dma-direct: handle DMA_ATTR_NO_KERNEL_MAPPING in common code
DMA_ATTR_NO_KERNEL_MAPPING is generally implemented by allocating normal cacheable pages or CMA memory, and then returning the page pointer as the opaque handle. Lift that code from the xtensa and generic dma remapping implementations into the generic dma-direct code so that we don't even call arch_dma_alloc for these allocations. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/linux/dma-noncoherent.h')
-rw-r--r--include/linux/dma-noncoherent.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
index 732919ac5c11..53ee36ecdf37 100644
--- a/include/linux/dma-noncoherent.h
+++ b/include/linux/dma-noncoherent.h
@@ -28,6 +28,8 @@ static inline bool dma_alloc_need_uncached(struct device *dev,
{
if (dev_is_dma_coherent(dev))
return false;
+ if (attrs & DMA_ATTR_NO_KERNEL_MAPPING)
+ return false;
if (IS_ENABLED(CONFIG_DMA_NONCOHERENT_CACHE_SYNC) &&
(attrs & DMA_ATTR_NON_CONSISTENT))
return false;