Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753538AbbHUGWd (ORCPT ); Fri, 21 Aug 2015 02:22:33 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:24461 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850AbbHUGW2 (ORCPT ); Fri, 21 Aug 2015 02:22:28 -0400 From: Yinghai Lu To: Bjorn Helgaas , David Miller , Benjamin Herrenschmidt , Wei Yang , TJ , Yijing Wang Cc: Andrew Morton , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v4 46/52] PCI: Don't release sibling bridge resources during hotplug Date: Thu, 20 Aug 2015 23:21:01 -0700 Message-Id: <1440138067-4314-47-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1440138067-4314-1-git-send-email-yinghai@kernel.org> References: <1440138067-4314-1-git-send-email-yinghai@kernel.org> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1515 Lines: 46 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 060977c..0c85c0a 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -2411,10 +2411,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/