"reserved" regions in iomem_resource are in the way

From: Thayne Harbaugh
Date: Thu Oct 16 2003 - 17:22:36 EST


"reserved" resources in iomem are in the way when a driver needs to
reserve the same range.

arch/i386/kernel/setup.c:register_memory() queries the BIOS e820 and
marks certain "suggested" ranges as being "reserved". These resource
ranges then have the IORESOURCE_BUSY flag set and are registered in
iomem_resource using request_resource(). No handle for the "reserved"
resources is kept.

These "reserved" resources, suggested by the BIOS, are not always
correct. The BIOS may or may not be correct when listing reserved
ranges. Arguably, the BIOS does things that are convenient for it - not
necessarily convenient for the OS. This means that the BIOS may mark
incorrect ranges or ranges that a driver may be capable of using. Once
a range is marked by register_memory() as "reserved" then it becomes
unobtainable by everything else - nothing can register it even if it can
use the range.

The MTD map drivers (drivers/mtd/maps/{ich2rom,amd76xrom}.c) need to
reserve resources for reading and writing the BIOS flash chip (you do
want to update your BIOS from Linux w/o scrounging for a DOS floppy?).
Some BIOSes reserve the memory ranges where the FLASH chip is located.
This makes it impossible for the map drivers to register the memory
range - even though the map drivers are perfectly capable of using the
memory.

I have experimented with a couple solutions:

1) Don't reserve any of the e820 reserved regions. I know of BIOSes
that don't mark any reserved regions - even though there are some - and
Linux functions just fine. This would be as simple as removing the case
for reserved in setup.c.

2) Mark the reserved regions in a way so that a driver that knows better
than the BIOS can claim the regions. I have a preliminary patch for
this (http://plug.org/~thayne/files/reserve_resources-2.4.20-1.patch).

Fixing the reserved region problem will make it so that MTDs, APICs and
other things can be registered with iomem_resource making things more
correct and complete.


Attachment: signature.asc
Description: This is a digitally signed message part