Thread (14 messages) 14 messages, 3 authors, 2015-01-28
STALE4159d

[PATCH v5 8/8] of: limit dma_mask of the device based on dma-range size

From: Murali Karicheri <hidden>
Date: 2015-01-27 21:03:27
Also in: linux-arm-kernel, linux-iommu, linux-pci, lkml
Subsystem: open firmware and flattened device tree, the rest · Maintainers: Rob Herring, Saravana Kannan, Linus Torvalds

limit the device dma_mask to the min of default dma_mask and
mask calculate from the dma-range size.

Cc: Joerg Roedel <redacted>
Cc: Grant Likely <redacted>
Cc: Rob Herring <redacted>
Cc: Bjorn Helgaas <redacted>
Cc: Will Deacon <redacted>
Cc: Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Cc: Arnd Bergmann <redacted>
Cc: Suravee Suthikulpanit <redacted>

Signed-off-by: Murali Karicheri <redacted>
---
 drivers/of/device.c |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 17504f4..bcb8a35 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -128,6 +128,9 @@ void of_dma_configure(struct device *dev, struct device_node *np)
 	dev_dbg(dev, "device is%sbehind an iommu\n",
 		iommu ? " " : " not ");
 
+	/* limit dma_mask to the lower of the two values */
+	*dev->dma_mask = min((*dev->dma_mask), (dma_addr + size - 1));
+
 	arch_setup_dma_ops(dev, dma_addr, size, iommu, coherent);
 }
 EXPORT_SYMBOL_GPL(of_dma_configure);
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help