diff mbox

[v1,2/4] PCI: Mark invalid BARs as unassigned

Message ID 20150415194226.GA27352@google.com
State Not Applicable
Headers show

Commit Message

Bjorn Helgaas April 15, 2015, 7:42 p.m. UTC
[+cc Rafael, Jiang]

On Wed, Apr 15, 2015 at 09:27:41AM -0700, Tony Luck wrote:
> > +       /* ACPI_RESOURCE_TYPE_IRQ etc. */
> > +       printk("host bridge resource %02d length %#02x\n", res->type,
> > +              res->length);
> > +       print_hex_dump(KERN_INFO, "  : ", DUMP_PREFIX_OFFSET, 16, 1,
> > +                      &res->data, res->length, 0);
> > +
> 
> Patch applied to the tree with the offending commit reverted. Serial
> log attached,

Thanks.  Your log shows several descriptors that we currently ignore
because their Producer/Consumer bits are set to "Consumer".   Here's one
that contains the MMIO area used by these igb and mptsas devices:

  host bridge resource 12 length 0x38       ACPI_RESOURCE_TYPE_ADDRESS32
    : 00000000: 00 01 00 01 01 01 00 00 00 00 00 00 00 00 00 00
    : 00000010: 00 00 00 a0 ff ff ff ef 00 00 00 00 00 00 00 50
    : 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    : 00000030: 0d 00 00 00 50 00 00 00
  [mem 0xa0000000-0xefffffff]

I think we're about to conclude that the Producer/Consumer bit is useless
and should be ignored.

Can you drop the previous debug patch and try this one?


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tony Luck April 15, 2015, 9:28 p.m. UTC | #1
On Wed, Apr 15, 2015 at 12:42 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> I think we're about to conclude that the Producer/Consumer bit is useless
> and should be ignored.
>
> Can you drop the previous debug patch and try this one?

That producer/consumer thing sounds horribly familiar ... did we venture along
this path before many years ago?

I applied the new patch on top of Linus latest (from this morning
HEAD=6c373ca89399c5a3f7ef210ad8f63dc3437da345) without any
reverts.  System booted OK with both disks online and networking
functional).

New serial log attached.

-Tony
Bjorn Helgaas April 15, 2015, 11:04 p.m. UTC | #2
On Wed, Apr 15, 2015 at 02:28:08PM -0700, Tony Luck wrote:
> On Wed, Apr 15, 2015 at 12:42 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> > I think we're about to conclude that the Producer/Consumer bit is useless
> > and should be ignored.
> >
> > Can you drop the previous debug patch and try this one?
> 
> That producer/consumer thing sounds horribly familiar ... did we venture along
> this path before many years ago?

463eb297401e ("[IA64] respect ACPI producer/consumer flag for PCI root
bridges") from 2005 added this check.  There's also been recent discussion
about Jiang's patches and how to handle that bit in some more generic code
[1].

I think if we strictly follow the spec, it is correct to check the
producer/consumer bit.  If we don't check the bit, we are basically
assuming that all Address Space Resource Descriptors are windows that are
forwarded downstream, and I don't think there's a way for a host bridge to
use those descriptors to describe its own CSR space.

But either we haven't figured out how to interpret producer/consumer
correctly, or BIOSes haven't used it consistently, and we end up with
problems like this one.  So I suspect we'll have to give up and just
ignore the producer/consumer bit.

> I applied the new patch on top of Linus latest (from this morning
> HEAD=6c373ca89399c5a3f7ef210ad8f63dc3437da345) without any
> reverts.  System booted OK with both disks online and networking
> functional).

