Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 80410 - ati-drivers 8.8.25-r3 need patch to compile against 2.6.10-mm kernel
Summary: ati-drivers 8.8.25-r3 need patch to compile against 2.6.10-mm kernel
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-01 18:18 UTC by Helmut Eberharter
Modified: 2005-04-11 04:29 UTC (History)
2 users (show)

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


Attachments
Patch for the ati-drivers-8.10.19 ebuild for <2.6.10 kernels. (ati-drivers-ebuild.patch,398 bytes, patch)
2005-03-09 02:57 UTC, Sebastian Redl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Eberharter 2005-02-01 18:18:50 UTC
with kernel 2.6.10-rc3-mm1 during compile, gcc complained about 'pgd_offset' and 'remap_page_range', similar errors were reportet (dmesg) during loading the fglrx-module.
afer searching the weg heavily, i found patches for this problems would be nice to see them in the next ebuild.

#####################################
# 8.08-kernel-2.6.11-pgd_offset.patch
#####################################
--- firegl_public.c.back   2005-01-19 14:37:50.000000000 +0000
+++ firegl_public.c   2005-01-19 14:42:03.000000000 +0000
@@ -1575,7 +1575,7 @@
     pte_t  pte;

     pte_linear = VMALLOC_VMADDR(virtual_addr);  // convert to pte linear address (x86 => nop)
-    pgd_p = pgd_offset(mm, pte_linear);
+    pgd_p = pml4_pgd_offset(pml4_offset(mm, pte_linear), pte_linear);
     pmd_p = pmd_offset(pgd_p, pte_linear);
 #ifndef FGL_ATOMIC_PTE
 #if LINUX_VERSION_CODE > 0x020500
@@ -2062,7 +2062,7 @@
    */
    pgd_p = pgd_offset_k(pte_linear);
 #else
-    pgd_p = pgd_offset(&init_mm, pte_linear); /* locate page directory entry */
+    pgd_p = pml4_pgd_offset(pml4_offset(&init_mm, pte_linear), pte_linear); /* locate page directory entry */
 #endif
    if (!pgd_present(*pgd_p))
    {
@@ -2441,7 +2441,7 @@
     pte_t  pte;

     pte_linear = VMALLOC_VMADDR(virtual_addr);  // convert to pte linear address (x86 => nop)
-    pgd_p = pgd_offset(vma->vm_mm, pte_linear);
+    pgd_p = pml4_pgd_offset(pml4_offset(vma->vm_mm, pte_linear), pte_linear);
     pmd_p = pmd_offset(pgd_p, pte_linear);
 #ifndef FGL_ATOMIC_PTE
 #if LINUX_VERSION_CODE > 0x020500
### EOF ###


###########################################
# 8.08-kernel-2.6.11-remap_page_range.patch
###########################################
diff -urN build_mod/agpgart_be.c build_mod2/agpgart_be.c
--- build_mod/agpgart_be.c      2005-01-17 23:34:04.000000000 +0000
+++ build_mod2/agpgart_be.c     2005-01-17 23:36:12.000000000 +0000
@@ -116,7 +116,14 @@
 #include <linux/pagemap.h>
 #include <linux/miscdevice.h>
 #include <linux/pm.h>
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
+#define pci_find_class pci_get_class

+
+
+
+
+#endif
 #if (LINUX_VERSION_CODE >= 0x020400)
 #define FGL_PM_PRESENT
 #else
diff -urN build_mod/firegl_public.c build_mod2/firegl_public.c
--- build_mod/firegl_public.c   2005-01-17 23:34:04.000000000 +0000
+++ build_mod2/firegl_public.c  2005-01-17 23:36:02.000000000 +0000
@@ -2590,13 +2590,13 @@
 #endif /* __ia64__ */
                 vma->vm_flags |= VM_IO; /* not in core dump */
             }
