From patchwork Sat Jul 1 14:06:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 9820887 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DACF602CC for ; Sat, 1 Jul 2017 14:05:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B42B2582C for ; Sat, 1 Jul 2017 14:05:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D70E28520; Sat, 1 Jul 2017 14:05:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 94CA22582C for ; Sat, 1 Jul 2017 14:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hoBpo3z3jHrj36kXCQPh3Wr602ydx7N76mDyf1smlBw=; b=T1z2UTVgW0AfqH K9yfRwtrSgXsuIsdENCgV/7O4veXnKTSPpf4qwQyaDT9yc8/A+88I4vzK6bDm8i3TKE3KNZP1r5l8 I6NEOfKFdRIxaR2+541d1noWd5I/a/lS87z/wCUnkr2kSAxEA8jvIeFRT+mhbVvtJprqlKvCsACLl h15RZrpj8LKnQnXUv+4cG3h0fT3Z1dX+iMmLKcYypQgfpcqr6CvvYg9p+jC6SfzbGG8xHzjx3LDxw QdYO+UXPeLnDVCltPgxDTsrx38erEAotMbRrIbhaqQC2b+zQER2REd0ryrhaLs+vLy7jPATL5EP0o LuufzlCOC092QgcNi4eg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dRJ1X-00011j-1H; Sat, 01 Jul 2017 14:05:23 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dRJ1U-0008Ez-1a for linux-arm-kernel@lists.infradead.org; Sat, 01 Jul 2017 14:05:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 742372B; Sat, 1 Jul 2017 07:04:58 -0700 (PDT) Received: from red-moon (red-moon.cambridge.arm.com [10.1.206.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D65D3F581; Sat, 1 Jul 2017 07:04:54 -0700 (PDT) Date: Sat, 1 Jul 2017 15:06:30 +0100 From: Lorenzo Pieralisi To: linux-pci@vger.kernel.org, bhelgaas@google.com Subject: Re: [RFT PATCH v2 29/42] ARM: PCI: Remove pci_fixup_irqs() call for bios32 host controllers Message-ID: <20170701140629.GC8977@red-moon> References: <20170608141342.2018-1-lorenzo.pieralisi@arm.com> <20170608141342.2018-30-lorenzo.pieralisi@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170608141342.2018-30-lorenzo.pieralisi@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170701_070520_121111_35677BDF X-CRM114-Status: GOOD ( 25.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Gabriele Paoloni , Shawn Lin , Will Deacon , Michal Simek , Thierry Reding , Tanmay Inamdar , Matthew Minter , Rob Herring , Joao Pinto , Pratyush Anand , Russell King , Murali Karicheri , Linus Walleij , Jason Cooper , Arnd Bergmann , Bharat Kumar Gogada , Simon Horman , Mingkai Hu , linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Jingoo Han , Stanimir Varbanov , Minghuan Lian , Zhou Wang , Roy Zang Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Bjorn, On Thu, Jun 08, 2017 at 03:13:29PM +0100, Lorenzo Pieralisi wrote: > Legacy PCI host controllers (ie host controllers that set-up the PCI bus > through the ARM pci_common_init() API) are currently relying on > pci_fixup_irqs() to assign legacy PCI irqs to devices. This is not ideal > in that pci_fixup_irqs() assign IRQs for all PCI devices present in a > given system some of which may well be enabled by the time > pci_fixup_irqs() is called (ie a system with multiple host controllers). > With the introduction of struct pci_host_bridge.(*map_irq) pointer it is > possible to assign IRQs for all devices originating from a PCI host > bridge at probe time; this is implemented through pci_assign_irq() that > relies on the struct pci_host_bridge.map_irq pointer to map IRQ for a > given device. > > The benefits this brings are twofold: > > - the IRQ for a device is assigned once at probe time > - the IRQ assignment works also for hotplugged devices > > Remove pci_fixup_irqs() call from bios32 code and rely on > pci_assign_irq() to carry out the IRQ mapping at device probe > time. > > The map_irq() and swizzle_irq() struct pci_host_bridge callbacks are > set-up in the struct pci_host_bridge created in the bios32 > pcibios_init_hw() function and mach-* code paths (for PCI mach > implementations that require a specific struct hw_pci.(*scan) function > callback). > > Signed-off-by: Lorenzo Pieralisi > Cc: Jason Cooper > Cc: Bjorn Helgaas > Cc: Russell King > Cc: Andrew Lunn > --- > arch/arm/kernel/bios32.c | 4 ++-- > arch/arm/mach-dove/pcie.c | 18 ++++++++++-------- > arch/arm/mach-iop13xx/pci.c | 2 ++ > arch/arm/mach-orion5x/pci.c | 28 +++++++++++++++------------- > 4 files changed, 29 insertions(+), 23 deletions(-) As I mentioned to you, this patch is incomplete and needs an upgrade (ie I misread how Orion and the gazillions board file that go with it to map irqs - apologies but it is very hard to untangle). I am inlining below an incremental patch to be folded in commit: feaec00e757a ("ARM/PCI: Remove pci_fixup_irqs() call for bios32 host controllers") in your pci/irq-fixups branch, or if you prefer I can send you the resulting squashed-in patch to replace this one, as you prefer. I understand timing is tight I am doing all I can to fix this series up and make 4.13. Please let me know how I can help, thank you ! Lorenzo -- >8 -- diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index da201a2..56dc1a3 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -484,6 +484,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, break; } + bridge->map_irq = pcibios_map_irq; + bridge->swizzle_irq = pcibios_swizzle; + if (hw->scan) ret = hw->scan(nr, bridge); else { @@ -494,8 +497,6 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, bridge->busnr = sys->busnr; bridge->ops = hw->ops; bridge->msi = hw->msi_ctrl; - bridge->map_irq = pcibios_map_irq; - bridge->swizzle_irq = pcibios_swizzle; bridge->align_resource = hw->align_resource; diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c index 8d54a67..dfb62f3 100644 --- a/arch/arm/mach-dove/pcie.c +++ b/arch/arm/mach-dove/pcie.c @@ -152,14 +152,6 @@ static void rc_pci_fixup(struct pci_dev *dev) } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup); -static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -{ - struct pci_sys_data *sys = dev->sysdata; - struct pcie_port *pp = sys->private_data; - - return pp->index ? IRQ_DOVE_PCIE1 : IRQ_DOVE_PCIE0; -} - static int __init dove_pcie_scan_bus(int nr, struct pci_host_bridge *bridge) { @@ -175,12 +167,18 @@ dove_pcie_scan_bus(int nr, struct pci_host_bridge *bridge) bridge->sysdata = sys; bridge->busnr = sys->busnr; bridge->ops = &pcie_ops; - bridge->map_irq = dove_pcie_map_irq; - bridge->swizzle_irq = pci_common_swizzle; return pci_scan_root_bus_bridge(bridge); } +static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +{ + struct pci_sys_data *sys = dev->sysdata; + struct pcie_port *pp = sys->private_data; + + return pp->index ? IRQ_DOVE_PCIE1 : IRQ_DOVE_PCIE0; +} + static struct hw_pci dove_pci __initdata = { .nr_controllers = 2, .setup = dove_pcie_setup, diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c index 3c51a9b..070d92a 100644 --- a/arch/arm/mach-iop13xx/pci.c +++ b/arch/arm/mach-iop13xx/pci.c @@ -532,7 +532,6 @@ int iop13xx_scan_bus(int nr, struct pci_host_bridge *bridge) bridge->dev.parent = NULL; bridge->sysdata = sys; bridge->busnr = sys->busnr; - bridge->swizzle_irq = pci_common_swizzle; switch (which_atu) { case IOP13XX_INIT_ATU_ATUX: @@ -548,7 +547,6 @@ int iop13xx_scan_bus(int nr, struct pci_host_bridge *bridge) break; case IOP13XX_INIT_ATU_ATUE: bridge->ops = &iop13xx_atue_ops; - bridge->map_irq = iop13xx_pcie_map_irq; ret = pci_scan_root_bus_bridge(bridge); if (!ret) pci_bus_atue = bridge->bus; diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index 0f1c343..76951bf 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c @@ -555,19 +555,6 @@ int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys) return 0; } -int __init orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -{ - int bus = dev->bus->number; - - /* - * PCIe endpoint? - */ - if (orion5x_pci_disabled || bus < orion5x_pci_local_bus_nr()) - return IRQ_ORION5X_PCIE0_INT; - - return -1; -} - int __init orion5x_pci_sys_scan_bus(int nr, struct pci_host_bridge *bridge) { struct pci_sys_data *sys = pci_host_bridge_priv(bridge); @@ -576,8 +563,6 @@ int __init orion5x_pci_sys_scan_bus(int nr, struct pci_host_bridge *bridge) bridge->dev.parent = NULL; bridge->sysdata = sys; bridge->busnr = sys->busnr; - bridge->map_irq = orion5x_pci_map_irq; - bridge->swizzle_irq = pci_common_swizzle; if (nr == 0) { bridge->ops = &pcie_ops; @@ -592,3 +577,16 @@ int __init orion5x_pci_sys_scan_bus(int nr, struct pci_host_bridge *bridge) BUG(); return -ENODEV; } + +int __init orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +{ + int bus = dev->bus->number; + + /* + * PCIe endpoint? + */ + if (orion5x_pci_disabled || bus < orion5x_pci_local_bus_nr()) + return IRQ_ORION5X_PCIE0_INT; + + return -1; +}