Re: PCI memory allocation bug with CONFIG_HIGHMEM

From: Linus Torvalds
Date: Tue Jan 06 2004 - 19:08:03 EST




On Tue, 6 Jan 2004, Eric W. Biederman wrote:
>
> And mtd map drivers for rom chips run into the same problem except in
> that case regions is almost always reserved by the BIOS.
>
> Which means it's just silly for the drivers to fail when request_mem_region
> fails.

Note: you're not supposed to need to do "request_mem_region()" for modern
drivers. You should only need to claim ownership of the resources, and the
PCI driver interfaces should do that automatically.

What you should do for resources you know about is to just _create_ them.
Not necessarily request them (although that is one way of creating them),
but you can literally just tell the kernel that they are there. That will
already mean that anybody else that tries to allocate a resource will
avoid that area.

So if you know the hardware is there, and it _tells_ you it's there
(unlike, say, an ISA device), you can just call "request_mem_region()"
without ever even checking the error return (although you had better make
sure that the name allocation is stable if you are a module - don't want
to start oopsin in /proc if the module gets unloaded).

The PCI layer already does all of that for the "standard" resources. It's
just that the generic code can't do it for nonstandard regions, so drivers
for chips that don't have just the regular BAR things should create their
own resource entries..

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/