[PATCH] MTRRs above 4GB

From: Boszormenyi Zoltan (zboszor@externet.hu)
Date: Mon Jan 31 2000 - 08:22:55 EST


Hi!

Finally, I had a little time and did what I promised to Ingo Molnar:
I changed the MTRR driver to use page granularity instead of byte
granularity everywhere. Now the Intel PPro+ and AMD Athlon can set
MTRRs above 4GB! So, people with BIG machines, have a look at it. :-)
Maybe not all your memory are cached by default. Or if they are,
at least you can verify that. The other application where it might be
useful is that if you have a very large framebuffer on a 64 bit PCI
bus. (I saw a picture of a Xeon board with 64 bit PCI slots.)

The code was written and tested on a dual Celeron machine:

[root@boszi /proc]# cat mtrr
reg00: base=0x00000000 ( 0MB), size= 64MB: write-back, count=1
[root@boszi /proc]# echo "base=0x100000000 size=0x100000000
type=write-combining" >mtrr
[root@boszi /proc]# echo "base=0x100000000 size=0x1000 type=uncachable"
>mtrr
[root@boszi /proc]# echo "base=0xe0000000 size=0x4000000
type=write-combining" >mtrr
[root@boszi /proc]# cat mtrr
reg00: base=0x00000000 ( 0MB), size= 64MB: write-back, count=1
reg01: base=0x00100000000 ( 4096MB), size= 4096MB: write-combining,
count=1
reg02: base=0x00100000000 ( 4096MB), size= 4kB: uncachable,
count=1
reg03: base=0xe0000000 (3584MB), size= 64MB: write-combining, count=1

The code for other CPUs looks correct but needs testing. Though I still
have my old mainboard and the Cyrix 6x86MX CPU but I don't have a case
for them yet so I was unable to test it on Cyrix. So I would like to hear
test reports. Especially on Athlon, since I am still not sure about the
44 bit MTRRs. If /proc/mtrr shows incorrect memory base or size, try
changing AMD_OR_MASK.

Other interesting points:
- The drivers that use mtrr_add()/mtrr_del() should be updated.
  These functions use page granularity from now on.
- The possibility to use other than hexadecimal numbers in
  echo "base=..." >/proc/mtrr
  is lost. Since there is no simple_strtoull() for getting an
  unsigned long long value from a string, I had to work around it.
- No more than 44 bits are accepted in /proc/mtrr and 44 bits wide
  hexadecimal value appears in /proc/mtrr when a >4GB base is present.
- There are 5 new ioctls. They are like the old ones but accept
  numbers of pages for base and size.
- I dared to increase the version number: this is a feature that cries
  for a new version number. ;-)

The patch is attached and is against 2.3.41-pre4.

Comments, corrections are welcome.

Regards,
Zoltan Boszormenyi



-
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/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:28 EST