Copy the ats-supported flag into the pci_host_bridge structure. Signed-off-by: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx> --- drivers/pci/controller/pci-host-common.c | 1 + drivers/pci/of.c | 9 +++++++++ include/linux/of_pci.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c index 250a3fc80ec6..a6ac927be291 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -92,6 +92,7 @@ int pci_host_common_probe(struct platform_device *pdev, return ret; } + of_pci_host_check_ats(bridge); platform_set_drvdata(pdev, bridge->bus); return 0; } diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 81ceeaa6f1d5..4b8a877f1e9f 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -576,6 +576,15 @@ int pci_parse_request_of_pci_ranges(struct device *dev, } EXPORT_SYMBOL_GPL(pci_parse_request_of_pci_ranges); +void of_pci_host_check_ats(struct pci_host_bridge *bridge) +{ + struct device_node *np = bridge->bus->dev.of_node; + + if (!np) + return; + + bridge->ats_supported = of_property_read_bool(np, "ats-supported"); +} #endif /* CONFIG_PCI */ /** diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 29658c0ee71f..2d0af410438c 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -7,12 +7,14 @@ struct pci_dev; struct device_node; +struct pci_host_bridge; #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI) struct device_node *of_pci_find_child_device(struct device_node *parent, unsigned int devfn); int of_pci_get_devfn(struct device_node *np); void of_pci_check_probe_only(void); +void of_pci_host_check_ats(struct pci_host_bridge *bridge); #else static inline struct device_node *of_pci_find_child_device(struct device_node *parent, unsigned int devfn) @@ -26,6 +28,7 @@ static inline int of_pci_get_devfn(struct device_node *np) } static inline void of_pci_check_probe_only(void) { } +static inline void of_pci_host_check_ats(struct pci_host_bridge *bridge) { } #endif #if IS_ENABLED(CONFIG_OF_IRQ) -- 2.25.0