[PATCH 20/34] dma-mapping: warn when there is no coherent_dma_mask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx
- Subject: [PATCH 20/34] dma-mapping: warn when there is no coherent_dma_mask
- From: Christoph Hellwig <hch@xxxxxx>
- Date: Fri, 12 Jan 2018 09:42:18 +0100
- Cc: Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx>, linux-alpha@xxxxxxxxxxxxxxx, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-c6x-dev@xxxxxxxxxxxxx, linux-cris-kernel@xxxxxxxx, linux-hexagon@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-metag@xxxxxxxxxxxxxxx, Michal Simek <monstr@xxxxxxxxx>, linux-mips@xxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, patches@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, Guan Xuetao <gxt@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
- In-reply-to: <20180112084232.2857-1-hch@lst.de>
- References: <20180112084232.2857-1-hch@lst.de>
These days all devices should have a DMA coherent mask, and most dma_ops
implementations rely on that fact. But just to be sure add an assert to
ring the warning bell if that is not the case.
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Vladimir Murzin <vladimir.murzin@xxxxxxx>
---
include/linux/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index d84951865be7..9f28b2fa329e 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -513,6 +513,7 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size,
void *cpu_addr;
BUG_ON(!ops);
+ WARN_ON_ONCE(!dev->coherent_dma_mask);
if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
return cpu_addr;
--
2.14.2
--
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]