Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 87569 - ati-drivers MTRR setting fails
Summary: ati-drivers MTRR setting fails
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Luca Barbato
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-01 08:22 UTC by Nicolas Faivre
Modified: 2005-10-20 03:51 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
kernel .config file (config-2.6.11-r4,31.18 KB, text/plain)
2005-04-02 11:53 UTC, Nicolas Faivre
Details
emerge info output (emerge.info.out,1.91 KB, text/plain)
2005-04-02 11:56 UTC, Nicolas Faivre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Faivre 2005-04-01 08:22:28 UTC
I'm using ati-drivers-8.10.19 on an ATI X600 with 64MB.
The contained fglrx driver fails to set MTRR upon X startup.
It says:
>> mtrr: base(0xf0000000) is not aligned on a size(0x7ff0000) boundary.
>> [fglrx:firegl_addmap] *ERROR* mtrr allocation failed (-22)

I searched for details on that and found in http://developer.intel.ru/design/pentium4/manuals/253668.htm section 10.11.14: "for each range greater than 4KB, range must be of length 2**n".

0x7ff0000 is not of length 2**n. Smth is wrong in the ATI driver.

Reproducible: Always
Steps to Reproduce:
1. emerge ati-drivers
2. run startx
3. check result through dmesg

Actual Results:  
It says:
>> mtrr: base(0xf0000000) is not aligned on a size(0x7ff0000) boundary.
>> [fglrx:firegl_addmap] *ERROR* mtrr allocation failed (-22)

Expected Results:  
The driver should have set the MTRR correctly.
Comment 1 Nicolas Faivre 2005-04-01 08:45:08 UTC
I posted a bug report to ATI customer care: Ticket #:  737-784596
Let's see how they take it.
Cheers.
Comment 2 Luca Barbato gentoo-dev 2005-04-01 12:03:39 UTC
Could you please attach the emerge info output and your .config?
Comment 3 Nicolas Faivre 2005-04-02 11:53:57 UTC
Created attachment 55130 [details]
kernel .config file
Comment 4 Nicolas Faivre 2005-04-02 11:56:53 UTC
Created attachment 55131 [details]
emerge info output
Comment 5 Nicolas Faivre 2005-04-02 12:04:36 UTC
Digging further it seems the driver tries to set 2 memory type ranges: a first one of size 128M-64K and a second of 64K. Both have type WC (write-combining), so setting one single 128M range would be enough.
A possible patch is to modify file firegl_public.c and make the ff change:
<code>
int ATI_API_CALL __ke_mtrr_add_wc(unsigned long base, unsigned long size)
{
#ifdef CONFIG_MTRR
+   /* find the nearest 2**n value for size */
+   unsigned long correct_size = 0x1000; /* start with 4KB */
+   while (correct_size<size) correct_size=correct_size*2;
    return mtrr_add(base, correct_size, MTRR_TYPE_WRCOMB, 1);
#else /* !CONFIG_MTRR */
    return -EPERM;
#endif /* !CONFIG_MTRR */
}
</code>
Cheers.
Comment 6 Luca Barbato gentoo-dev 2005-04-28 07:58:48 UTC
is the latest released working as should?
Comment 7 Luca Barbato gentoo-dev 2005-09-27 10:06:28 UTC
Is still an issue?
Comment 8 Luca Barbato gentoo-dev 2005-10-20 03:51:25 UTC
Closed as worksforme. Reopen if the issue is still present