-            if (remap_page_range(FGL_VMA_API_PASS
+            if (remap_pfn_range(FGL_VMA_API_PASS
                                  vma->vm_start,
-                                 __ke_vm_offset(vma),
+                                 vma->vm_pgoff,
                                  vma->vm_end - vma->vm_start,
                                  vma->vm_page_prot))
             {
-                __KE_DEBUG("remap_page_range failed\n");
+                __KE_DEBUG("remap_pfn_range failed\n");
                 return -EAGAIN;
             }
             vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
@@ -2655,15 +2655,15 @@
 #else
                        //                      else
                        {
-                               if (__ke_vm_offset(vma) >= __pa(high_memory))
+                               if (vma->vm_pgoff >= __pa(high_memory))
                                        vma->vm_flags |= VM_IO; /* not in core dump */
-                               if (remap_page_range(FGL_VMA_API_PASS
+                               if (remap_pfn_range(FGL_VMA_API_PASS
                                                                         vma->vm_start,
-                                                                        __ke_vm_offset(vma),
+                                                                        vma->vm_pgoff,
                                                                         vma->vm_end - vma->vm_start,
                                                                         vma->vm_page_prot))
                                {
-                                       __KE_DEBUG("remap_page_range failed\n");
+                                       __KE_DEBUG("remap_pfn_range failed\n");
                                        return -EAGAIN;
                                }
 #ifdef __x86_64__
@@ -2692,15 +2692,15 @@
 //                     else
 #else
                        {
-                               if (__ke_vm_offset(vma) >= __pa(high_memory))
+                               if (vma->vm_pgoff >= __pa(high_memory))
                                        vma->vm_flags |= VM_IO; /* not in core dump */
-                               if (remap_page_range(FGL_VMA_API_PASS
+                               if (remap_pfn_range(FGL_VMA_API_PASS
                                                                         vma->vm_start,
-                                                                        __ke_vm_offset(vma),
+                                                                        vma->vm_pgoff,
                                                                         vma->vm_end - vma->vm_start,
                                                                         vma->vm_page_prot))
                                {
-                                       __KE_DEBUG("remap_page_range failed\n");
+                                       __KE_DEBUG("remap_pfn_range failed\n");
                                        return -EAGAIN;
                                }
 #ifdef __x86_64__
### EOF ###


i tested this on:
2.6.10-rc3-mm1 / gcc version 3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)


Reproducible: Always
Steps to Reproduce:
1.emerge ati-drivers
2.
3.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-02-03 04:57:18 UTC
please include urls for where you found these patches.
Comment 2 Luca Barbato gentoo-dev 2005-02-03 06:32:51 UTC
The

__ke_vm_offset(vma) -> vma->vm_pgoff

is wrong

the right way is add another define for __ke_vm_offset()
Comment 3 Dylan Carlson (RETIRED) gentoo-dev 2005-02-05 09:20:16 UTC
My bad, I didn't see this bug first.  I added a patch today for the 4-level pagetable stuff in 2.6.11.  It should be backward compatible so I didn't think too much about dropping it in since it works fine in my vanilla 2.6.10 config.

Test it out and see if it works for you.  If not, flame on.  :)
Comment 4 jon jonsson 2005-02-05 14:50:28 UTC
How about adding an note in the readme where the patches are from ?
as simple as adding www.rage3d.com.
cheers Jon

p.s.: it would also be nice to give some of the gentoo-only patches back to the community, for example post them to rage3d forums

the url with the first appearance of the pagetable patch:
http://rage3d.com/board/showthread.php?t=33798874&page=2&pp=30
Comment 5 Luca Barbato gentoo-dev 2005-02-06 04:27:09 UTC
The gentoo only patches that could be useful are resent upstream and are available on mirrors.

Nowadays, most of them are just minor fixes that other distributions and, probably, rage3d forums already have.
Comment 6 Sebastian Redl 2005-03-09 02:57:11 UTC
Created attachment 53004 [details, diff]
Patch for the ati-drivers-8.10.19 ebuild for <2.6.10 kernels.

The patch from rage3d about remap_page_range vs remap_pfn_range breaks the
module on 2.6.9 kernels, though. The 8.10.19 ebuild patches all 2.6 kernels
with it, though.

Attached is a patch for the ebuild that only applies the remap patch if the
kernel is greater than 2.6.9, not for all 2.6 kernels.

Using this, the module compiles and runs clean on my machine
(gentoo-dev-sources-2.6.9-r14, AMD64).
Comment 7 Luca Barbato gentoo-dev 2005-03-11 15:20:19 UTC
I'll try to sort out the right ifdef magic to avoid such kludge, the next time please open another bug since the problems are quite unrelated
Comment 8 Luca Barbato gentoo-dev 2005-04-11 04:29:32 UTC
Fixed long time ago, I think