[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1327140517-14811-22-git-send-email-yinghai@kernel.org>
Date: Sat, 21 Jan 2012 02:08:37 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: Jesse Barnes <jbarnes@...tuousgeek.org>
Cc: Ram Pai <linuxram@...ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH 21/21] PCI: only enable pci realloc when SRIOV bar is not assigned
If bios does not assign those BAR or wrong address, then kernel will
try to do pci realloc.
in that case, user still can use pci=realloc=off to override it.
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
drivers/pci/setup-bus.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 1c97e14..3070e1b 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1271,6 +1271,31 @@ static bool __init pci_realloc_enabled(void)
return pci_realloc_enable > 0;
}
+static void __init pci_realloc_detect(void)
+{
+ struct pci_dev *dev = NULL;
+
+ if (pci_realloc_enable != -1)
+ return;
+
+#ifdef CONFIG_PCI_IOV
+ for_each_pci_dev(dev) {
+ int i;
+
+ for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++) {
+ struct resource *r = &dev->resource[i];
+
+ /* Not assigned, or rejected by kernel */
+ if (r->flags && !r->start) {
+ pci_realloc_enable = 2;
+
+ return;
+ }
+ }
+ }
+#endif
+}
+
/*
* first try will not touch pci bridge res
* second and later try will clear small leaf bridge res
@@ -1292,6 +1317,7 @@ pci_assign_unassigned_resources(void)
int pci_try_num = 1;
/* don't realloc if asked to do so */
+ pci_realloc_detect();
if (pci_realloc_enabled()) {
int max_depth = pci_get_max_depth();
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists