Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752772AbZLABWN (ORCPT ); Mon, 30 Nov 2009 20:22:13 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752470AbZLABWM (ORCPT ); Mon, 30 Nov 2009 20:22:12 -0500 Received: from hera.kernel.org ([140.211.167.34]:33213 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752314AbZLABWL (ORCPT ); Mon, 30 Nov 2009 20:22:11 -0500 Message-ID: <4B146F7D.5090209@kernel.org> Date: Mon, 30 Nov 2009 17:21:01 -0800 From: Yinghai Lu User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Kenji Kaneshige , Jesse Barnes , "Eric W. Biederman" , Alex Chiang , Bjorn Helgaas CC: Ingo Molnar , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , Ivan Kokshaysky Subject: [PATCH 2/2] pciehp: add support for bridge resource reallocation -v2 References: <4ADEB601.8020200@kernel.org> <4AE57976.4060107@jp.fujitsu.com> <4AE5E37F.8070707@kernel.org> <4AE5EFDB.2060908@kernel.org> <4AE80170.6030402@jp.fujitsu.com> <4AE88305.8020207@kernel.org> <4AE899A0.3020006@kernel.org> <4AE95247.8080401@jp.fujitsu.com> <4AE952B9.1010603@kernel.org> <4AE9588E.90708@jp.fujitsu.com> <4AE9657F.7010302@kernel.org> <4AE965D9.9040702@kernel.org> <20091104093044.17ab628a@jbarnes-piketon> <4AF1CD79.4010602@kernel.org> <4AF22CF1.1020508@kernel.org> <4AF22D26.4070500@kernel.org> <4AF508F0.9060105@kernel.org> <4AF91F54.10507@jp.fujitsu.com> <4AF936DB.1030309@kernel.org> <4AFCF7D8.1090207@jp.fujitsu.com> <4AFCFC0D.4030002@kernel.org> <4AFD19DA.7010602@jp.fujitsu.com> <4AFE6F39.5080505@kernel.org> <4B0B321E.4010103@jp.fujitsu.com> <4B0B335E.1070809@kernel.org> <4B0B3C13.9030502@jp.fujit! su.com> <4B0C69AD.3030106@kernel. org> <4B0D13EB.9010403@jp.fujitsu.com> <4B10D084.8070608@kernel.org> <4B10D30D.3020108@ker! nel.org> In-Reply-To: <4B10D30D.3020108@kernel.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3351 Lines: 90 From: Kenji Kaneshige With this patch, pciehp driver try to clear PCI bridge resources to parent bridge (root port or switch downstream port) of the slot so we can shrink pci bridge resource for those port This feature is enabled when 'pciehp_realloc' option is specified. -v2: make it could be appiled after Yinghai patchset that touch pci bridge resource also remove poweron check, because pci_bridge_release_res will check child at first need to apply this one after 9/9 patchset Signed-off-by: Kenji Kaneshige Signed-off-by: Yinghai Lu --- drivers/pci/hotplug/pciehp.h | 1 + drivers/pci/hotplug/pciehp_core.c | 7 +++++++ drivers/pci/hotplug/pciehp_pci.c | 4 ++++ 3 files changed, 12 insertions(+) Index: linux-2.6/drivers/pci/hotplug/pciehp.h =================================================================== --- linux-2.6.orig/drivers/pci/hotplug/pciehp.h +++ linux-2.6/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...) \ Index: linux-2.6/drivers/pci/hotplug/pciehp_core.c =================================================================== --- linux-2.6.orig/drivers/pci/hotplug/pciehp_core.c +++ linux-2.6/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_devi 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: Index: linux-2.6/drivers/pci/hotplug/pciehp_pci.c =================================================================== --- linux-2.6.orig/drivers/pci/hotplug/pciehp_pci.c +++ linux-2.6/drivers/pci/hotplug/pciehp_pci.c @@ -166,5 +166,9 @@ int pciehp_unconfigure_device(struct slo pci_dev_put(temp); } + /* Release I/O window of the slots's parent bridge */ + if (pciehp_realloc) + pci_bridge_release_res(parent); + return rc; } -- 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/