On 15/04/16 19:29, Timur Tabi wrote:
On Thu, Apr 14, 2016 at 12:25 PM, Lorenzo Pieralisi
<lorenzo.pieralisi@xxxxxxx> wrote:
+void acpi_dma_configure(struct device *dev, enum dev_dma_attr attr)
+{
+ struct iommu_ops *iommu;
+
+ iommu = iort_iommu_configure(dev);
+
+ /*
+ * Assume dma valid range starts at 0 and covers the whole
+ * coherent_dma_mask.
+ */
+ arch_setup_dma_ops(dev, 0, dev->coherent_dma_mask + 1, iommu,
+ attr == DEV_DMA_COHERENT);
+}
I have a network driver that is impacted by this code, so thank you
for posting this. (See
https://www.mail-archive.com/netdev@xxxxxxxxxxxxxxx/msg106249.html).
One one SOC, the driver needs to set the mask to 32 bits. On another
SOC, it needs to set it to 64 bits. On device tree, the driver will
use dma-ranges.
That's the wrong way to look at it - the driver isn't _using_
dma-ranges, you're merely relying on the OF code setting the _default_
DMA mask differently based on the property. If your driver is in the
minority of those which actually care about DMA masks, then it should be
calling dma_set_mask_and_coherent() appropriately and not relying on the
default.