[PATCH V7 07/11] pci, acpi: Handle ACPI companion assignment.
From: Lorenzo Pieralisi <hidden>
Date: 2016-05-11 10:10:58
Also in:
linux-acpi, linux-pci, lkml
On Tue, May 10, 2016 at 08:37:00PM +0200, Rafael J. Wysocki wrote:
On Tue, May 10, 2016 at 5:19 PM, Tomasz Nowicki [off-list ref] wrote:quoted
This patch provides a way to set the ACPI companion in PCI code. We define acpi_pci_set_companion() to set the ACPI companion pointer and call it from PCI core code. The function is stub for now. Signed-off-by: Jayachandran C <redacted> Signed-off-by: Tomasz Nowicki <redacted> --- drivers/pci/probe.c | 2 ++ include/linux/pci-acpi.h | 4 ++++ 2 files changed, 6 insertions(+)diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8004f67..fb0b752 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c@@ -12,6 +12,7 @@ #include <linux/slab.h> #include <linux/module.h> #include <linux/cpumask.h> +#include <linux/pci-acpi.h> #include <linux/pci-aspm.h> #include <linux/aer.h> #include <linux/acpi.h>@@ -2141,6 +2142,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, bridge->dev.parent = parent; bridge->dev.release = pci_release_host_bridge_dev; dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus); + acpi_pci_set_companion(bridge);Yes, we'll probably add something similar here. Do I think now is the right time to do that? No.quoted
error = pcibios_root_bridge_prepare(bridge); if (error) { kfree(bridge);diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 09f9f02..1baa515 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h@@ -111,6 +111,10 @@ static inline void acpi_pci_add_bus(struct pci_bus *bus) { } static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } #endif /* CONFIG_ACPI */ +static inline void acpi_pci_set_companion(struct pci_host_bridge *bridge) +{ +} + static inline int acpi_pci_bus_domain_nr(struct pci_bus *bus) { return 0; --Honestly, to me it looks like this series is trying very hard to avoid doing any PCI host bridge configuration stuff from arch/arm64/ although (a) that might be simpler and (b) it would allow us to identify the code that's common between *all* architectures using ACPI support for host bridge configuration and to move *that* to a common place later. As done here it seems to be following the "ARM64 is generic and the rest of the world is special" line which isn't really helpful.
I think patch [1-2] should be merged regardless (they may require minor tweaks if we decide to move pci_acpi_scan_root() to arch/arm64 though, for include files location). I guess you are referring to patch 8 in your comments above, which boils down to deciding whether: - pci_acpi_scan_root() (and unfortunately all the MCFG/ECAM handling that goes with it) should live in arch/arm64 or drivers/acpi acpi_pci_bus_domain_nr() is a bit more problematic since it is meant to be called from PCI core code (ARM64 selects PCI_DOMAINS_GENERIC for DT and same kernel has to work with OF and ACPI selected) and it is arch specific (because what we have in bus->sysdata is arch specific, waiting for the domain number to be embedded in struct pci_host_bridge). Your point is fair, I am not sure that moving the pci_acpi_scan_root() to arch/arm64 would make things much simpler though, it is just a matter of deciding where that code has to live. How do you want us to proceed ? Thanks, Lorenzo