All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 09/29] powerpc/PCI: convert to pci_create_root_bus() for correct root bus resources
Date: Fri, 14 Oct 2011 09:34:16 +0200	[thread overview]
Message-ID: <1318577656.29415.513.camel@pasglop> (raw)
In-Reply-To: <20111014042752.23504.73508.stgit@bhelgaas.mtv.corp.google.com>

On Thu, 2011-10-13 at 22:27 -0600, Bjorn Helgaas wrote:
> Convert from pci_create_bus() to pci_create_root_bus().  This way the root
> bus resources are correct immediately.  This patch doesn't fix anything
> because powerpc fixed them before scanning the bus, but it makes it more
> consistent with other architectures.

All 3 look ok but of course like anything like that, need testing :-) I
won't be able to do that until I'm back to Australia, early November.

Cheers,
Ben.

> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  arch/powerpc/kernel/pci-common.c |   27 ++++++++++++++++-----------
>  1 files changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 942ced2..2dbef49 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -1554,14 +1554,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
>  	return pci_enable_resources(dev, mask);
>  }
>  
> -static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
> +static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources)
>  {
> -	struct pci_bus *bus = hose->bus;
>  	struct resource *res;
>  	int i;
>  
>  	/* Hookup PHB IO resource */
> -	bus->resource[0] = res = &hose->io_resource;
> +	res = &hose->io_resource;
>  
>  	if (!res->flags) {
>  		printk(KERN_WARNING "PCI: I/O resource not set for host"
> @@ -1579,6 +1578,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
>  		 (unsigned long long)res->start,
>  		 (unsigned long long)res->end,
>  		 (unsigned long)res->flags);
> +	pci_add_resource(resources, res);
>  
>  	/* Hookup PHB Memory resources */
>  	for (i = 0; i < 3; ++i) {
> @@ -1596,12 +1596,12 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
>  			res->flags = IORESOURCE_MEM;
>  #endif /* CONFIG_PPC32 */
>  		}
> -		bus->resource[i+1] = res;
>  
>  		pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i,
>  			 (unsigned long long)res->start,
>  			 (unsigned long long)res->end,
>  			 (unsigned long)res->flags);
> +		pci_add_resource(resources, res);
>  	}
>  
>  	pr_debug("PCI: PHB MEM offset     = %016llx\n",
> @@ -1695,6 +1695,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
>   */
>  void __devinit pcibios_scan_phb(struct pci_controller *hose)
>  {
> +	struct list_head resources;
>  	struct pci_bus *bus;
>  	struct device_node *node = hose->dn;
>  	int mode;
> @@ -1702,22 +1703,26 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
>  	pr_debug("PCI: Scanning PHB %s\n",
>  		 node ? node->full_name : "<NO NAME>");
>  
> +	INIT_LIST_HEAD(&resources);
> +
> +	/* Get some IO space for the new PHB */
> +	pcibios_setup_phb_io_space(hose);
> +
> +	/* Wire up PHB bus resources */
> +	pcibios_setup_phb_resources(hose, &resources);
> +
>  	/* Create an empty bus for the toplevel */
> -	bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose);
> +	bus = pci_create_root_bus(hose->parent, hose->first_busno,
> +				  hose->ops, hose, resources);
>  	if (bus == NULL) {
>  		pr_err("Failed to create bus for PCI domain %04x\n",
>  			hose->global_number);
> +		pci_free_resource_list(&resources);
>  		return;
>  	}
>  	bus->secondary = hose->first_busno;
>  	hose->bus = bus;
>  
> -	/* Get some IO space for the new PHB */
> -	pcibios_setup_phb_io_space(hose);
> -
> -	/* Wire up PHB bus resources */
> -	pcibios_setup_phb_resources(hose);
> -
>  	/* Get probe mode and perform scan */
>  	mode = PCI_PROBE_NORMAL;
>  	if (node && ppc_md.pci_probe_mode)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arch" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-10-14  7:34 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14  4:27 [PATCH v2 00/29] Create PCI root buses with correct resources Bjorn Helgaas
2011-10-14  4:27 ` [PATCH v2 01/29] PCI: add helpers for building PCI bus resource lists Bjorn Helgaas
2011-10-14  4:27 ` [PATCH v2 02/29] PCI: add pci_create_root_bus(), deprecate pci_create_bus() Bjorn Helgaas
2011-10-14  4:27 ` [PATCH v2 03/29] PCI: add pci_scan_root_bus(), deprecate pci_scan_bus() and pci_scan_bus_parented() Bjorn Helgaas
2011-10-14  4:27 ` [PATCH v2 04/29] MIPS: PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14  4:27 ` [PATCH v2 05/29] x86/PCI: use pci_scan_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14  4:27 ` [PATCH v2 06/29] x86/PCI: convert to pci_create_root_bus() and pci_scan_root_bus() Bjorn Helgaas
2011-10-14  5:30   ` Yinghai Lu
2011-10-14 20:32     ` Bjorn Helgaas
2011-10-14 20:39       ` Yinghai Lu
2011-10-14 20:54         ` Bjorn Helgaas
2011-10-14 21:15           ` Yinghai Lu
2011-10-14  4:27 ` [PATCH v2 07/29] powerpc/PCI: make pcibios_setup_phb_resources() static Bjorn Helgaas
2011-10-14  4:27 ` [PATCH v2 08/29] powerpc/PCI: split PHB part out of pcibios_map_io_space() Bjorn Helgaas
2011-10-14  4:27 ` [PATCH v2 09/29] powerpc/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14  7:34   ` Benjamin Herrenschmidt [this message]
2011-10-14  4:27 ` [PATCH v2 10/29] microblaze/PCI: fix pci_bus_for_each_resource() usage Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 11/29] microblaze/PCI: make pcibios_setup_phb_resources() static Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 12/29] microblaze/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 13/29] microblaze/PCI: use pci_scan_root_bus() Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 14/29] sparc/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14  4:46   ` David Miller
2011-10-14  4:49     ` David Miller
2011-10-14  4:28 ` [PATCH v2 15/29] sparc32, leon/PCI: convert to pci_scan_root_bus() " Bjorn Helgaas
2011-10-14  4:43   ` David Miller
2011-10-14  4:28 ` [PATCH v2 16/29] ia64/PCI: use pci_create_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 17/29] ia64/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 18/29] parisc/PCI: use pci_create_root_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 19/29] parisc/PCI: supply root bus resources to pci_create_root_bus() Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 20/29] parisc/PCI: deal with LMMIO/PAT overlaps before creating PCI root bus Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 21/29] parisc/PCI: use pci_create_root_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14  4:28 ` [PATCH v2 22/29] parisc/PCI: supply root bus resources to pci_create_root_bus() Bjorn Helgaas
2011-10-14  4:29 ` [PATCH v2 23/29] xen/PCI: use pci_create_root_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14  4:29 ` [PATCH v2 24/29] alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14  4:29 ` [PATCH v2 25/29] arm/PCI: " Bjorn Helgaas
2011-10-14  4:29 ` [PATCH v2 26/29] frv/PCI: " Bjorn Helgaas
2011-10-14  4:29 ` [PATCH v2 27/29] mn10300/PCI: " Bjorn Helgaas
2011-10-14  4:29 ` [PATCH v2 28/29] sh/PCI: " Bjorn Helgaas
2011-10-14  4:29 ` [PATCH v2 29/29] xtensa/PCI: " Bjorn Helgaas
2011-10-14 15:14 ` [PATCH v2 00/29] Create PCI root buses with correct resources James Bottomley
2011-10-14 15:33   ` Bjorn Helgaas
2011-10-14 15:45     ` James Bottomley
2011-10-14 17:21       ` Bjorn Helgaas
2011-12-20 15:55       ` Bjorn Helgaas
2011-12-22 18:59         ` David Miller
2011-12-22 19:15           ` David Miller
2011-12-22 19:56             ` David Miller
2011-12-22 22:02               ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318577656.29415.513.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.