# [solved] mtrr fglrx

## mimosinnet

Dmesg gives me an error with mtrr and fglrx. I have been able to play with mtrr registers with:

```
echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr
```

Nevertheless, I have been unable to get rid of the error. I would appreciate any help on this. 

```
fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel.

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

[fglrx] module loaded - fglrx 8.32.5 [Dec 12 2006] on minor 0

ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 16 (level, low) -> IRQ 16

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

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

[fglrx] total      GART = 130023424

[fglrx] free       GART = 114032640

[fglrx] max single GART = 114032640

[fglrx] total      LFB  = 134086656

[fglrx] free       LFB  = 126742528

[fglrx] max single LFB  = 126742528

[fglrx] total      Inv  = 0

[fglrx] free       Inv  = 0

[fglrx] max single Inv  = 0

[fglrx] total      TIM  = 0
```

I am running a:

```
# cat /proc/cpuinfo

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 6

model           : 15

model name      : Intel(R) Core(TM)2 CPU          6300  @ 1.86GHz

stepping        : 6

cpu MHz         : 1860.649

cache size      : 2048 KB
```

And the beginning of the emerge --info:

 *Quote:*   

> # emerge --info
> 
> Portage 2.1.2.2 (default-linux/amd64/2006.1, gcc-4.1.1, glibc-2.5-r0, 2.6.19-gentoo-r5 x86_64)
> 
> =================================================================
> ...

 Last edited by mimosinnet on Tue Jun 12, 2007 5:24 pm; edited 1 time in total

----------

## hermanng

Hmm, my (generated) xorg.conf says: don't use mtrr 

```
    Option "mtrr"                       "off" # disable DRI mtrr mapper, driver has its own code for mtrr
```

you may want to try that

----------

## mrbig4545

is there anything in dmesg, after x loading, ans also what does dmesg say near agpgart messages?

mark

----------

## mimosinnet

 *mrbig4545 wrote:*   

> is there anything in dmesg, after x loading, ans also what does dmesg say near agpgart messages?
> 
> mark

 

Thanks very much for the repply. I am not sure how to distinguish the part in dmesg after x loads, so these are the last messages in dmesg:

 *Quote:*   

> fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel.
> 
> [fglrx] Maximum main memory to use for locked dma buffers: 1881 MBytes.
> 
> [fglrx] module loaded - fglrx 8.32.5 [Dec 12 2006] on minor 0
> ...

 

This is what's near agpgart:

 *Quote:*   

> # dmesg | grep -C 10 agpgart
> 
> Allocate Port Service[0000:00:01.0:pcie00]
> 
> PCI: Setting latency timer of device 0000:00:1c.0 to 64
> ...

 

----------

## mimosinnet

 *hermanng wrote:*   

> Hmm, my (generated) xorg.conf says: don't use mtrr 
> 
> ```
>     Option "mtrr"                       "off" # disable DRI mtrr mapper, driver has its own code for mtrr
> ```
> ...

 

Thanks for the reply. I have disabled mtrr in xorg.conf and error message persists. 

 *Quote:*   

> # dmesg | grep mtrr
> 
> mtrr: type mismatch for c0000000,8000000 old: write-back new: write-combining
> 
> [fglrx:firegl_addmap] *ERROR* mtrr allocation failed (-22)

 

 *Quote:*   

> # grep -C 10 mtrr /etc/X11/xorg.conf
> 
> # ATI radeon X1300
> 
> Section "Device"
> ...

 

----------

## hermanng

 *mimosinnet wrote:*   

>  *Quote:*   # grep -C 10 mtrr /etc/X11/xorg.conf
> 
> # ATI radeon X1300
> 
> Section "Device"
> ...

  Did you try the mtrr-fix script in that thread ? Especially the leading

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

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

echo "disable=2" >| /proc/mtrr
```

before changing /proc/mtrr with your echo command ? A script to fix the mtrr should run in the bootlevel (probably before udev).

Also, what is the output "lspci | grep ATI" ? My somewhat older system shows 2 devices 

```
tsunami ~ # lspci | grep ATI

