ARM64/PCI: ACPI NUMA node set-up
v3 cover ARM64/PCI: ACPI NUMA node set-up
This patch series is v3 of a previous posting:
v2 -> v3
- Dropped generic approach
# It was not consistent between ACPI and DT and not reusable on x86/IA64
- Trimmed the series to one patch ARM64 specific, three-line patch fixes the issue
- Rebased against v4.12-rc2
- Dropped RFC/RFT tag
v2: https://lkml.org/lkml/2017/5/15/433
v1 -> v2:
- Added missing call to acpi_pci_bus_find_numa_node()
- Rebased against v4.12-rc1
v1: https://lkml.org/lkml/2017/4/26/211
--- Original Cover Letter --
On the ARM64 architecture, the arch specific PCI pcibus_to_node() callback can be triggered on struct pci_bus.sysdata structures that carry host bridge specific data through different structures layout (ie sysdata pointer points at different structs for different host bridges), therefore it is not possible to have a unified pcibus_to_node() implementation.
Given that the device NUMA node is a property of the struct pci_bus (and its associated struct device), move the struct pci_bus node assignment to generic PCI code, where according to the platform firmware the NUMA node for the device backing the struct pci_bus is retrieved and propagated through the PCI bus hierarchy.
Lorenzo Pieralisi (1):
ARM64/PCI: Set root bus NUMA node on ACPI systems
arch/arm64/kernel/pci.c | 3 +++ 1 file changed, 3 insertions(+)
Signature · 1 line
2.10.0
PATCH v3 1/1 ARM64/PCI: Set root bus NUMA node on ACPI systems
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.
--- arch/arm64/kernel/pci.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/kernel/pci.c +3 -0
@@ -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 ;
Signature · 1 line
2.10.0
PATCH v3 1/1 ARM64/PCI: Set root bus NUMA node on ACPI systems
Quoted 23 lines · Lorenzo Pieralisi
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 structpci_host_bridge->bus.devNUMA 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.devNUMA node must be set before core code callspcibus_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.devNUMA node can be set-up inpcibios_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 structpci_host_bridge->bus.devNUMA node appropriately.
Quoted 4 lines
Signed-off-by Lorenzo Pieralisi <[email protected]>Cc Will Deacon <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Catalin Marinas <[email protected]>
Looks good.
Thanks,
-Robert
PATCH v3 1/1 ARM64/PCI: Set root bus NUMA node on ACPI systems
In reply to Lorenzo PieralisiQuoted 23 lines · Lorenzo Pieralisi
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 structpci_host_bridge->bus.devNUMA 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.devNUMA node must be set before core code callspcibus_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.devNUMA node can be set-up inpcibios_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 structpci_host_bridge->bus.devNUMA node appropriately.
Quoted 7 lines
Signed-off-by Lorenzo Pieralisi <[email protected]>Cc Will Deacon <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Catalin Marinas <[email protected]>--- arch/arm64/kernel/pci.c | 3 +++ 1 file changed, 3 insertions(+)
Thanks, I'll queue this with Robert's tags.
Will