Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754157AbbEZROA (ORCPT ); Tue, 26 May 2015 13:14:00 -0400 Received: from foss.arm.com ([217.140.101.70]:50649 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753631AbbEZRN4 (ORCPT ); Tue, 26 May 2015 13:13:56 -0400 Date: Tue, 26 May 2015 18:13:50 +0100 From: Will Deacon To: Hanjun Guo Cc: Bjorn Helgaas , Arnd Bergmann , Catalin Marinas , "Rafael J. Wysocki" , Jiang Liu , Liviu Dudau , Thomas Gleixner , Yijing Wang , Lorenzo Pieralisi , Tomasz Nowicki , "suravee.suthikulpanit@amd.com" , "msalter@redhat.com" , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linaro-acpi@lists.linaro.org" Subject: Re: [PATCH 11/11] ARM64 / PCI / ACPI: support for ACPI based PCI hostbridge init Message-ID: <20150526171350.GV1565@arm.com> References: <1432644564-24746-1-git-send-email-hanjun.guo@linaro.org> <1432644564-24746-12-git-send-email-hanjun.guo@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432644564-24746-12-git-send-email-hanjun.guo@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4132 Lines: 138 On Tue, May 26, 2015 at 01:49:24PM +0100, Hanjun Guo wrote: > Based on Jiang Liu's common interface to support PCI host bridge > init and refactoring of MMCONFIG, this patch using information > from ACPI MCFG table and IO/irq resources from _CRS to init > ARM64 PCI hostbridge, then PCI will work on ARM64. > > This patch is based on Mark Salter and Tomasz Nowicki's work. > > Signed-off-by: Hanjun Guo > Tested-by: Suravee Suthikulpanit > CC: Arnd Bergmann > CC: Catalin Marinas > CC: Liviu Dudau > CC: Lorenzo Pieralisi > CC: Will Deacon > --- > arch/arm64/Kconfig | 7 ++ > arch/arm64/kernel/pci.c | 245 +++++++++++++++++++++++++++++++++++++++++++++--- > drivers/pci/pci.c | 26 +++-- > 3 files changed, 257 insertions(+), 21 deletions(-) > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 9b80428..8e4b789 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -276,6 +276,13 @@ config PCI_DOMAINS_GENERIC > config PCI_SYSCALL > def_bool PCI > > +config PCI_MMCONFIG > + def_bool y > + select PCI_ECAM > + select HAVE_PCI_ECAM > + select GENERIC_PCI_ECAM > + depends on ACPI > + > source "drivers/pci/Kconfig" > source "drivers/pci/pcie/Kconfig" > source "drivers/pci/hotplug/Kconfig" > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c > index 4095379..d1629dc 100644 > --- a/arch/arm64/kernel/pci.c > +++ b/arch/arm64/kernel/pci.c > @@ -11,12 +11,15 @@ > */ > > #include > +#include > #include > #include > #include > #include > +#include > #include > #include > +#include > #include > > #include > @@ -43,31 +46,251 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, > */ > int pcibios_add_device(struct pci_dev *dev) > { > - dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); > + if (acpi_disabled) > + dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); > > return 0; > } > > +#ifdef CONFIG_ACPI > +int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) > +{ > + struct pci_controller *sd = bridge->bus->sysdata; > + > + ACPI_COMPANION_SET(&bridge->dev, sd->companion); > + return 0; > +} > + > +void pcibios_add_bus(struct pci_bus *bus) > +{ > + acpi_pci_add_bus(bus); > +} > + > +void pcibios_remove_bus(struct pci_bus *bus) > +{ > + acpi_pci_remove_bus(bus); > +} > + > +int pcibios_enable_irq(struct pci_dev *dev) > +{ > + if (!pci_dev_msi_enabled(dev)) > + acpi_pci_irq_enable(dev); > + return 0; > +} > + > +int pcibios_disable_irq(struct pci_dev *dev) > +{ > + if (!pci_dev_msi_enabled(dev)) > + acpi_pci_irq_disable(dev); > + return 0; > +} > + > +int pcibios_enable_device(struct pci_dev *dev, int bars) > +{ > + int err; > + > + err = pci_enable_resources(dev, bars); > + if (err < 0) > + return err; > + > + return pcibios_enable_irq(dev); > +} > + > +static int __init pcibios_assign_resources(void) > +{ > + struct pci_bus *root_bus; > + > + if (acpi_disabled) > + return 0; > + > + list_for_each_entry(root_bus, &pci_root_buses, node) { > + pcibios_resource_survey_bus(root_bus); > + pci_assign_unassigned_root_bus_resources(root_bus); > + } > + return 0; > +} I'm starting to sound like a stuck record (and getting bored of it myself!), but none of this looks arch-specific. Can it be moved into the core? Will -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/