01:00.0 VGA compatible controller: ATI Technologies Inc Radeon R300 NE [Radeon 9500 Pro]

01:00.1 Display controller: ATI Technologies Inc Radeon R300 [Radeon 9500 Pro] (Secondary)
```

and there are 2 write-combining mtrr entries accordingly

```
tsunami ~ # cat /proc/mtrr

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

reg01: base=0xe0000000 (3584MB), size= 128MB: write-combining, count=1

reg02: base=0xf0000000 (3840MB), size= 128MB: write-combining, count=1
```

hth

----------

## mimosinnet

 *hermanng wrote:*   

> Did you try the mtrr-fix script in that thread ? Especially the leading
> 
> ```
> echo "disable=0" >| /proc/mtrr
> 
> ...

 

 *hermanng wrote:*   

> Also, what is the output "lspci | grep ATI" ?

 

Because of the error message, I started to play with mtrr registers. I had first this output:

```
cat /proc/mtrr 

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

 reg01: base=0x7f800000 (2040MB), size=   8MB: uncachable, count=1 

 reg02: base=0x7f700000 (2039MB), size=   1MB: uncachable, count=1 

 reg03: base=0x80000000 (2048MB), size=2048MB: uncachable, count=1
```

I am now using this script to change the mtrr registers:

```
#!/bin/sh

# Fixup /proc/mtrr

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

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

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

# Now create the right ones...

# Main Memory: 0-2048 (2048)

echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr

# System Devices + Video 2048-2304 (256)

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

This script is activated by /etc/conf.d/local.start and, as you say, 

 *hermanng wrote:*   

> A script to fix the mtrr should run in the bootlevel (probably before udev).

 

I am going to save as an init script to be executed at bootlevel. I give the results.

Also, I am quite puzzled as to how to define mtrr registers. These are the relevant parts of lspci:

```
# lspci -vvv

01:00.0 VGA compatible controller: ATI Technologies Inc RV516 [Radeon X1300/X1550 Series] (prog-if 00 [VGA])

        Subsystem: Dell Unknown device 0402

        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-

        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-

        Latency: 0, Cache Line Size: 64 bytes

        Interrupt: pin A routed to IRQ 16

        Region 0: Memory at c0000000 (64-bit, prefetchable) [size=256M]

        Region 2: Memory at dfde0000 (64-bit, non-prefetchable) [size=64K]

        Region 4: I/O ports at dc00 [size=256]

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

01:00.1 Display controller: ATI Technologies Inc RV516 [Radeon X1300/X1550 Series] (Secondary)

        Subsystem: Dell Unknown device 0403

        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-

        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-

        Latency: 0, Cache Line Size: 64 bytes

        Region 0: Memory at dfdf0000 (64-bit, non-prefetchable) [size=64K]
```

From the output I assumed there are 256Mb of video memory.

Cheers!

----------

## mimosinnet

EXCELLENT...!!!  :Very Happy:  Thanks a lot...!!! Your advice has been really helpful!

I have created an init script to be executed at boot runlevel:

```
#!/sbin/runscript

start() {

# First remove all existing values...

# Order matters - wrong order locks system hard!

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

# echo "disable=5" >| /proc/mtrr

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

# echo "disable=3" >| /proc/mtrr

# echo "disable=4" >| /proc/mtrr

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

# Main Memory: 0-2048 (2048)

# These are powers of two, they get progressively smaller

# so we can get right up to the system device page below.

echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr

# System Devices + Video 2048-2304 (256)

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

}
```

I have not defined any more memory registers, but it seems that it gets adjusted automatically:

```
# cat /proc/mtrr

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

reg01: base=0x80000000 (2048MB), size= 256MB: write-combining, count=1

reg02: base=0xc0000000 (3072MB), size= 128MB: write-combining, count=1
```

I am not sure where the 128MB of memory comes from, but I finally get rid of the error in dmesg.

Thanks for the help!

----------

