Re: Ignore disabled ROM resources at setup

From: Linus Torvalds
Date: Mon Aug 29 2005 - 22:54:28 EST




On Tue, 30 Aug 2005, Benjamin Herrenschmidt wrote:
>
> Ok, it won't do nothing in fact. It's worse. It will return 0 (success),
> will actually assign a completely new address to the resource, will
> update the resource structure ... and will _not_ update the PCI resource
> BAR for the ROM.
>
> That is very bad and definitely not what you want, wether it's ppc, x86
> or anything else. Either fail (don't assign the resource at all) or if
> you assign it, keep the BAR in sync with the struct resource.

I argue that the BAR _is_ in sync with the resource.

The resource is allocated, but not enabled. You want to enable it, you
need to write the BAR.

The fact is, that writing the address (but not the enable bit) to the BAR
when it's not enabled leads to problems. It wasn't entirely clear whether
the problems were in the X server (possible) or whether it was actual
hardware (hey, nothing surprises me any more).

So what allocate does is to _allocate_ it. It so happens that with normal
PIO and IOMEM resources, there is no per-resource "enable" bit, so they
are always enabled. However, PCI ROM's have a per-resource enable bit both
in hardware and in the "struct resource", and if it isn't set, then the
resource allocation is done, but the resource is not enabled and not
written to hardware.

All very consistent. The allocation was successful, but you didn't ask to
enable it, so pci_alloc_resource() will return success without actually
enablign the hardware.

What you want is a "zombie state", where we write the partial information
to hardware. It's what we used to do, but it's certainly no more logical
than what it does now, and it led to problem reports.

Btw, why does this happen on powerpc, but not x86? I'm running a radeon
laptop right now myself. Hmm..

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/