Re: Setting MTRRs for K6

Rafael Reilova (rreilova@ececs.uc.edu)
Sun, 4 Jul 1999 15:44:13 -0400 (EDT)


This is becoming a FAQ... perhaps the mtrr.txt should be updated with more
AMD and Cyrix specific info?

Hi,

On Sun, 4 Jul 1999, Kafu Nagai wrote:

> mtrr.txt gives a brief explanation as to how to set MTRRs. Unfortunately (for
> me), this seems to imply one has a processor of Intel P6 family. I would like to
>
> have some more information on the following points:
>
> - /proc/mtrr is empty, before I set up MTRRs. Is this ok ? According to
> mtrr.txt, the first two MTRRs seem already set. I know K6 has only two MTRRs.

They can be empty, no problem; or in any combination of empty/non-empty,
as long as the configuration of the registers when they are non-empty is
valid. Of course, this doesn't address performance, which you can really
screw up by (mis)-setting the mtrr's to, for instance, all memory as
uncachable.

In general, you want:
1) main memory as write-back
2) video memory as write-combining
3) I/O or non-memory covered by the above as uncachable.

So in particular, if you have 96MB of main memory and 4MB of video memory
at 0xa8000000 you will want something like this,

reg00: base=0x000a0000 ( 0MB), size= 128kB: write-combining, count=1
reg01: base=0x000c0000 ( 0MB), size= 256kB: uncachable, count=1
reg02: base=0xa8000000 (2688MB), size= 4MB: write-combining, count=1
reg06: base=0x06000000 ( 96MB), size= 32MB: uncachable, count=1
reg07: base=0x00000000 ( 0MB), size= 128MB: write-back, count=1

This is on a Cyrix MII which has 8 mtrr registers. The important two are
reg 6 & 7. Note how reg 6 is used to mark uncachable a region covered by
reg 7. This is required since address region sizes must be powers of two.

On a AMD K6 you are given only two mtrr's, so one will go to main memory
and the other to video ram. I'm not sure how the non-power of two memory
size is handled on AMD. But if it the same as with Cyrix or Intel then
either you are out of luck and can't use a mtrr for video memory, or can
try living dangerously and let some non-memory address space be marked as
write-back.

Finally, this is usually handled properly by the BIOS and if not by the
kernel for the main memory case (not so for video ram.) The fact that
on boot both registers are empty makes me suspicious that something is not
right in the kernel driver.

Cheers,

-Rafael

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