public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kristen Accardi <kristen.c.accardi@intel.com>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: rajesh.shah@intel.com, gregkh@suse.de, ak@suse.de,
	len.brown@intel.com, akpm@osdl.org, linux-kernel@vger.kernel.org,
	linux-pci@atrey.karlin.mff.cuni.cz,
	acpi-devel@lists.sourceforge.net
Subject: Re: [patch 2/2] i386/x86_64: collect host bridge resources v2
Date: Tue, 28 Jun 2005 11:21:54 -0700	[thread overview]
Message-ID: <1119982914.19258.6.camel@whizzy> (raw)
In-Reply-To: <20050628155152.A24551@jurassic.park.msu.ru>

On Tue, 2005-06-28 at 15:51 +0400, Ivan Kokshaysky wrote:
> [This refers to "gregkh-pci-pci-collect-host-bridge-resources-02.patch"
> which went into 2.6.12-mm1 and -mm2]
> 
> On Thu, Jun 02, 2005 at 03:41:49PM -0700, rajesh.shah@intel.com wrote:
> > This patch reads and stores host bridge resources reported by
> > ACPI BIOS for i386 and x86_64 systems.  This is needed since
> > ACPI hotplug code now uses the PCI core for resource management. 
> 
> That patch introduces two major problems.
> 
> 1. The new root bus resources aren't properly inserted into global
>    resource tree (missing request_resource calls). This leads to
>    completely messed up PCI setup, especially with
>    pci_assign_unassigned_resources() call, as seen in -mm1 (mm2 is
>    also unsafe, though).
> 
> 2. Transparent bridge handling is broken, no matter is it old code
>    in Linus' tree or the new one in -mm. At the point then
>    pcibios_setup_root_windows() is called, the "transparent"
>    resource pointers have been already set up in pci_read_bridge_bases()
>    (typically to ioport_resource and iomem_resource), so after changing
>    the root bus windows these pointers are wrong.
> 
> The appended patch fixes that. Just compare /proc/ioports and /proc/iomem
> with and without it. ;-)
> 


I gave this patch a try (against mm2), and found that I now get many
errors on boot up complaining about not being able to allocate PCI
resources due to resource collisions, and then the system begins to
complain about lost interrupts on hda, and is never able to mount the
root filesystem.
Kristen


> Ivan.
> 
> --- 2.6.12-mm2/arch/i386/pci/acpi.c	2005-06-28 13:30:24.000000000 +0400
> +++ linux/arch/i386/pci/acpi.c	2005-06-28 14:13:51.000000000 +0400
> @@ -107,10 +107,22 @@ verify_root_windows(struct pci_bus *bus)
>  			continue;
>  		switch (bus->resource[i]->flags & type_mask) {
>  			case IORESOURCE_IO:
> -				num_io++;
> +				if (!request_resource(&ioport_resource,
> +						      bus->resource[i]))
> +					num_io++;
> +				else {
> +					kfree(bus->resource[i]);
> +					bus->resource[i] = NULL;
> +				}
>  				break;
>  			case IORESOURCE_MEM:
> -				num_mem++;
> +				if (!request_resource(&iomem_resource,
> +						      bus->resource[i]))
> +					num_mem++;
> +				else {
> +					kfree(bus->resource[i]);
> +					bus->resource[i] = NULL;
> +				}
>  				break;
>  			default:
>  				break;
> @@ -126,6 +138,21 @@ verify_root_windows(struct pci_bus *bus)
>  }
>  
>  static void __devinit
> +fixup_transparent_bridges(struct list_head *bus_list)
> +{
> +	int i;
> +	struct pci_bus *b;
> +
> +	list_for_each_entry(b, bus_list, node) {
> +		if (b->self && b->self->transparent) {
> +			for (i = 3; i < PCI_BUS_NUM_RESOURCES; i++)
> +				b->resource[i] = b->parent->resource[i - 3];
> +		}
> +		fixup_transparent_bridges(&b->children);
> +	}
> +}
> +
> +static void __devinit
>  pcibios_setup_root_windows(struct pci_bus *bus, acpi_handle handle)
>  {
>  	int i;
> @@ -147,6 +174,21 @@ pcibios_setup_root_windows(struct pci_bu
>  			kfree(bus->resource[i]);
>  			bus->resource[i] = bres[i];
>  		}
> +	} else {
> +		/* Squeeze out unused resource pointers. */
> +		int idx = 0;
> +
> +		for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
> +			if (bus->resource[i])
> +				bus->resource[idx++] = bus->resource[i];
> +		}
> +		for (; idx < PCI_BUS_NUM_RESOURCES; idx++)
> +			bus->resource[idx] = NULL;
> +
> +		/* The root bus resources have been changed. Fix up the
> +		   resource pointers of buses behind "transparent" bridges
> +		   as well. */
> +		fixup_transparent_bridges(&bus->children);
>  	}
>  }
>  

  reply	other threads:[~2005-06-28 18:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-02 22:41 [patch 0/2] Collecting host bridge resources - take 2 rajesh.shah
2005-06-02 22:41 ` [patch 1/2] Increase the number of PCI bus resources rajesh.shah
2005-06-02 22:41 ` [patch 2/2] i386/x86_64: collect host bridge resources v2 rajesh.shah
2005-06-28 11:51   ` Ivan Kokshaysky
2005-06-28 18:21     ` Kristen Accardi [this message]
2005-06-28 20:03       ` Ivan Kokshaysky
2005-06-30 16:05         ` Greg KH
2005-07-01  0:33           ` Rajesh Shah

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=1119982914.19258.6.camel@whizzy \
    --to=kristen.c.accardi@intel.com \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=gregkh@suse.de \
    --cc=ink@jurassic.park.msu.ru \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=rajesh.shah@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox