Re: PCI memory allocation bug with CONFIG_HIGHMEM

From: Linus Torvalds
Date: Tue Jan 06 2004 - 00:08:54 EST




On Mon, 6 Jan 2004, Andi Kleen wrote:
> >
> > You literally can't do that: the RAM addresses are decoded by the
> > northbridge before they ever hit the PCI bus, so it's impossible to "map
> > over" RAM in general.
>
> Are you sure? I have a doc from AMD somewhere on the memory ordering
> on K8 and it gives this order: (highest to lowest)
>
> AGP aperture, TSEG, ASEG, IORR, Fixed MTRR, TOP_MEM

Those are all in the CPU or northbridge (well, on the opteron, the
northbridge is integrated so it all boils down to the CPU).

So yes, I'm sure. You have to have northbridge-specific code to punch a
"hole" in the RAM decoder, and some of them are "bios-locked", ie they
have registers that become read-only after the first time they are written
(or after a special lock-bit has been written).

So in some cases you can't do it at all.

> I have successfully mapped the AGP aperture
> over RAM and also seen it shadowing PCI mappings. I admit I haven't tried
> it with PCI mappings.

The AGP aperture is generally done in the northbridge, so it all depends
on what the decode priority is for the northbridge chip. That's
implementation-dependent.

> But can you suggest a reliable way to find a memory hole in e820?
> I haven't one figured out and AFAIK there isn't even any guarantee
> by the BIOS that there is any. e.g. Opteron BIOS tend to use all
> the precious space < 4GB up for existing mappings and I would expect
> other i386 BIOS to behave the same.

If you ahve a proper e820 map, then it should work correctly, with
anything that is RAM being marked as such (or being marked as "reserved").

The problems happen when you do _not_ have a proper e820 map, either due
to bootloader bugs or BIOS problems, or because the user overrode the
values with a "mem=xxxx" thing.

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/