From patchwork Sun Jul 2 21:19:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 9821777 X-Patchwork-Delegate: bhelgaas@google.com 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 7CB8460246 for ; Sun, 2 Jul 2017 21:19:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A3B26E56 for ; Sun, 2 Jul 2017 21:19:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56EAB274D1; Sun, 2 Jul 2017 21:19:55 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D6AD26E56 for ; Sun, 2 Jul 2017 21:19:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751996AbdGBVTx (ORCPT ); Sun, 2 Jul 2017 17:19:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:52806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751894AbdGBVTw (ORCPT ); Sun, 2 Jul 2017 17:19:52 -0400 Received: from localhost (unknown [69.71.4.159]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8011E22B5F; Sun, 2 Jul 2017 21:19:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8011E22B5F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Sun, 2 Jul 2017 16:19:50 -0500 From: Bjorn Helgaas To: Lorenzo Pieralisi Cc: linux-pci@vger.kernel.org, bhelgaas@google.com, 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 Subject: Re: [RFT PATCH v2 29/42] ARM: PCI: Remove pci_fixup_irqs() call for bios32 host controllers Message-ID: <20170702211950.GD18324@bhelgaas-glaptop.roam.corp.google.com> References: <20170608141342.2018-1-lorenzo.pieralisi@arm.com> <20170608141342.2018-30-lorenzo.pieralisi@arm.com> <20170701140629.GC8977@red-moon> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170701140629.GC8977@red-moon> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sat, Jul 01, 2017 at 03:06:30PM +0100, Lorenzo Pieralisi wrote: > 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. Thanks, I folded this into pci/irq-fixups. The resulting patch is merely this: commit 16508469c0f3198a63923aaec08efa1c63f5fbcc Author: Lorenzo Pieralisi Date: Wed Jun 28 15:14:04 2017 -0500 ARM/PCI: Remove pci_fixup_irqs() call for bios32 host controllers 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() assigns 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 [bhelgaas: folded in fixes from Lorenzo: http://lkml.kernel.org/r/20170701140629.GC8977@red-moon] Signed-off-by: Bjorn Helgaas Cc: Jason Cooper Cc: Russell King Cc: Andrew Lunn diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 4c7621ac389c..56dc1a3a33b4 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 { @@ -530,8 +533,6 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw) if (hw->postinit) hw->postinit(); - pci_fixup_irqs(pcibios_swizzle, pcibios_map_irq); - list_for_each_entry(sys, &head, node) { struct pci_bus *bus = sys->bus;