From patchwork Sat Jan 16 02:42:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 73285 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 o0G2kdM1007557 for ; Sat, 16 Jan 2010 02:46:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758596Ab0APCpw (ORCPT ); Fri, 15 Jan 2010 21:45:52 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758408Ab0APCpv (ORCPT ); Fri, 15 Jan 2010 21:45:51 -0500 Received: from sca-es-mail-1.Sun.COM ([192.18.43.132]:57734 "EHLO sca-es-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758242Ab0APCnZ (ORCPT ); Fri, 15 Jan 2010 21:43:25 -0500 Received: from fe-sfbay-10.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id o0G2hEDI009762; Fri, 15 Jan 2010 18:43:25 -0800 (PST) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0KWB00500J6JYC00@fe-sfbay-10.sun.com>; Fri, 15 Jan 2010 18:43:16 -0800 (PST) Received: from localhost.localdomain ([unknown] [10.6.76.26]) by fe-sfbay-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0KWB00EKPJJTDA60@fe-sfbay-10.sun.com>; Fri, 15 Jan 2010 18:43:15 -0800 (PST) Date: Fri, 15 Jan 2010 18:42:00 -0800 From: Yinghai Lu Subject: [PATCH 10/11] pciehp: add support for bridge resource reallocation In-reply-to: <1263609721-3921-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: <1263609721-3921-11-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.6.4.2 References: <1263609721-3921-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 920f820..8f990ad 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" @@ -272,6 +275,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; }