From patchwork Sat Jan 16 11:07:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 73381 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 o0GB9x56030528 for ; Sat, 16 Jan 2010 11:09:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755634Ab0APLJP (ORCPT ); Sat, 16 Jan 2010 06:09:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755487Ab0APLI7 (ORCPT ); Sat, 16 Jan 2010 06:08:59 -0500 Received: from sca-es-mail-1.Sun.COM ([192.18.43.132]:63409 "EHLO sca-es-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754912Ab0APLI4 (ORCPT ); Sat, 16 Jan 2010 06:08:56 -0500 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id o0GB8ttG009059; Sat, 16 Jan 2010 03:08:55 -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 <0KWC00L006S6XR00@fe-sfbay-09.sun.com>; Sat, 16 Jan 2010 03:08:55 -0800 (PST) Received: from localhost.localdomain ([unknown] [75.36.243.89]) by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0KWC00FJR6YF4SC0@fe-sfbay-09.sun.com>; Sat, 16 Jan 2010 03:08:55 -0800 (PST) Date: Sat, 16 Jan 2010 03:07:16 -0800 From: Yinghai Lu Subject: [PATCH 10/11] pciehp: add support for bridge resource reallocation In-reply-to: <1263640037-24134-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: <1263640037-24134-11-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.6.4.2 References: <1263640037-24134-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; }