Message ID | 20140917160337.GA15261@e104818-lin.cambridge.arm.com |
---|---|
State | New |
Headers | show |
On 09/17/2014 12:03 PM, Catalin Marinas wrote: > So for arm64 currently we have some hooks in dma-mapping.c to intercept > when a device is added to a bus. What I need to do though is check > recursively whether the parent (bus) had the 'dma-coherent' property > (pointed out by Jon). I think something like this would do (not tested): We've got a patch now that I posted internally and we've tested. I've asked Mark Salter to send it upstream (but hey, you'll probably just want to switch the default over to recurse up the tree and then simply add a new notifier register for pci_bus_type). For this stuff to work, we need v10 of the APM X-Gene patches because (as I noticed earlier when going through their code and testing on a board with an actual card - and a modified devicetree node for the PCI root) that's the point they add a call to setup the root of_nodes correctly via pci_scan_root_bus. Prior to that the trivially obvious patch for dma-coherent doesn't work. Today, there are two platform PCIe devices that do it right, plus the latest APM rev of their driver just posted. Jon. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 4164c5ace9f8..638475378f94 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -316,7 +316,7 @@ static int dma_bus_notifier(struct notifier_block *nb, if (event != BUS_NOTIFY_ADD_DEVICE) return NOTIFY_DONE; - if (of_property_read_bool(dev->of_node, "dma-coherent")) + if (of_dma_is_coherent(dev->of_node)) set_dma_ops(dev, &coherent_swiotlb_dma_ops); return NOTIFY_OK;