# mtrr's not set

## kahuna_lx

Hi all,

Under old gentoo-sources version < 2.6.10, MTRR's on my PC are set correctly.

I upgrade to Gentoo GNU/Linux 2005.1 version and Kernel 2.6.13-gentoo-sources-r3, but now mtrr ranges are not set   :Sad: 

```

kahuna@tomoe ~ $ cat /proc/mtrr

reg00: base=0x00000000 (   0MB), size=984064MB: write-back, count=1

```

Due to this issue, the privative ATI drivers doesn't work and I haven't render acceleration on my desktop.

Also I've tried to set MTRR from the shell but it has not worked.

```

tomoe ~ # cat /var/log/Xorg.0.log | grep Linear

(--) fglrx(0): Linear framebuffer (phys) at 0xc0000000

echo "base=0xc0000000 size=0x10000000 type=write-combining" >| /proc/mtrr

```

I'll add what details I can below. Please let me know what other information I can supply that might help to resolve this.

lspci:

```

0000:00:00.0 Host bridge: Intel Corporation 82865G/PE/P DRAM Controller/Host-Hub Interface (rev 02)

0000:00:01.0 PCI bridge: Intel Corporation 82865G/PE/P PCI to AGP Controller (rev 02)

0000:00:1d.0 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1 (rev 02)

0000:00:1d.1 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #2 (rev 02)

0000:00:1d.2 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #3 (rev 02)

0000:00:1d.3 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #4 (rev 02)

0000:00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02)

0000:00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c2)

0000:00:1f.0 ISA bridge: Intel Corporation 82801EB/ER (ICH5/ICH5R) LPC Interface Bridge (rev 02)

0000:00:1f.1 IDE interface: Intel Corporation 82801EB/ER (ICH5/ICH5R) IDE Controller (rev 02)

0000:00:1f.2 IDE interface: Intel Corporation 82801EB (ICH5) SATA Controller (rev 02)

0000:00:1f.3 SMBus: Intel Corporation 82801EB/ER (ICH5/ICH5R) SMBus Controller (rev 02)

0000:01:00.0 VGA compatible controller: ATI Technologies Inc RV350 AR [Radeon 9600]

0000:01:00.1 Display controller: ATI Technologies Inc RV350 AR [Radeon 9600] (Secondary)

0000:02:01.0 Network controller: RaLink Ralink RT2500 802.11 Cardbus Reference Card (rev 01)

0000:02:02.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)

0000:02:02.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)

0000:02:04.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1 (rev 07)

0000:02:04.1 Input device controller: Creative Labs SB Live! MIDI/Game Port (rev 07)

0000:02:09.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)

```

The graphics card:

```

0000:01:00.0 VGA compatible controller: ATI Technologies Inc RV350 AR [Radeon 9600] (prog-if 00 [VGA])

        Subsystem: Info-Tek Corp.: Unknown device 0242

        Flags: bus master, 66Mhz, medium devsel, latency 255, IRQ 18

        Memory at c0000000 (32-bit, prefetchable) [size=256M]

        I/O ports at 9000 [size=256]

        Memory at e9000000 (32-bit, non-prefetchable) [size=64K]

        Expansion ROM at e8000000 [disabled] [size=128K]

        Capabilities: [58] AGP version 3.0

        Capabilities: [50] Power Management version 2

0000:01:00.1 Display controller: ATI Technologies Inc RV350 AR [Radeon 9600] (Secondary)

        Subsystem: Info-Tek Corp.: Unknown device 0243

        Flags: bus master, 66Mhz, medium devsel, latency 32

        Memory at d0000000 (32-bit, prefetchable) [size=256M]

        Memory at e9010000 (32-bit, non-prefetchable) [size=64K]

        Capabilities: [50] Power Management version 2

```

/proc/cpuinfo:

```

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 15

model           : 3

model name      : Intel(R) Pentium(R) 4 CPU 3.00GHz

stepping        : 3

cpu MHz         : 3015.038

cache size      : 1024 KB

physical id     : 0

siblings        : 2

core id         : 0

cpu cores       : 1

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 5

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni monitor ds_cpl cid

bogomips        : 6037.66

processor       : 1

vendor_id       : GenuineIntel

cpu family      : 15

model           : 3

model name      : Intel(R) Pentium(R) 4 CPU 3.00GHz

stepping        : 3

cpu MHz         : 3015.038

cache size      : 1024 KB

physical id     : 0

siblings        : 2

core id         : 0

cpu cores       : 1

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 5

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni monitor ds_cpl cid

bogomips        : 6029.39

```

dmesg | grep mtrr:

