[09/10] dma-mapping: skip declared coherent memory for DMA_ATTR_NON_CONSISTENT
Commit Message
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(-)
@@ -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: */