From patchwork Mon Jul 27 10:54:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 6871991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 69A879F358 for ; Mon, 27 Jul 2015 10:57:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62BB12065B for ; Mon, 27 Jul 2015 10:57:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 386EE206BA for ; Mon, 27 Jul 2015 10:57:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZJg3m-0006vs-Dp; Mon, 27 Jul 2015 10:55:06 +0000 Received: from pandora.arm.linux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZJg3i-00067R-9H for linux-arm-kernel@lists.infradead.org; Mon, 27 Jul 2015 10:55:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=uzcanK3HO0aLfb4gsnSWqVwMCKYIcbUkEh0Cjlz4QNs=; b=aK1mi3OBhCtEC0uIlAmErQ42KM3hXOSOvek6PdFECyxtV7WR6eO9shGD3Ieb9Y5s/DkGrNPDmU0YLRNb+VlgY4ADcFA2q5Em9QSRuMGw5SW7e+OCgcwtSswbsm5o/+TIeQdSwWL21c+sDrILhDs0Acn/k2yXr0H/Zt1Pj/GU9+8=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:53905) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1ZJg37-0006If-5W; Mon, 27 Jul 2015 11:54:25 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1ZJg33-0000tF-Db; Mon, 27 Jul 2015 11:54:21 +0100 Date: Mon, 27 Jul 2015 11:54:20 +0100 From: Russell King - ARM Linux To: Lorenzo Pieralisi Subject: Re: [PATCH v2 2/2] ARM: pci: kill pcibios_msi_controller Message-ID: <20150727105420.GF7557@n2100.arm.linux.org.uk> References: <1437754383-8162-1-git-send-email-lorenzo.pieralisi@arm.com> <1437754383-8162-2-git-send-email-lorenzo.pieralisi@arm.com> <20150726185822.GB7557@n2100.arm.linux.org.uk> <20150727094046.GB10308@red-moon> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150727094046.GB10308@red-moon> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150727_035502_784231_30265834 X-CRM114-Status: GOOD ( 23.95 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Jayachandran C , Gabriele Paoloni , Arnd Bergmann , Marc Zyngier , "linux-pci@vger.kernel.org" , Pratyush Anand , Michal Simek , Simon Horman , Thierry Reding , Jingoo Han , Bjorn Helgaas , James Morse , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Jul 27, 2015 at 10:40:46AM +0100, Lorenzo Pieralisi wrote: > On Sun, Jul 26, 2015 at 07:58:22PM +0100, Russell King - ARM Linux wrote: > > This doesn't seem to be a good approach. Maybe having a version of > > pci_scan_root_bus() which takes the MSI data as an argument would be > > better than selectively copying pci_scan_root_bus() into the ARM code? > > I understand your point, let's try to find a fast way forward, we are > stuck otherwise: > > 3) I patch pci_scan_root_bus() to pass the MSI pointer. I think that > pcibios_msi_controller was added to avoid doing this, that > function has already 5 parameters and it is a treewide change, > I suspect Bjorn won't be happy about this at all. Or you could use the suggestion I made in the paragraph you quoted above, which is a variation on your (3) without the down-sides of needing to change lots of callsites. Something like this (bios32.c is incomplete): arch/arm/kernel/bios32.c | 8 +++----- drivers/pci/probe.c | 15 +++++++++++++-- include/linux/pci.h | 4 ++++ 3 files changed, 20 insertions(+), 7 deletions(-) And it's probably a good idea to kill off the ifdef around this: struct hw_pci { #ifdef CONFIG_PCI_MSI struct msi_controller *msi_ctrl; #endif so that we can avoid ifdefs in random places in arch/arm code (as is the decision in the rest of PCI for this.) diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index fcbbbb1b9e95..e4f7c0eb6c14 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -462,9 +462,6 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, if (!sys) panic("PCI: unable to allocate sys data!"); -#ifdef CONFIG_PCI_MSI - sys->msi_ctrl = hw->msi_ctrl; -#endif sys->busnr = busnr; sys->swizzle = hw->swizzle; sys->map_irq = hw->map_irq; @@ -486,8 +483,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, if (hw->scan) sys->bus = hw->scan(nr, sys); else - sys->bus = pci_scan_root_bus(parent, sys->busnr, - hw->ops, sys, &sys->resources); + sys->bus = pci_scan_root_bus_msi(parent, + sys->busnr, hw->ops, sys, + &sys->resources, hw->msi_ctrl); if (!sys->bus) panic("PCI: unable to scan bus!"); diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cefd636681b6..4915c6d9c22d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2096,8 +2096,9 @@ void pci_bus_release_busn_res(struct pci_bus *b) res, ret ? "can not be" : "is"); } -struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, - struct pci_ops *ops, void *sysdata, struct list_head *resources) +struct pci_bus *pci_scan_root_bus_msi(struct device *parent, int bus, + struct pci_ops *ops, void *sysdata, + struct list_head *resources, struct msi_controller *msi) { struct resource_entry *window; bool found = false; @@ -2114,6 +2115,8 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, if (!b) return NULL; + b->msi = msi; + if (!found) { dev_info(&b->dev, "No busn resource found for root bus, will use [bus %02x-ff]\n", @@ -2128,6 +2131,14 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, return b; } +EXPORT_SYMBOL(pci_scan_root_bus_msi); + +struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, + struct pci_ops *ops, void *sysdata, struct list_head *resources) +{ + return pci_scan_root_bus_msi(parent, bus, ops, sysdata, resources, + NULL); +} EXPORT_SYMBOL(pci_scan_root_bus); struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, diff --git a/include/linux/pci.h b/include/linux/pci.h index 8a0321a8fb59..4d4f9d29fcc9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -787,6 +787,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); void pci_bus_release_busn_res(struct pci_bus *b); +struct pci_bus *pci_scan_root_bus_msi(struct device *parent, int bus, + struct pci_ops *ops, void *sysdata, + struct list_head *resources, + struct msi_controller *msi); struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata, struct list_head *resources);