From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Yinghai Lu To: Bjorn Helgaas , David Miller , Benjamin Herrenschmidt , Wei Yang , TJ , Yijing Wang , Khalid Aziz Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v10 22/59] PCI: Don't release sibling bridge resources during hotplug Date: Wed, 24 Feb 2016 18:12:13 -0800 Message-Id: <1456366370-28995-23-git-send-email-yinghai@kernel.org> In-Reply-To: <1456366370-28995-1-git-send-email-yinghai@kernel.org> References: <1456366370-28995-1-git-send-email-yinghai@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: On hotplug path, we can not touch sibling bridges that is outside of the slot. That could happen when BIOS does not assign some bridge BARs and later kernel 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 Signed-off-by: Yinghai Lu --- drivers/pci/setup-bus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index e383d03..3349a83 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1902,10 +1902,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) { -- 1.8.4.5