On Thu, Jul 09, 2015 at 12:10:11PM +0100, leizhen wrote:
> On 2015/7/8 21:13, Robin Murphy wrote:
> > On 07/07/15 04:30, Zhen Lei wrote:
> >> For pci devices, only the root nodes have "iommus" property. So we
> >> should traverse all of its sub nodes in of_xlate.
> > 
> > I don't really follow this description; only the host controller is
> > described in DT - the devices behind it are probed dynamically and don't
> > have nodes to traverse.
> 
> The devices behind host controller may have nodes, but have no "iommus" 
> property.

No, the PCI masters won't have nodes in the DT on arm/arm64 systems (it
makes hotplug difficult).

> I got this conclusion base on the original code as below:
> 
>       struct pci_bus *bus = pdev->bus;
> 
>       /* Walk up to the root bus */
>       while (!pci_is_root_bus(bus))
>               bus = bus->parent;

So this walks up the PCI topology, created by probing the bus, until we
get to the top-level bus...

>       /* Follow the "iommus" phandle from the host controller */
>       of_node = of_parse_phandle(bus->bridge->parent->of_node, "iommus", 0);
>       if (!of_node)
>               return NULL;

... then we find the host controller device, which *does* have a
device-tree node and use *that* to find out the IOMMU corresponding to
the PCI device.

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to