Hi Stephen, Hiroshi Doyu <hdoyu@xxxxxxxxxx> wrote @ Wed, 6 Nov 2013 15:06:23 +0100: > Experimentally I have implemented "of_iommu_attach()" called from > drvier/core to control the order of device instanciation. > > In the Tegra SMMU PATCHv3, we've discussed how to control the order of > device instanciation. Thierry/Stephen proposed to insert a hook in > driver/core to control this order, depending on whether an iommu > device is ready or not."of_iommu_attach()" is implement for that > purpose now. Along with this patch, I attached DT part of modication > to this mail. I used the same iommu bindings which arm,smmu uses. > > [RFC][PATCHv3+ 2/2] ARM: DT: tegra30: iommu: Add "stream-id-cells"/"mmu-masters" > > "#stream-id-cells" is used to identify whether a device is IOMMU'able > or not. If a device is IOMMU'able, we'll defer to instanciate that > device till an iommu device is instanciated/ready. Once an iommu device > is instanciated, "dev->bus->iommu_ops" is set in the bus. After an > iommu device is instanciated, those defered devices are instanciated > as IOMMU'able with help of the iommu driver via iommu_ops->add_device(). > > We don't call bus_set_iommu() until an iommu device is instanciated > because we need to support 2 kind of IOMMU drivers, SMMU and GART so > that this bus_set_iommu() needs to be defered till an iommu device is > instanciated. So the single image can support 2 iommu drivers at once. > > With this patch, the following HACK patches in v3[1] are not needed > anymore. > > patch 1: [HACK] of: dev_node has struct device pointer > patch 2: [HACK] ARM: tegra: Populate AHB/IOMMU earlier than others > patch 3: [HACK] amba: Move AHB to core_initcall > patch 4: [HACK] iommu/tegra: smmu: Move IOMMU to core_initcall > > Any comment would be really appreciated. Have you had any chance to take a look at this one? I plan to send version 4 of this series with the above design next week. In v4, I use "mmu-masters" binding stolen from "arm,smmu" DT. -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html