```

mtrr: v2.0 (20020519)

mtrr: type mismatch for c0000000,10000000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,8000000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,4000000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,2000000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,1000000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,800000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,400000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,200000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,100000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,80000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,40000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,20000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,10000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,8000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,4000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,2000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,1000 old: write-back new: write-combining

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x800  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x400  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x200  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x100  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x80  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x40  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x20  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x10  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x8  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x4  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x2  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: size and base must be multiples of 4 kiB

mtrr: size: 0x1  base: 0xc0000000

 [<c010e0aa>] mtrr_check+0x4a/0x60

 [<c010e0f0>] mtrr_add+0x30/0x80

mtrr: type mismatch for c0000000,8000000 old: write-back new: write-combining

[fglrx:firegl_addmap] *ERROR* mtrr allocation failed (-22)

mtrr: type mismatch for e0000000,8000000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,10000000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,10000000 old: write-back new: write-combining

mtrr: type mismatch for c0000000,10000 old: write-back new: write-combining

mtrr: MTRR 2 not used

```

dmesg | grep fglrx:

```

[fglrx] Maximum main memory to use for locked dma buffers: 928 MBytes.

[fglrx] module loaded - fglrx 8.14.13 [Jun  8 2005] on minor 0

[fglrx:firegl_addmap] *ERROR* mtrr allocation failed (-22)

[fglrx] Internal AGP support requested, but kernel AGP support active.

[fglrx] Have to use kernel AGP support to avoid conflicts.

[fglrx] Kernel AGP support doesn't provide agplock functionality.

[fglrx] AGP detected, AgpState   = 0x1f004a1b (hardware caps of chipset)

[fglrx:firegl_unlock] *ERROR* Process 8058 using kernel context 0

```

Xorg.0.log Warnings & Errors:

```

(EE) fglrx(0): [agp] unable to acquire AGP, error "xf86_EINVAL"

(EE) fglrx(0): cannot in(WW) Open APM failed (/dev/apm_bios) (No such file or directory)

(WW) fglrx: No matching Device section for instance (BusID PCI:1:0:1) found

(WW) fglrx(0): board is an unknown third party board, chipset is supported

(WW) fglrx(0): Cannot read colourmap from VGA.  Will restore with default

(WW) fglrx(0): ***********************************************

(WW) fglrx(0): * DRI initialization failed!                  *

(WW) fglrx(0): * (maybe driver kernel module missing or bad) *

(WW) fglrx(0): * 2D acceleraton available (MMIO)             *

(WW) fglrx(0): * no 3D acceleration available                *

(WW) fglrx(0): ********************************************* *

(WW) Open APM failed (/dev/apm_bios) (No such file or directory)

(WW) Open APM failed (/dev/apm_bios) (No such file or directory)

it AGP

```

Thanks for your help

----------

## nooneuknow

I became the victim of the same annoyance. Currently I'm changing mtrr "manually" with the following script, prior to starting X.

```

#!/bin/sh

# Fix wrong MTRR setting

echo "disable=0" >| /proc/mtrr

echo "base=0x0 size=0x40000000 type=write-back" >| /proc/mtrr

```

Replace 0x40000000 with the size of your main memory. Not your main memory mind you.

0x08000000 = 128Mb

0x10000000 = 256Mb

0x40000000 = 1Gb

0x60000000 = 1.5Gb

0x80000000 = 2Gb

Im using gentoo-sources-2.6.14 and ati-drivers-8.18.8 btw.

----------

## omidxo

 *kahuna_lx wrote:*   

> /proc/cpuinfo:
> 
> ```
> processor       : 0
> 
> ...

 

a patch to fix "mtrr error" for Intel Pentium 4

```
diff -puN arch/i386/kernel/cpu/mtrr/main.c~cpuid_errta arch/i386/kernel/cpu/mtrr/main.c

--- linux-2.6.14-rc2/arch/i386/kernel/cpu/mtrr/main.c~cpuid_errta   2005-09-29 08:35:34.000000000 +0800

+++ linux-2.6.14-rc2-root/arch/i386/kernel/cpu/mtrr/main.c   2005-09-29 08:37:16.000000000 +0800

@@ -626,6 +626,14 @@ void __init mtrr_bp_init(void)

       if (cpuid_eax(0x80000000) >= 0x80000008) {

          u32 phys_addr;

          phys_addr = cpuid_eax(0x80000008) & 0xff;

+         /* CPUID workaround for Intel 0F33/0F34 CPU */

+         if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&

+             boot_cpu_data.x86 == 0xF &&

+             boot_cpu_data.x86_model == 0x3 &&

+             (boot_cpu_data.x86_mask == 0x3 ||

+              boot_cpu_data.x86_mask == 0x4))

+            phys_addr = 36;

+

          size_or_mask = ~((1 << (phys_addr - PAGE_SHIFT)) - 1);

          size_and_mask = ~size_or_mask & 0xfff00000;

       } else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR &&
```

any links about "mtrr":

https://forums.gentoo.org/viewtopic-t-389666-highlight-vesafb+unrecognized+mtrr+2.html

http://lkml.org/lkml/2005/9/28/323

http://www.rage3d.com/board/showthread.php?t=33831753

----------

## kahuna_lx

Thanks a lot, I'll try !!

----------

## n0rad

wow, this bothered me since kernel-2.6.12.

But the patch fixed everything.

thx!

Any chance this gets into the gentoo-sources?

----------

