ARM64/PCI: Set root bus NUMA node on ACPI systems
authorLorenzo Pieralisi <[email protected]>
Wed, 24 May 2017 17:22:19 +0000 (18:22 +0100)
committerWill Deacon <[email protected]>
Tue, 30 May 2017 10:45:21 +0000 (11:45 +0100)
PCI core requires the NUMA node for the struct pci_host_bridge.dev to
be set by using the pcibus_to_node(struct pci_bus*) API, that on ARM64
systems relies on the struct pci_host_bridge->bus.dev NUMA node.

The struct pci_host_bridge.dev NUMA node is then propagated through
the PCI device hierarchy as PCI devices (and bridges) are enumerated
under it.

Therefore, in order to set-up the PCI NUMA hierarchy appropriately, the
struct pci_host_bridge->bus.dev NUMA node must be set before core
code calls pcibus_to_node(struct pci_bus*) on it so that PCI core can
retrieve the NUMA node for the struct pci_host_bridge.dev device and can
propagate it through the PCI bus tree.

On ARM64 ACPI based systems the struct pci_host_bridge->bus.dev NUMA
node can be set-up in pcibios_root_bridge_prepare() by parsing the root
bridge ACPI device firmware binding.

Add code to the pcibios_root_bridge_prepare() that, when booting with
ACPI, parse the root bridge ACPI device companion NUMA binding and set
the corresponding struct pci_host_bridge->bus.dev NUMA node
appropriately.

Cc: Bjorn Helgaas <[email protected]>
Cc: Catalin Marinas <[email protected]>
Reviewed-by: Robert Richter <[email protected]>
Tested-by: Robert Richter <[email protected]>
Signed-off-by: Lorenzo Pieralisi <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
arch/arm64/kernel/pci.c

index 4f0e3ebfea4b4f6496a783bd172abc05e7ec1d4a..10828344333652aa41ba105fad9935a8ad286a3c 100644 (file)
@@ -108,7 +108,10 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
        if (!acpi_disabled) {
                struct pci_config_window *cfg = bridge->bus->sysdata;
                struct acpi_device *adev = to_acpi_device(cfg->parent);
+               struct device *bus_dev = &bridge->bus->dev;
+
                ACPI_COMPANION_SET(&bridge->dev, adev);
+               set_dev_node(bus_dev, acpi_get_node(acpi_device_handle(adev)));
        }
 
        return 0;