This looks better ... I think.  Here's the change this patch makes:

   ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-7f])
   acpi PNP0A08:00: host bridge window [io  0x0000-0x0cf7]
   acpi PNP0A08:00: host bridge window [io  0x1000-0x8fff]
  +acpi PNP0A08:00: host bridge window [mem 0x000a0000-0x000bffff]
  +acpi PNP0A08:00: host bridge window [mem 0x000c0000-0x000fffff]
  +acpi PNP0A08:00: host bridge window [mem 0xfec00000-0xfec3ffff]
  +acpi PNP0A08:00: host bridge window [mem 0xfed1c000-0xfed1c0ff]
  +acpi PNP0A08:00: host bridge window [mem 0xfed40000-0xfedfffff]
   acpi PNP0A08:00: host bridge window [mem 0x50000000-0x9fffffff]
  +acpi PNP0A08:00: host bridge window [mem 0x10000000000-0x100fffffffe]
  +acpi PNP0A08:00: host bridge window [mem 0x10100000000-0x101fffffffe]
  +acpi PNP0A08:00: host bridge window [mem 0x10200000000-0x102fffffffe]
  +acpi PNP0A08:00: host bridge window [mem 0x10300000000-0x103fffffffe]

   ACPI: PCI Root Bridge [PCI1] (domain 0000 [bus 80-ff])
   acpi PNP0A08:01: host bridge window [io  0x9000-0xfffe]
  +acpi PNP0A08:01: host bridge window [mem 0xfec40000-0xfec7ffff]
  +acpi PNP0A08:01: host bridge window [mem 0xa0000000-0xefffffff]
  +acpi PNP0A08:01: host bridge window [mem 0x10400000000-0x104fffffffe]
  +acpi PNP0A08:01: host bridge window [mem 0x10500000000-0x105fffffffe]
  +acpi PNP0A08:01: host bridge window [mem 0x10600000000-0x106fffffffe]
  +acpi PNP0A08:01: host bridge window [mem 0x10700000000-0x107fffffffe]

The addition of the [mem 0xa0000000-0xefffffff] window for PCI1, which we
previously ignored, is what makes your igb and mptsas devices work again.

It concerns me a little bit that the BIOS apparently did set the producer
bit for the PCI0 [mem 0x50000000-0x9fffffff] window, but not for any of
the other windows, not even the ones that fit in 32 bits.  But maybe that
inconsistency is just a little BIOS lint that doesn't mean anything.

Anyway, I guess I'll package up this patch and post it.

Bjorn

[1] http://lkml.kernel.org/r/20150404030411.GG10892@google.com

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 48cc65705db4..cd96ddc2bc6c 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -240,15 +240,12 @@  static acpi_status resource_to_window(struct acpi_resource *resource,
 	 * We're only interested in _CRS descriptors that are
 	 *	- address space descriptors for memory or I/O space
 	 *	- non-zero size
-	 *	- producers, i.e., the address space is routed downstream,
-	 *	  not consumed by the bridge itself
 	 */
 	status = acpi_resource_to_address64(resource, addr);
 	if (ACPI_SUCCESS(status) &&
 	    (addr->resource_type == ACPI_MEMORY_RANGE ||
 	     addr->resource_type == ACPI_IO_RANGE) &&
-	    addr->address.address_length &&
-	    addr->producer_consumer == ACPI_PRODUCER)
+	    addr->address.address_length)
 		return AE_OK;
 
 	return AE_ERROR;
@@ -276,6 +273,12 @@  static acpi_status add_window(struct acpi_resource *res, void *data)
 	unsigned long flags, offset = 0;
 	struct resource *root;
 
+	/* ACPI_RESOURCE_TYPE_IRQ etc. */
+	printk("host bridge resource %02d length %#02x\n", res->type,
+	       res->length);
+	print_hex_dump(KERN_INFO, "  : ", DUMP_PREFIX_OFFSET, 16, 1,
+		       &res->data, res->length, 0);
+
 	/* Return AE_OK for non-window resources to keep scanning for more */
 	status = resource_to_window(res, &addr);
 	if (!ACPI_SUCCESS(status))
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 5589a6e2a023..ae5534a6bce7 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -483,6 +483,11 @@  static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
 	struct resource *res = &win.res;
 	int i;
 
+	printk("process resource %02d length %#02x\n", ares->type,
+	       ares->length);
+	print_hex_dump(KERN_INFO, "  : ", DUMP_PREFIX_OFFSET, 16, 1,
+		       &ares->data, ares->length, 0);
+
 	if (c->preproc) {
 		int ret;