On Thu, 12 Oct 2000, Tigran Aivazian wrote: > ok, doing it from the bottom up was fine (didn't lockup) but reaching the > last (first in your list) entry was refused by mtrr: > > mtrr: 0x0,0x100000000 overlaps existing 0xfeafe000,0x2000 Try the attached patch, and the driver will accept some cases where areas overlap and the types (cache/no cache) differ. These were tested. Here are some info: BIOS-provided physical RAM map: BIOS-e820: 000000000009fc00 @ 0000000000000000 (usable) BIOS-e820: 0000000000000400 @ 000000000009fc00 (reserved) BIOS-e820: 0000000000010000 @ 00000000000f0000 (reserved) BIOS-e820: 0000000007efd000 @ 0000000000100000 (usable) BIOS-e820: 0000000000002000 @ 0000000007ffd000 (ACPI data) BIOS-e820: 0000000000001000 @ 0000000007fff000 (ACPI NVS) BIOS-e820: 0000000000001000 @ 00000000fec00000 (reserved) BIOS-e820: 0000000000001000 @ 00000000fee00000 (reserved) BIOS-e820: 0000000000010000 @ 00000000ffff0000 (reserved) [root@localhost /root]# cd /proc [root@localhost /proc]# cat mtrr reg00: base=0x00000000 ( 0MB), size= 128MB: write-back, count=1 reg05: base=0xe2000000 (3616MB), size= 32MB: write-combining, count=1 [root@localhost /proc]# echo "disable=5" >mtrr [root@localhost /proc]# echo "disable=0" >mtrr [root@localhost /proc]# echo "base=0xffff0000 size=0x10000 type=uncachable" >mtrr [root@localhost /proc]# echo "base=0xfee00000 size=0x1000 type=uncachable" >mtrr [root@localhost /proc]# echo "base=0xfec00000 size=0x1000 type=uncachable" >mtrr [root@localhost /proc]# echo "base=0xde000000 size=0x2000000 type=uncachable" >mtrr [root@localhost /proc]# echo "base=0xe2000000 size=0x2000000 type=uncachable" >mtrr [root@localhost /proc]# echo "base=0 size=0x100000000 type=write-back" >mtrr [root@localhost /proc]# cat mtrr reg00: base=0xffff0000 (4095MB), size= 64kB: uncachable, count=1 reg01: base=0xfee00000 (4078MB), size= 4kB: uncachable, count=1 reg02: base=0xfec00000 (4076MB), size= 4kB: uncachable, count=1 reg03: base=0xde000000 (3552MB), size= 32MB: uncachable, count=1 reg04: base=0xe2000000 (3616MB), size= 32MB: uncachable, count=1 reg05: base=0x00000000 ( 0MB), size=4096MB: write-back, count=1 It works, the system is fast, and X comes up. If I do not set the videocard's areas, then X does not work, it locks up the machine. (Expected behaviour, write-back caching does no good on mmio registers.) The patch contains a typo fix which corrects the lines: reg00: base=0xfeafe000 (4074MB), size= 0kB: uncachable, count=1 reg01: base=0xfe9ee000 (4073MB), size= 0kB: uncachable, count=1 reg02: base=0xfe9ed000 (4073MB), size= 0kB: uncachable, count=1 It did not affect anything, only the kB sized entries were written incorrectly. Regards, Zoltan Boszormenyi
--- linux/arch/i386/kernel/mtrr.c.old1 Wed Oct 11 16:49:07 2000 +++ linux/arch/i386/kernel/mtrr.c Thu Oct 12 15:26:48 2000 @@ -1320,6 +1320,13 @@ /* At this point we know there is some kind of overlap/enclosure */ if ( (base < lbase) || (base + size > lbase + lsize) ) { + /* Allow overlap in some (tested) cases */ + if ( + ( ( type == MTRR_TYPE_WRBACK || type == MTRR_TYPE_WRTHROUGH || type == +MTRR_TYPE_WRCOMB) && ltype == MTRR_TYPE_UNCACHABLE ) + || + ( ( type == MTRR_TYPE_WRBACK || type == MTRR_TYPE_WRTHROUGH ) && ltype +== MTRR_TYPE_WRCOMB ) + ) + continue; up(&main_lock); printk ("mtrr: 0x%lx%s,0x%lx%s overlaps existing 0x%lx%s,0x%lx%s\n", base, base_suffix, size, size_suffix, @@ -1701,7 +1708,7 @@ { /* 1MB */ factor = 'k'; - size >>= 2; + size <<= 2; } else {