Re: [problem] mpt2sas load fails with LSISAS2008

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 26, 2015 at 7:59 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote:

> Can you be any more specific?  What I'm looking for is:
>
>   - this worked at commit X
>   - commit Y broke it
>   - commit Z fixes it

3.4:
[    0.339990] Some PCI device resources are unassigned, try booting
with pci=realloc

3.4.1
[    0.337460] PCI: No. 2 try to assign unassigned res
[    0.337463] release child resource [mem 0xfbd00000-0xfbd3ffff 64bit]
[    0.337465] release child resource [mem 0xfbd80000-0xfbdbffff 64bit]
[    0.337468] release child resource [mem 0xfbdfc000-0xfbdfffff 64bit]

commit Y is there for v3.4 and v3.4.1 both.

| commit b07f2ebc109b607789f648dedcff4b125f9afec6
| Author: Yinghai Lu <yinghai@xxxxxxxxxx>
| Date:   Thu Feb 23 19:23:32 2012 -0800
|
|    PCI: add a PCI resource reallocation config option
|
|    Add a new config option, PCI_REALLOC_ENABLE_AUTO, which will
|    automatically try to re-allocate PCI resources if PCI_IOV support is
|    enabled and the SR-IOV resources are unassigned.  Behavior can still be
|    controlled using the pci=realloc= parameter.
|
|    -v2: According to Jesse, adding one CONFIG option for distribution to
|         disable it or enable it.
|    -v3: update Kconfig text (jbarnes)


but v3.4 has PCI_REALLOC_ENABLE_AUTO not set.
and v3.4.1 has that set.

so solution would be:
1. revert Y and following
2. introduce commit X: set fixed resource if there is LSI card found
like attached two patches.
Subject: [PATCH] PCI: don't release fixed resource for pci=realloc

We should not release bridge resource if there is fixed resources
under it, otherwise the children will not work with new bridge
resources.

Reported-by: Paul Johnson <pjay@xxxxxxxxxxx>
Suggested-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=92351
Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx

---
 drivers/pci/setup-bus.c |    6 ++++--
 include/linux/ioport.h  |    2 +-
 kernel/resource.c       |   28 ++++++++++++++++++++++++++--
 3 files changed, 31 insertions(+), 5 deletions(-)

Index: linux-2.6/drivers/pci/setup-bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/setup-bus.c
+++ linux-2.6/drivers/pci/setup-bus.c
@@ -1384,14 +1384,16 @@ static void pci_bridge_release_resources
 
 	r = &b_res[idx];
 
-	if (!r->parent)
+	if (!r->parent || r->flags & IORESOURCE_PCI_FIXED)
 		return;
 
 	/*
 	 * if there are children under that, we should release them
 	 *  all
 	 */
-	release_child_resources(r);
+	if (!release_child_resources(r))
+		return;
+
 	if (!release_resource(r)) {
 		type = old_flags = r->flags & type_mask;
 		dev_printk(KERN_DEBUG, &dev->dev, "resource %d %pR released\n",
Index: linux-2.6/include/linux/ioport.h
===================================================================
--- linux-2.6.orig/include/linux/ioport.h
+++ linux-2.6/include/linux/ioport.h
@@ -141,7 +141,7 @@ extern struct resource iomem_resource;
 extern struct resource *request_resource_conflict(struct resource *root, struct resource *new);
 extern int request_resource(struct resource *root, struct resource *new);
 extern int release_resource(struct resource *new);
-void release_child_resources(struct resource *new);
+bool release_child_resources(struct resource *new);
 extern void reserve_region_with_split(struct resource *root,
 			     resource_size_t start, resource_size_t end,
 			     const char *name);
Index: linux-2.6/kernel/resource.c
===================================================================
--- linux-2.6.orig/kernel/resource.c
+++ linux-2.6/kernel/resource.c
@@ -275,11 +275,35 @@ static void __release_child_resources(st
 	}
 }
 
-void release_child_resources(struct resource *r)
+static bool __has_fixed_child_resources(struct resource *r)
 {
+	struct resource *p;
+
+	p = r->child;
+	while (p) {
+		if (p->flags & IORESOURCE_PCI_FIXED)
+			return true;
+
+		if (__has_fixed_child_resources(p))
+			return true;
+
+		p = p->sibling;
+	}
+
+	return false;
+}
+
+bool release_child_resources(struct resource *r)
+{
+	bool fixed;
+
 	write_lock(&resource_lock);
-	__release_child_resources(r);
+	fixed = __has_fixed_child_resources(r);
+	if (!fixed)
+		__release_child_resources(r);
 	write_unlock(&resource_lock);
+
+	return !fixed;
 }
 
 /**
Subject: [PATCH] PCI: set resource to fixed for lsi devices

LSI cards do not work if pci core change pci bar vaules.

Set their resource to fixed, so will allow realloc to skip them.

Reported-by: Paul Johnson <pjay@xxxxxxxxxxx>
Suggested-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=92351
Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx

---
 drivers/pci/pci.h       |    1 +
 drivers/pci/quirks.c    |   20 ++++++++++++++++++++
 drivers/pci/setup-bus.c |    4 ++++
 3 files changed, 25 insertions(+)

Index: linux-2.6/drivers/pci/pci.h
===================================================================
--- linux-2.6.orig/drivers/pci/pci.h
+++ linux-2.6/drivers/pci/pci.h
@@ -147,6 +147,7 @@ static inline void pci_msi_init_pci_dev(
 #endif
 
 void pci_realloc_get_opt(char *);
+bool pci_realloc_user_enabled(void);
 
 static inline int pci_no_d1d2(struct pci_dev *dev)
 {
Index: linux-2.6/drivers/pci/quirks.c
===================================================================
--- linux-2.6.orig/drivers/pci/quirks.c
+++ linux-2.6/drivers/pci/quirks.c
@@ -324,6 +324,26 @@ static void quirk_s3_64M(struct pci_dev
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3,	PCI_DEVICE_ID_S3_868,		quirk_s3_64M);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3,	PCI_DEVICE_ID_S3_968,		quirk_s3_64M);
 
+/*
+ * LSI devices firmware does not like BAR get changed
+ */
+static void quirk_bar_fixed(struct pci_dev *dev)
+{
+	int i;
+
+	if (pci_realloc_user_enabled())
+		return;
+
+	for (i = 0; i < PCI_STD_RESOURCE_END; i++) {
+		struct resource *r = &dev->resource[i];
+
+		if (!r->flags || r->flags & IORESOURCE_UNSET)
+			continue;
+		r->flags |= IORESOURCE_PCI_FIXED;
+	}
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LSI_LOGIC,	PCI_ANY_ID,	quirk_bar_fixed);
+
 static void quirk_io(struct pci_dev *dev, int pos, unsigned size,
 		     const char *name)
 {
Index: linux-2.6/drivers/pci/setup-bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/setup-bus.c
+++ linux-2.6/drivers/pci/setup-bus.c
@@ -1521,6 +1521,10 @@ void __init pci_realloc_get_opt(char *st
 	else if (!strncmp(str, "on", 2))
 		pci_realloc_enable = user_enabled;
 }
+bool pci_realloc_user_enabled(void)
+{
+	return pci_realloc_enable == user_enabled;
+}
 static bool pci_realloc_enabled(enum enable_type enable)
 {
 	return enable >= user_enabled;

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux