diff mbox

PCI: don't release sibiling bridge resources during hotplug

Message ID 1408756512-16885-4-git-send-email-yinghai@kernel.org
State Changes Requested
Headers show

Commit Message

Yinghai Lu Aug. 23, 2014, 1:15 a.m. UTC
On hotplug path, we can not touch sibling bridges that is out
side of the slot.

That could happen when BIOS does not assign some bridge BARs and
later can not assign resource to them in first try.

Check if fail dev is the parent bridge, then just use subordinate
bus instead use parent bus.

Reported-by:  Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>


---
 drivers/pci/setup-bus.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bjorn Helgaas Sept. 3, 2014, 11:35 p.m. UTC | #1
On Fri, Aug 22, 2014 at 7:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On hotplug path, we can not touch sibling bridges that is out
> side of the slot.
>
> That could happen when BIOS does not assign some bridge BARs and
> later can not assign resource to them in first try.
>
> Check if fail dev is the parent bridge, then just use subordinate
> bus instead use parent bus.
>
> Reported-by:  Andreas Noever <andreas.noever@gmail.com>

This needs a link to the problem report so we can try to match up the
fix with the problem and see how it works.

> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
>  drivers/pci/setup-bus.c |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/drivers/pci/setup-bus.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/setup-bus.c
> +++ linux-2.6/drivers/pci/setup-bus.c
> @@ -1676,10 +1676,16 @@ again:
>          * Try to release leaf bridge's resources that doesn't fit resource of
>          * child device under that bridge
>          */
> -       list_for_each_entry(fail_res, &fail_head, list)
> -               pci_bus_release_bridge_resources(fail_res->dev->bus,
> +       list_for_each_entry(fail_res, &fail_head, list) {
> +               struct pci_bus *bus = fail_res->dev->bus;
> +
> +               if (fail_res->dev == bridge)
> +                       bus = bridge->subordinate;
> +
> +               pci_bus_release_bridge_resources(bus,
>                                                  fail_res->flags & type_mask,
>                                                  whole_subtree);
> +       }
>
>         /* restore size and flags */
>         list_for_each_entry(fail_res, &fail_head, list) {
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: linux-2.6/drivers/pci/setup-bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/setup-bus.c
+++ linux-2.6/drivers/pci/setup-bus.c
@@ -1676,10 +1676,16 @@  again:
 	 * Try to release leaf bridge's resources that doesn't fit resource of
 	 * child device under that bridge
 	 */
-	list_for_each_entry(fail_res, &fail_head, list)
-		pci_bus_release_bridge_resources(fail_res->dev->bus,
+	list_for_each_entry(fail_res, &fail_head, list) {
+		struct pci_bus *bus = fail_res->dev->bus;
+
+		if (fail_res->dev == bridge)
+			bus = bridge->subordinate;
+
+		pci_bus_release_bridge_resources(bus,
 						 fail_res->flags & type_mask,
 						 whole_subtree);
+	}
 
 	/* restore size and flags */
 	list_for_each_entry(fail_res, &fail_head, list) {