From patchwork Tue Dec 22 23:02:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 69348 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBMN4nPx014601 for ; Tue, 22 Dec 2009 23:04:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752601AbZLVXEo (ORCPT ); Tue, 22 Dec 2009 18:04:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755334AbZLVXDy (ORCPT ); Tue, 22 Dec 2009 18:03:54 -0500 Received: from sca-es-mail-2.Sun.COM ([192.18.43.133]:56920 "EHLO sca-es-mail-2.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755367AbZLVXDs (ORCPT ); Tue, 22 Dec 2009 18:03:48 -0500 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id nBMN3llM021936; Tue, 22 Dec 2009 15:03:47 -0800 (PST) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0KV200L00T7X3F00@fe-sfbay-09.sun.com>; Tue, 22 Dec 2009 15:03:47 -0800 (PST) Received: from localhost.localdomain ([unknown] [10.6.76.26]) by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0KV2005M2TDRNUD0@fe-sfbay-09.sun.com>; Tue, 22 Dec 2009 15:03:38 -0800 (PST) Date: Tue, 22 Dec 2009 15:02:33 -0800 From: Yinghai Lu Subject: [PATCH 13/14] pciehp: add support for bridge resource reallocation In-reply-to: <1261522954-12591-1-git-send-email-yinghai@kernel.org> To: Jesse Barnes , Ingo Molnar , Linus Torvalds , Ivan Kokshaysky , Kenji Kaneshige , Alex Chiang , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Kenji Kaneshige , Yinghai Lu Message-id: <1261522954-12591-14-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.6.0.2 References: <1261522954-12591-1-git-send-email-yinghai@kernel.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 4ed76b4..78cf0f4 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -43,6 +43,7 @@ extern int pciehp_poll_mode; extern int pciehp_poll_time; extern int pciehp_debug; extern int pciehp_force; +extern int pciehp_realloc; extern struct workqueue_struct *pciehp_wq; #define dbg(format, arg...) \ diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 5674b20..cc3fc5d 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -41,6 +41,7 @@ int pciehp_debug; int pciehp_poll_mode; int pciehp_poll_time; int pciehp_force; +int pciehp_realloc; struct workqueue_struct *pciehp_wq; #define DRIVER_VERSION "0.4" @@ -55,10 +56,12 @@ module_param(pciehp_debug, bool, 0644); module_param(pciehp_poll_mode, bool, 0644); module_param(pciehp_poll_time, int, 0644); module_param(pciehp_force, bool, 0644); +module_param(pciehp_realloc, bool, 0644); MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not"); MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if _OSC and OSHP are missing"); +MODULE_PARM_DESC(pciehp_realloc, "Realloc resources for slot's parent bridge"); #define PCIE_MODULE_NAME "pciehp" @@ -297,6 +300,10 @@ static int pciehp_probe(struct pcie_device *dev) if (!occupied && poweron && POWER_CTRL(ctrl)) pciehp_power_off_slot(slot); + /* Release I/O window of the slots's parent bridge */ + if (pciehp_realloc) + pci_bridge_release_res(dev->port->subordinate); + return 0; err_out_free_ctrl_slot: diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 0a16444..f6119e4 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c @@ -166,5 +166,9 @@ int pciehp_unconfigure_device(struct slot *p_slot) pci_dev_put(temp); } + /* Release I/O window of the slots's parent bridge */ + if (pciehp_realloc) + pci_bridge_release_res(parent); + return rc; }