Message ID | 20181208173702.15158-10-hch@lst.de (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [01/10] dma-direct: provide a generic implementation of DMA_ATTR_NON_CONSISTENT | expand |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 7799c2b27849..8c81fa5d1f44 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -521,7 +521,8 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, BUG_ON(!ops); WARN_ON_ONCE(dev && !dev->coherent_dma_mask); - if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) + if (!(attrs & DMA_ATTR_NON_CONSISTENT) && + dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) return cpu_addr; /* let the implementation decide on the zone to allocate from: */
Memory declared using dma_declare_coherent is ioremapped and thus not always suitable for our tightened DMA_ATTR_NON_CONSISTENT definition. Skip it given all the existing callers don't DMA_ATTR_NON_CONSISTENT anyway. Signed-off-by: Christoph Hellwig <hch@lst.de> --- include/linux/dma-mapping.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)