From patchwork Tue May 22 20:11:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 160735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0C5B2B6FF5 for ; Wed, 23 May 2012 06:11:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932408Ab2EVULl (ORCPT ); Tue, 22 May 2012 16:11:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29799 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760371Ab2EVULk (ORCPT ); Tue, 22 May 2012 16:11:40 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4MKBdN6023530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 May 2012 16:11:39 -0400 Received: from redhat.com (dhcp-185-114.bos.redhat.com [10.16.185.114]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4MKBcMo024624; Tue, 22 May 2012 16:11:39 -0400 Date: Tue, 22 May 2012 16:11:38 -0400 From: Jason Baron Message-Id: <201205222011.q4MKBcMo024624@int-mx02.intmail.prod.int.phx2.redhat.com> To: bhelgaas@google.com, linux-pci@vger.kernel.org Cc: mst@redhat.com Subject: [PATCH] pci hotplug: rescan bridge after device hotplug X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org I'm tyring to support bridge hotplug and devices below it in qemu via acpi hotplug. Currently only 1 level or 32 slots are supported. By allowing for a second level, we will be able to support 32^2 devices. If I first hotplug the bridge with no devices intially below it, the hotplug code sets the bridge memory window to 0 and does not increase it when subsequent devices are added below it. Fix this, by calling pci_rescan_bus_bridge_resize(), on the bridge directly below the root to re-size all the birdge windows that may have changed. Signed-off-by: Jason Baron Signed-off-by: Yinghai Lu --- drivers/pci/hotplug/acpiphp_glue.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 806c44f..8960c1e 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -792,6 +792,7 @@ static int __ref enable_device(struct acpiphp_slot *slot) { struct pci_dev *dev; struct pci_bus *bus = slot->bridge->pci_bus; + struct pci_bus *rescan_bus; struct acpiphp_func *func; int retval = 0; int num, max, pass; @@ -821,6 +822,13 @@ static int __ref enable_device(struct acpiphp_slot *slot) } } + /* Ensure we rescan/setup a bridge for new devs hanging off of it */ + rescan_bus = bus; + while (rescan_bus->parent && rescan_bus->parent->self) + rescan_bus = rescan_bus->parent; + if (rescan_bus->self) + pci_rescan_bus_bridge_resize(rescan_bus->self); + list_for_each_entry(func, &slot->funcs, sibling) acpiphp_bus_add(func);