linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ram Pai <linuxram@us.ibm.com>
To: jbarnes@virtuousgeek.org, torvalds@linux-foundation.org
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	yinghai@kernel.org, Ram Pai <linuxram@us.ibm.com>
Subject: [PATCH] PCI: conditional resource-reallocation through kernel parameter pci=realloc
Date: Thu, 30 Jun 2011 01:09:39 -0700	[thread overview]
Message-ID: <1309421379-24995-1-git-send-email-linuxram@us.ibm.com> (raw)

Multiple attempts to dynamically reallocate pci resources have unfortunately
lead to regressions. Though we continue to fix the regressions and fine tune the
dynamic-reallocation behavior, we have not reached a acceptable state yet.

This patch provides a interim solution. It disables dynamic-reallocation; by
default, with the ability to enable it through pci=realloc kernel command line
parameter.

Signed-off-by: Ram Pai <linuxram@us.ibm.com>
---
 Documentation/kernel-parameters.txt |    2 ++
 arch/x86/pci/common.c               |    4 ++++
 drivers/pci/setup-bus.c             |    7 +++++++
 include/linux/pci.h                 |    2 ++
 4 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index fd248a3..aa47be7 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2015,6 +2015,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 				the default.
 				off: Turn ECRC off
 				on: Turn ECRC on.
+		realloc		reallocate PCI resources if allocations done by BIOS
+				are erroneous.
 
 	pcie_aspm=	[PCIE] Forcibly enable or disable PCIe Active State Power
 			Management.
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 5fe7502..9645290 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -31,6 +31,7 @@ int noioapicreroute = 0;
 int noioapicreroute = 1;
 #endif
 int pcibios_last_bus = -1;
+int pci_realloc = 0;
 unsigned long pirq_table_addr;
 struct pci_bus *pci_root_bus;
 struct pci_raw_ops *raw_pci_ops;
@@ -602,6 +603,9 @@ char * __devinit  pcibios_setup(char *str)
 		if (noioapicreroute != -1)
 			noioapicreroute = 1;
 		return NULL;
+	} else if (!strcmp(str, "realloc")) {
+		pci_realloc = 1;
+		return NULL;
 	}
 	return str;
 }
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 40e94d5..a65c2ad 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1135,6 +1135,13 @@ again:
 	/* any device complain? */
 	if (!head.next)
 		goto enable_and_dump;
+
+	/* don't realloc if asked to do so */
+	if (!pci_realloc) {
+		free_list(resource_list_x, &head);
+		goto enable_and_dump;
+	}
+
 	failed_type = 0;
 	for (list = head.next; list;) {
 		failed_type |= list->flags;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f39d894..08b9af0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1427,6 +1427,8 @@ extern u8 pci_cache_line_size;
 extern unsigned long pci_hotplug_io_size;
 extern unsigned long pci_hotplug_mem_size;
 
+extern int pci_realloc;
+
 int pcibios_add_platform_entries(struct pci_dev *dev);
 void pcibios_disable_device(struct pci_dev *dev);
 int pcibios_set_pcie_reset_state(struct pci_dev *dev,
-- 
1.7.0.4


             reply	other threads:[~2011-06-30  8:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-30  8:09 Ram Pai [this message]
2011-06-30 17:04 ` [PATCH] PCI: conditional resource-reallocation through kernel parameter pci=realloc Oliver Hartkopp
2011-06-30 17:07   ` Jesse Barnes
2011-06-30 17:12     ` Oliver Hartkopp
2011-06-30 18:38       ` Ram Pai
2011-06-30 20:24         ` Bjorn Helgaas
2011-06-30 20:26           ` Jesse Barnes
2011-07-06  9:06 ` Ram Pai
2011-07-06 16:07   ` Jesse Barnes
2011-07-07  1:00     ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309421379-24995-1-git-send-email-linuxram@us.ibm.com \
    --to=linuxram@us.ibm.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).