On Tue, Jul 13, 2021 at 10:34:03PM +0200, Arnd Bergmann wrote: > > > Is it going to be a problem if two devices in kernel use the same > > > of_node ? > > > > There shouldn't be. We have nodes be multiple providers (e.g clocks > > and resets) already. > > I think this would be a little different, but it can still work. There is in > fact already some precedent of doing this, with Jean-Philippe's virtio-iommu > binding, which is documented in both > > Documentation/devicetree/bindings/virtio/iommu.txt > Documentation/devicetree/bindings/virtio/mmio.txt > > Unfortunately, those are still slightly different from where I think we should > be going here, but it's probably close enough to fit into the general > system. > > What we have with virtio-iommu is two special hacks: > - on virtio-mmio, a node with 'compatible="virtio,mmio"' may optionally > have an '#iommu-cells=<1>', in which case we assume it's an iommu. > - for virtio-pci, the node has the standard PCI 'reg' property but a special > 'compatible="virtio,pci-iommu"' property that I think is different from any > other PCI node. Yes in retrospect I don't think the compatible property on the PCI endpoint node is necessary nor useful, we could deprecate it. The OS gets the IOMMU topology information early from 'iommus', 'iommu-map' and '#iommu-cells' properties, which is the only reason we need this PCI endpoint explicitly described in DT. The rest is discovered while probing just like virtio-mmio. Thanks, Jean