Message ID | 20190402131548.41949-1-jean-philippe.brucker@arm.com |
---|---|
Headers | show |
Series | PCI: Describe external-facing ports in device tree | expand |
On Tue, Apr 02, 2019 at 02:15:48PM +0100, Jean-Philippe Brucker wrote: > Set the "untrusted" attribute to any PCIe port that has an > "external-facing" device tree property. Any device downstream of this > port will inherit the attribute and have only the strictest IOMMU > protection. > > Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Rob, you can take both of these, or ack the first and I'll take them. > --- > drivers/pci/of.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/of.c b/drivers/pci/of.c > index 3d32da15c215..3e7ac7748d90 100644 > --- a/drivers/pci/of.c > +++ b/drivers/pci/of.c > @@ -35,6 +35,9 @@ void pci_set_bus_of_node(struct pci_bus *bus) > bus->dev.of_node = pcibios_get_phb_of_node(bus); > else > bus->dev.of_node = of_node_get(bus->self->dev.of_node); > + > + if (of_get_property(bus->dev.of_node, "external-facing", NULL)) > + bus->self->untrusted = true; > } > > void pci_release_bus_of_node(struct pci_bus *bus) > -- > 2.21.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On 2019-04-02 2:15 pm, Jean-Philippe Brucker wrote: > Set the "untrusted" attribute to any PCIe port that has an > "external-facing" device tree property. Any device downstream of this > port will inherit the attribute and have only the strictest IOMMU > protection. > > Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> > --- > drivers/pci/of.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/of.c b/drivers/pci/of.c > index 3d32da15c215..3e7ac7748d90 100644 > --- a/drivers/pci/of.c > +++ b/drivers/pci/of.c > @@ -35,6 +35,9 @@ void pci_set_bus_of_node(struct pci_bus *bus) > bus->dev.of_node = pcibios_get_phb_of_node(bus); > else > bus->dev.of_node = of_node_get(bus->self->dev.of_node); > + > + if (of_get_property(bus->dev.of_node, "external-facing", NULL)) You could use of_property_read_bool() for this, but either way, Reviewed-by: Robin Murphy <robin.murphy@arm.com> > + bus->self->untrusted = true; > } > > void pci_release_bus_of_node(struct pci_bus *bus) >
On 02/04/2019 20:15, Jean-Philippe Brucker wrote: > Since v1 [1], I improved the wording of patch 1/2 as suggested by Bjorn. > > Add an "external-facing" property to PCI ports in device-tree, to help > identify untrusted devices. The notion of untrusted PCI devices was > added to the v5.0 kernel to describe devices that should have strict > IOMMU protection [2], for example devices that are plugged in a > Thunderbolt port. ACPI systems use the ExternalFacingPort property [3]. > Add an equivalent mechanism to device tree. > > [1] https://lore.kernel.org/linux-pci/20190318182124.53859-1-jean-philippe.brucker@arm.com/ > [2] https://lkml.org/lkml/2018/11/26/631 > [3] https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports#identifying-externally-exposed-pcie-root-ports For both: Reviewed-by: Grant Likely <grant.likely@arm.com> > > Jean-Philippe Brucker (2): > dt-bindings: Add external-facing PCIe port property > PCI: OF: Support external-facing property > > Documentation/devicetree/bindings/pci/pci.txt | 50 +++++++++++++++++++ > drivers/pci/of.c | 3 ++ > 2 files changed, 53 insertions(+) >
On Tue, Apr 02, 2019 at 02:15:46PM +0100, Jean-Philippe Brucker wrote: > Since v1 [1], I improved the wording of patch 1/2 as suggested by Bjorn. > > Add an "external-facing" property to PCI ports in device-tree, to help > identify untrusted devices. The notion of untrusted PCI devices was > added to the v5.0 kernel to describe devices that should have strict > IOMMU protection [2], for example devices that are plugged in a > Thunderbolt port. ACPI systems use the ExternalFacingPort property [3]. > Add an equivalent mechanism to device tree. > > [1] https://lore.kernel.org/linux-pci/20190318182124.53859-1-jean-philippe.brucker@arm.com/ > [2] https://lkml.org/lkml/2018/11/26/631 > [3] https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports#identifying-externally-exposed-pcie-root-ports > > Jean-Philippe Brucker (2): > dt-bindings: Add external-facing PCIe port property > PCI: OF: Support external-facing property Applied to pci/enumeration for v5.2, with reviewed-by from Robin and Grant and from Rob (patch 2 only), thanks! > Documentation/devicetree/bindings/pci/pci.txt | 50 +++++++++++++++++++ > drivers/pci/of.c | 3 ++ > 2 files changed, 53 insertions(+) > > -- > 2.21.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel