On Mon, Apr 28, 2014 at 02:05:30PM +0200, Arnd Bergmann wrote: [...] > let me clarify by example: > > iommu@1 { > compatible = "some,simple-iommu"; > reg = <1>; > #iommu-cells = <0>; /* supports only one master */ > }; > > iommu@2 { > compatible = "some,other-iommu"; > reg = <3>; > #iommu-cells = <1>; /* contains master ID */ > }; > > iommu@3 { > compatible = "some,windowed-iommu"; > reg = <2>; > #iommu-cells = <2>; /* contains dma-window */ > }; > > device@4 { > compatible = "some,ethernet"; > iommus = <&/iommu@1>; > }; > > device@5 { > compatible = "some,dmaengine"; > iommus = <&/iommu@2 0x40000000 0x1000000>, > <&/iommu@3 0x101>; > }; > > The device at address 4 has a one-one relationship with iommu@1, so there > is no need for any data. device@5 has two master ports. One is connected to > an IOMMU that has a per-device aperture, device@5 can only issue transfers > to the 256MB area at 0x40000000, and the IOMMU will have to put entries for > this device into that address. The second master port is connected to > iommu@3, which uses a master ID that gets passed along with each transfer, > so that needs to be put into the IOTLBs. iommu@3 and the second port of device@5 seem to match what we need for Tegra (and as I understand also Exynos). Can we settle on this for now so that Hiroshi and Cho can go update their drivers for this binding? > A variation would be to not use #iommu-cells at all, but provide a > #address-cells / #size-cells pair in the IOMMU, and have a translation > as we do for dma-ranges. This is probably most flexible. The remainder of this discussion seems to indicate that #iommu-cells and dma-ranges don't have to be mutually exclusive. For some IOMMUs it might make sense to use both. In fact perhaps we should require every IOMMU user to also specify a dma-ranges property, even if for some cases the range would be simply the complete physical address space. Perhaps in analogy to the ranges property an empty dma-ranges property could be taken to mean all of the physical address space. I'm aware that this doesn't cover any of the more exotic cases out there, but the fact is that we have real devices out there that ship with some variations of these simple IOMMUs and I don't think we're doing ourselves a favour by blocking support for these to be added on the hope of merging the perfect solution that covers all use-cases. Patches for Tegra have already been around for close to half a year. Thierry
Attachment:
pgpNjNtvq0Zs2.pgp
Description: PGP signature