diff -Nur nv/conftest.sh nv-patched/conftest.sh --- nv/conftest.sh 2007-06-13 20:18:39.000000000 -0400 +++ nv-patched/conftest.sh 2007-07-25 09:04:48.000000000 -0400 @@ -896,65 +896,6 @@ fi ;; - xen_sanity_check) - # - # Check if the target kernel is a Xen kernel. If so, then exit, since - # the driver doesn't currently work with Xen. - # - RET=1 - VERBOSE=$6 - FILE="linux/autoconf.h" - - if [ -n "$IGNORE_XEN_PRESENCE" ]; then - exit 0 - fi - - if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE ]; then - # - # We are looking at a configured source tree; verify - # that it's not a Xen kernel. - # - echo "#include - #ifdef CONFIG_XEN - #error CONFIG_XEN defined!! - #endif - " > conftest$$.c - - $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 - rm -f conftest$$.c - - if [ -f conftest$$.o ]; then - rm -f conftest$$.o - RET=0 - fi - else - CONFIG=$HEADERS/../.config - if [ -f $CONFIG ]; then - if [ -z "$(grep "^CONFIG_XEN=y" $CONFIG)" ]; then - RET=0 - fi - fi - fi - - if [ "$RET" != "0" ]; then - echo "The kernel you are installing for is a Xen kernel!"; - echo ""; - echo "The NVIDIA driver does not currently work on Xen kernels. If "; - echo "you are using a stock distribution kernel, please install "; - echo "a variant of this kernel without Xen support; if this is a "; - echo "custom kernel, please install a standard Linux kernel. Then "; - echo "try installing the NVIDIA kernel module again."; - echo ""; - if [ "$VERBOSE" = "full_output" ]; then - echo "*** Failed Xen sanity check. Bailing out! ***"; - echo ""; - fi - exit 1 - else - exit 0 - fi - ;; - acpi_device_ops_match) # # Determine if the acpi_device_ops data structure has diff -Nur nv/nv.c nv-patched/nv.c --- nv/nv.c 2007-06-13 20:18:38.000000000 -0400 +++ nv-patched/nv.c 2007-07-25 09:04:48.000000000 -0400 @@ -42,10 +42,13 @@ int nv_pat_enabled = 0; -#if !defined(NV_BUILD_NV_PAT_SUPPORT) +#if defined(CONFIG_XEN) || defined(CONFIG_PREEMPT_RT) static int nv_disable_pat = 1; #else static int nv_disable_pat = 0; +#endif + +#if !defined(CONFIG_XEN) NV_MODULE_PARAMETER(nv_disable_pat); #endif diff -Nur nv/nv-linux.h nv-patched/nv-linux.h --- nv/nv-linux.h 2007-06-13 20:18:38.000000000 -0400 +++ nv-patched/nv-linux.h 2007-07-25 09:04:48.000000000 -0400 @@ -261,7 +261,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 @@ -821,7 +821,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_5_PRESENT) @@ -833,6 +836,7 @@ #define NV_REMAP_PAGE_RANGE(x...) remap_page_range(x) #endif #if !defined(CONFIG_XEN) +#define phys_to_machine(x) x #define NV_IO_REMAP_PAGE_RANGE(from, offset, x...) \ NV_REMAP_PAGE_RANGE(from, offset, x) #else diff -Nur nv/nv-vm.c nv-patched/nv-vm.c --- nv/nv-vm.c 2007-06-13 20:18:38.000000000 -0400 +++ nv-patched/nv-vm.c 2007-07-25 09:04:48.000000000 -0400 @@ -352,6 +352,10 @@ 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 -Nur nv/os-agp.c nv-patched/os-agp.c --- nv/os-agp.c 2007-06-13 20:18:38.000000000 -0400 +++ nv-patched/os-agp.c 2007-07-25 09:04:48.000000000 -0400 @@ -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; diff -Nur nv/os-interface.c nv-patched/os-interface.c --- nv/os-interface.c 2007-06-13 20:18:38.000000000 -0400 +++ nv-patched/os-interface.c 2007-07-25 09:04:48.000000000 -0400 @@ -552,6 +552,7 @@ MicroSeconds = MilliSeconds * 1000; tm_end.tv_usec = MicroSeconds; tm_end.tv_sec = 0; +#if !defined(CONFIG_XEN) NV_TIMERADD(&tm_aux, &tm_end, &tm_end); /* do we have a full jiffie to wait? */ @@ -599,7 +600,7 @@ MicroSeconds = 0; } while ((jiffies = NV_USECS_TO_JIFFIES(MicroSeconds)) != 0); } - +#endif if (MicroSeconds > 1000) { mdelay_safe_msec = MicroSeconds / 1000;