All pastes #350588 Raw Edit

fglrx xen patch

public text v1 · immutable
#350588 ·published 2007-02-11 15:49 UTC
rendered paste body
iwan ~ # cat /usr/local/portage/x11-drivers/ati-drivers-xen/files/fglrx-r3.patch
diff -Nur old/common/lib/modules/fglrx/build_mod/agpgart_be.c new/common/lib/modules/fglrx/build_mod/agpgart_be.c
--- old/common/lib/modules/fglrx/build_mod/agpgart_be.c 2007-01-09 12:26:33.000000000 +0100
+++ new/common/lib/modules/fglrx/build_mod/agpgart_be.c 2007-02-11 15:25:38.694160228 +0100
@@ -128,10 +128,17 @@
 #include <linux/pm_legacy.h>
 #endif
 #endif
-#include <asm/system.h>
 #include <asm/uaccess.h>
+
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+#include <asm/mach-xen/asm/system.h>
+#include <asm/mach-xen/asm/io.h>
+#include <asm/mach-xen/asm/page.h>
+#else
+#include <asm/system.h>
 #include <asm/io.h>
 #include <asm/page.h>
+#endif

 #include "agp_backend.h"
 #include "agp.h"
@@ -1188,7 +1195,11 @@
     if (!err)
 #endif
     {
+#if defined(CONFIG_X86_XEN) && ( LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+       agp_bridge.gatt_table = ioremap_nocache(virt_to_bus(table),
+#else
        agp_bridge.gatt_table = ioremap_nocache(virt_to_phys(table),
+#endif
                                        (PAGE_SIZE * (1 << page_order)));
     }
        CACHE_FLUSH();
@@ -3225,8 +3236,12 @@
     if (!err)
 #endif
     {
-        page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
-            PAGE_SIZE);
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+       page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
+#else
+       page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
+#endif
+       PAGE_SIZE);
     }

     if ( (page_map->remapped == NULL)
@@ -4698,7 +4713,11 @@
     if (!err)
 #endif
     {
+#if defined(CONFIG_X86_XEN) && ( LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+       page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
+#else
        page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
+#endif
                                            PAGE_SIZE);
     }

@@ -5795,7 +5814,11 @@
         err = change_page_attr(virt_to_page(page_map->real), 1, PAGE_KERNEL_NOCACHE);
 #endif
         CACHE_FLUSH();
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+       page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
+#else
         page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
+#endif
                                             PAGE_SIZE);
         if (page_map->remapped == NULL || err) {
                 ClearPageReserved(virt_to_page(page_map->real));
diff -Nur old/common/lib/modules/fglrx/build_mod/drmP.h new/common/lib/modules/fglrx/build_mod/drmP.h
--- old/common/lib/modules/fglrx/build_mod/drmP.h       2007-01-09 12:26:33.000000000 +0100
+++ new/common/lib/modules/fglrx/build_mod/drmP.h       2007-02-11 15:21:56.025129785 +0100
@@ -59,7 +59,13 @@
 #if defined(__alpha__) || defined(__powerpc__)
 #include <asm/pgtable.h> /* For pte_wrprotect */
 #endif
+
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+#include <asm/mach-xen/asm/io.h>
+#else
 #include <asm/io.h>
+#endif
+
 #include <asm/mman.h>
 #include <asm/uaccess.h>
 #ifdef CONFIG_MTRR
@@ -80,7 +86,13 @@
 #include <linux/workqueue.h>
 #endif
 #include <linux/poll.h>
+
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+#include <asm/mach-xen/asm/pgalloc.h>
+#else
 #include <asm/pgalloc.h>
+#endif
+
 #include "drm.h"

 #include "drm_os_linux.h"
diff -Nur old/common/lib/modules/fglrx/build_mod/firegl_public.c new/common/lib/modules/fglrx/build_mod/firegl_public.c
--- old/common/lib/modules/fglrx/build_mod/firegl_public.c      2007-02-11 00:47:36.000000000 +0100
+++ new/common/lib/modules/fglrx/build_mod/firegl_public.c      2007-02-11 15:17:24.457559120 +0100
@@ -43,6 +43,7 @@
 #if !defined(CONFIG_X86_BIGSMP)
 #if !defined(CONFIG_X86_VISWS)
 #if !defined(CONFIG_X86_GENERICARCH)
+#if !defined(CONFIG_X86_XEN)
 #error unknown or undefined architecture configured
 #endif
 #endif
@@ -52,6 +53,7 @@
 #endif
 #endif
 #endif
+#endif
 #endif /* LINUX_VERSION_CODE */

 /* The dirty-page-tracking patch included in NLD 9 SMP kernels defines
@@ -122,12 +124,29 @@
 #include <linux/console.h>

 //#include <linux/signal.h>
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+#include <asm/mach-xen/asm/io.h>
+#else
 #include <asm/io.h>
+#endif
+
 #include <asm/mman.h>
 #include <asm/uaccess.h>
+
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+#include <asm/mach-xen/asm/processor.h>
+#else
 #include <asm/processor.h>
+#endif
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+#include <asm/mach-xen/asm/tlbflush.h>
+#else
 #include <asm/tlbflush.h> // for flush_tlb_page
+#endif
+
 #else
 #include <asm/pgalloc.h> // for flush_tlb_page
 #endif
@@ -167,6 +186,10 @@

 #include <linux/kmod.h>
 #include "firegl_public.h"
+
+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+#include <asm/mach-xen/asm/pgtable.h>
+#endif
 // ============================================================
 #ifndef TRUE
 #define TRUE 1
diff -Nur old/common/lib/modules/fglrx/build_mod/firegl_public.h new/common/lib/modules/fglrx/build_mod/firegl_public.h
--- old/common/lib/modules/fglrx/build_mod/firegl_public.h      2007-01-09 12:26:33.000000000 +0100
+++ new/common/lib/modules/fglrx/build_mod/firegl_public.h      2007-02-11 14:26:55.808598509 +0100
@@ -36,8 +36,14 @@

 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)

+#if defined(CONFIG_X86_XEN)
+#define REMAP_PAGE_RANGE_FN io_remap_pfn_range
+#define REMAP_PAGE_RANGE_STR "io_remap_pfn_range"
+#else
 #define REMAP_PAGE_RANGE_FN remap_pfn_range
 #define REMAP_PAGE_RANGE_STR "remap_pfn_range"
+#endif /* CONFIG_X86_XEN */
+
 #define REMAP_PAGE_RANGE_OFF(offset) ((offset) >> PAGE_SHIFT)

 #else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9) */
@@ -48,13 +54,24 @@

 #endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) */

+#if defined(CONFIG_X86_XEN) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
+
 #define REMAP_PAGE_RANGE(vma,offset) \
-    REMAP_PAGE_RANGE_FN(FGL_VMA_API_PASS \
+    REMAP_PAGE_RANGE_FN(vma, \
                         (vma)->vm_start,       \
                         REMAP_PAGE_RANGE_OFF(offset), \
                         (vma)->vm_end - (vma)->vm_start, \
                         (vma)->vm_page_prot)

+#else
+
+#define REMAP_PAGE_RANGE(vma,offset) \
+    REMAP_PAGE_RANGE_FN(FGL_VMA_API_PASS \
+                        (vma)->vm_start,       \
+                        REMAP_PAGE_RANGE_OFF(offset), \
+                        (vma)->vm_end - (vma)->vm_start, \
+                        (vma)->vm_page_prot)
+#endif

 /* Page table macros */