I should point out that the nvidia driver 169.09 compiles out of the box with 
the debian linux-2.6.18-6-amd64 kernel, only exporting the 
IGNORE_XEN_PRESENCE environment variable.

The problems come in when you try to use a kernel with a newer xen patchset, 
like the one in the mercurial repository of xensource (2.6.18.8-xen).

I've made a patch, very similar to yours, but that addresses also problems in 
config.sh.

I've already posted it on the xen mailing list and the nvidia linux forum. 
I've received no feedback from the community..

Perhaps, I'm using it, and it works, also with opengl games and with twinview.
Only in nv.bak: conftest.h
diff -ur nv.bak/conftest.sh nv/conftest.sh
--- nv.bak/conftest.sh	2008-03-11 21:43:49.000000000 +0100
+++ nv/conftest.sh	2008-03-11 23:16:43.000000000 +0100
@@ -28,7 +28,7 @@
 if [ "$OUTPUT" != "$SOURCES" ]; then
     ARCH=`uname -m | sed -e 's/i.86/i386/'`
     CFLAGS="$CFLAGS -I$OUTPUT/include2 -I$OUTPUT/include \
--I$HEADERS -I$HEADERS/asm-$ARCH/mach-default"
+-I$HEADERS/asm-$ARCH/mach-xen -I$HEADERS -I$HEADERS/asm-$ARCH/mach-default"
     if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
         CFLAGS="$CFLAGS -I$HEADERS/asm-x86/mach-default"
     fi
@@ -50,7 +50,11 @@
             echo "#include <linux/autoconf.h>
             #include <linux/mm.h>
             void conftest_remap_page_range(void) {
+	    #ifdef CONFIG_XEN
+		io_remap_pfn_range();
+	    #else
                 remap_page_range();
+	    #endif
             }" > conftest$$.c
 
             $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
@@ -83,7 +87,11 @@
             #include <linux/mm.h>
             int conftest_remap_page_range(void) {
                 pgprot_t pgprot = __pgprot(0);
+	    #ifdef CONFIG_XEN
+                return io_remap_pfn_range(0L, 0L, 0L, pgprot);
+	    #else
                 return remap_page_range(0L, 0L, 0L, pgprot);
+	    #endif
             }" > conftest$$.c
 
             $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
@@ -161,7 +169,11 @@
             echo "#include <linux/autoconf.h>
             #include <linux/mm.h>
             void conftest_remap_pfn_range(void) {
-                remap_pfn_range();
+            #ifdef CONFIG_XEN
+	        io_remap_pfn_range();
+	    #else
+	        remap_pfn_range();
+	    #endif
             }" > conftest$$.c
 
             $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
@@ -597,7 +609,7 @@
             void conftest_kmem_cache_create(void) {
                 kmem_cache_create();
             }" > conftest$$.c
-
+		
             $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
             rm -f conftest$$.c
 
Only in nv.bak: Makefile
diff -ur nv.bak/Module.symvers nv/Module.symvers
--- nv.bak/Module.symvers	2008-03-11 21:43:49.000000000 +0100
+++ nv/Module.symvers	2008-03-11 23:00:00.000000000 +0100
@@ -1 +1 @@
-0x299442a7	nv_linux_devices	/usr/src/modules/nvidia-kernel/nv/nvidia	EXPORT_SYMBOL
+0x1f98b3b0	nv_linux_devices	/usr/src/modules/nvidia-kernel/nv/nvidia	EXPORT_SYMBOL
Only in nv.bak: nv_compiler.h
diff -ur nv.bak/nv-linux.h nv/nv-linux.h
--- nv.bak/nv-linux.h	2008-03-11 21:43:49.000000000 +0100
+++ nv/nv-linux.h	2008-03-11 22:09:03.000000000 +0100
@@ -274,7 +274,7 @@
  * tiny, and the kernel panics when it is exhausted. try to warn the user that
  * they need to boost the size of their pool.
  */
-#if defined(CONFIG_SWIOTLB) && !defined(GFP_DMA32)
+#if defined(CONFIG_SWIOTLB) && !defined(GFP_DMA32) && !defined(CONFIG_XEN)
 #define NV_SWIOTLB 1
 #endif
 
@@ -847,7 +847,10 @@
 #define NV_VM_INSERT_PAGE(vma, addr, page) \
     vm_insert_page(vma, addr, page)
 #endif
-#if defined(NV_REMAP_PFN_RANGE_PRESENT)
+#if defined(CONFIG_XEN)
+#define NV_REMAP_PAGE_RANGE(from, offset, x...) \
+ io_remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x)
+#elif defined(NV_REMAP_PFN_RANGE_PRESENT)
 #define NV_REMAP_PAGE_RANGE(from, offset, x...) \
     remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x)
 #elif defined(NV_REMAP_PAGE_RANGE_PRESENT)
@@ -970,6 +973,9 @@
         __pte_value;                                    \
     })
 
+#if !defined(CONFIG_XEN) 
+#define phys_to_machine(x) x
+#endif
 
 #define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
 #define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
Only in nv.bak: .nv.o.d
diff -ur nv.bak/nv-vm.c nv/nv-vm.c
--- nv.bak/nv-vm.c	2008-03-11 21:43:49.000000000 +0100
+++ nv/nv-vm.c	2008-03-11 22:09:03.000000000 +0100
@@ -38,7 +38,7 @@
             page_ptr->phys_addr,
             page_ptr->dma_addr,
             NV_GET_PAGE_COUNT(page_ptr),
-            NV_GET_PAGE_STRUCT(page_ptr->phys_addr)->flags);
+            NV_GET_PAGE_STRUCT(phys_to_machine(page_ptr->phys_addr)->flags);
     }
 }
 #endif
@@ -352,6 +352,9 @@
 
 static void nv_flush_caches(void)
 {
+#if defined(CONFIG_PREEMPT_RT)
+ if(!nv_pat_enabled) return; 
+#endif
 #if defined(KERNEL_2_4)
     // for 2.4 kernels, just automatically flush the caches and invalidate tlbs
     nv_execute_on_all_cpus(cache_flush, NULL);
diff -ur nv.bak/os-agp.c nv/os-agp.c
--- nv.bak/os-agp.c	2008-03-11 21:43:49.000000000 +0100
+++ nv/os-agp.c	2008-03-11 22:08:58.000000000 +0100
@@ -295,7 +295,7 @@
 
          page_ptr->phys_addr = (ptr->memory[i] & PAGE_MASK);
          page_ptr->virt_addr = (unsigned long) __va(page_ptr->phys_addr);
-         page_ptr->dma_addr  = page_ptr->phys_addr;
+         page_ptr->dma_addr  = phys_to_machine(page_ptr->phys_addr);
     }
 
     return RM_OK;
Only in nv.bak: .tmp_versions

Reply via email to