Package: nvidia-kernel-source Version: 1.0.8762-2 Followup-For: Bug #367326
Hi, Here are two problems, one in the kernel and one in the source of nvidia. The kernel needs to export symbol xen_tlb_flush. And the source of nvidia needs a patch to run properly in a xen environment. Both patches are attached and more information can be found here: http://www.nvnews.net/vbulletin/showthread.php?t=68648 An happy nvidia user running with a xen kernel. Regards, Matthijs Mohlmann -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-xen Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages nvidia-kernel-source depends on: ii debhelper 5.0.35 helper programs for debian/rules ii dpatch 2.0.20 patch maintenance system for Debia ii make 3.81-2 The GNU version of the "make" util ii sed 4.1.5-1 The GNU sed stream editor Versions of packages nvidia-kernel-source recommends: ii devscripts 2.9.20 Scripts to make the life of a Debi ii kernel-package 10.048 A utility for building Linux kerne ii nvidia-glx 1.0.8762-2 NVIDIA binary XFree86 4.x driver -- no debconf information
diff -urN linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c linux-2.6-xen-sparse-nv/arch/i386/mm/hypervisor.c --- linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c 2006-04-13 19:48:37.000000000 +0200 +++ linux-2.6-xen-sparse-nv/arch/i386/mm/hypervisor.c 2006-04-16 15:34:51.000000000 +0200 @@ -133,6 +133,7 @@ op.cmd = MMUEXT_TLB_FLUSH_LOCAL; BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); } +EXPORT_SYMBOL(xen_tlb_flush); void xen_invlpg(unsigned long ptr) {
diff -urN nv-1.0-8756/nv.c nv-1.0-8756-xen-3.0.2-2/nv.c --- nv-1.0-8756/nv.c 2006-03-30 01:02:20.000000000 +0200 +++ nv-1.0-8756-xen-3.0.2-2/nv.c 2006-04-18 03:16:11.000000000 +0200 @@ -16,6 +16,9 @@ #include "os-agp.h" #include "nv-vm.h" +#define io_remap_page_range(vma, start, busaddr, size, prot) \ + io_remap_pfn_range(vma, start, busaddr>>PAGE_SHIFT, size, prot) + #ifdef MODULE_ALIAS_CHARDEV_MAJOR MODULE_ALIAS_CHARDEV_MAJOR(NV_MAJOR_DEVICE_NUMBER); #endif @@ -44,7 +47,11 @@ int nv_pat_enabled = 0; +#ifdef CONFIG_XEN +static int nv_disable_pat = 1; +#else static int nv_disable_pat = 0; +#endif NV_MODULE_PARAMETER(nv_disable_pat); #if defined(NVCPU_X86) || defined(NVCPU_X86_64) @@ -2087,7 +2094,11 @@ return -ENXIO; } +#ifdef CONFIG_XEN + if (io_remap_page_range(vma, vma->vm_start, +#else if (NV_REMAP_PAGE_RANGE(vma->vm_start, +#endif NV_VMA_OFFSET(vma), NV_VMA_SIZE(vma), vma->vm_page_prot)) @@ -2112,7 +2123,11 @@ } } +#ifdef CONFIG_XEN + if (io_remap_page_range(vma, vma->vm_start, +#else if (NV_REMAP_PAGE_RANGE(vma->vm_start, +#endif NV_VMA_OFFSET(vma), NV_VMA_SIZE(vma), vma->vm_page_prot)) @@ -2155,7 +2170,11 @@ NV_ATOMIC_INC(at->usage_count); nv_up(nvl->at_lock); +#ifdef CONFIG_XEN + if (io_remap_page_range(vma, vma->vm_start, +#else if (NV_REMAP_PAGE_RANGE(vma->vm_start, +#endif NV_VMA_OFFSET(vma), NV_VMA_SIZE(vma), vma->vm_page_prot)) diff -urN nv-1.0-8756/nv-linux.h nv-1.0-8756-xen-3.0.2-2/nv-linux.h --- nv-1.0-8756/nv-linux.h 2006-03-30 01:02:20.000000000 +0200 +++ nv-1.0-8756-xen-3.0.2-2/nv-linux.h 2006-04-17 01:46:37.000000000 +0200 @@ -19,8 +19,8 @@ #include <linux/utsname.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0) -# error This driver does not support pre-2.4 kernels! +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 7) +# error This driver does not support 2.4 kernels older than 2.4.7! #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) # define KERNEL_2_4 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) @@ -94,6 +94,7 @@ #include <linux/spinlock.h> #include <asm/semaphore.h> +#include <linux/completion.h> #include <linux/highmem.h> #ifdef CONFIG_PROC_FS @@ -225,9 +226,13 @@ * 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_XEN) +#undef CONFIG_SWIOTLB +#else #if defined(CONFIG_SWIOTLB) && !defined(GFP_DMA32) #define NV_SWIOTLB 1 #endif +#endif /* * early 2.6 kernels changed their swiotlb codepath, running into a diff -urN nv-1.0-8756/nv-vm.c nv-1.0-8756-xen-3.0.2-2/nv-vm.c --- nv-1.0-8756/nv-vm.c 2006-03-30 01:02:20.000000000 +0200 +++ nv-1.0-8756-xen-3.0.2-2/nv-vm.c 2006-04-18 02:16:21.000000000 +0200 @@ -497,7 +497,11 @@ page_ptr->phys_addr = phys_addr; page_ptr->page_count = NV_GET_PAGE_COUNT(page_ptr); page_ptr->virt_addr = virt_addr; +#ifdef CONFIG_XEN + page_ptr->dma_addr = phys_to_machine(page_ptr->phys_addr); +#else page_ptr->dma_addr = page_ptr->phys_addr; +#endif /* lock the page for dma purposes */ nv_lock_page(page_ptr); diff -urN nv-1.0-8756/os-agp.c nv-1.0-8756-xen-3.0.2-2/os-agp.c --- nv-1.0-8756/os-agp.c 2006-03-30 01:02:20.000000000 +0200 +++ nv-1.0-8756-xen-3.0.2-2/os-agp.c 2006-04-17 01:46:37.000000000 +0200 @@ -284,7 +284,11 @@ page_ptr->phys_addr = (ptr->memory[i] & PAGE_MASK); page_ptr->virt_addr = (unsigned long) __va(page_ptr->phys_addr); +#ifdef CONFIG_XEN + page_ptr->dma_addr = phys_to_machine(page_ptr->phys_addr); +#else page_ptr->dma_addr = page_ptr->phys_addr; +#endif } return RM_OK; diff -urN nv-1.0-8756/os-interface.c nv-1.0-8756-xen-3.0.2-2/os-interface.c --- nv-1.0-8756/os-interface.c 2006-03-30 01:02:20.000000000 +0200 +++ nv-1.0-8756-xen-3.0.2-2/os-interface.c 2006-04-17 01:46:37.000000000 +0200 @@ -58,9 +58,9 @@ // typedef struct os_sema_s { - struct semaphore wait; - spinlock_t lock; - S032 count; + struct completion completion; + spinlock_t lock; + S032 count; } os_sema_t; // @@ -81,7 +81,7 @@ return rmStatus; os_sema = (os_sema_t *)*ppSema; - sema_init(&os_sema->wait, 0); + init_completion(&os_sema->completion); spin_lock_init(&os_sema->lock); os_sema->count = 1; @@ -126,7 +126,7 @@ { os_sema->count--; spin_unlock_irqrestore(&os_sema->lock, old_irq); - down(&os_sema->wait); + wait_for_completion(&os_sema->completion); } else { @@ -203,7 +203,7 @@ spin_unlock_irqrestore(&os_sema->lock, old_irq); if (doWakeup) - up(&os_sema->wait); + complete(&os_sema->completion); return RM_OK; } @@ -554,6 +554,8 @@ } MicroSeconds = MilliSeconds * 1000; + +#if 0 tm_end.tv_usec = MicroSeconds; tm_end.tv_sec = 0; timeradd(&tm_aux, &tm_end, &tm_end); @@ -593,6 +595,7 @@ MicroSeconds = 0; } while ((jiffies = NV_USECS_TO_JIFFIES(MicroSeconds)) != 0); } +#endif if (MicroSeconds > 1000) {