[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#482305: patch for CONFIG_XEN isssue with 2.6.25...



The solution to this is to remove the CONFIG_XEN check and all the
#ifdef CONFIG_XEN bits from the code

Patch is attached, together with [0] from #476504 for 2.6.25 support it
builds fine and works on native (not sure what happens if you boot under
Xen since there is no dom0 support yet).

See also: http://lists.debian.org/debian-kernel/2008/05/msg00948.html
which confirms essentially the same thing.

[0]
http://www.nvnews.net/vbulletin/attachment.php?s=41498f047cfc027419df58a2559e9a7f&attachmentid=30771&d=1205875946

Ian.

-- 
Ian Campbell

During the voyage of life, remember to keep an eye out for a fair wind; batten
down during a storm; hail all passing ships; and fly your colors proudly.
-- 
Ian Campbell
Current Noise: System Of A Down - Boom!

Close cover before striking.
diff -x conftest.h -X /home/ijc/development/dontdiff.txt -urN nv.orig/conftest.sh nv.noxen/conftest.sh
--- nv.orig/conftest.sh	2008-05-22 07:57:38.000000000 +0100
+++ nv.noxen/conftest.sh	2008-05-22 08:01:45.000000000 +0100
@@ -1132,65 +1132,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 <linux/autoconf.h>
-            #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
-    ;;
-
     compile_tests)
         #
         # Run a series of compile tests to determine the set of interfaces
diff -x conftest.h -X /home/ijc/development/dontdiff.txt -urN nv.orig/Makefile nv.noxen/Makefile
--- nv.orig/Makefile	2008-05-22 07:57:38.000000000 +0100
+++ nv.noxen/Makefile	2008-05-22 08:01:45.000000000 +0100
@@ -250,9 +250,6 @@
 nvidiafb-sanity-check:
 	@if ! $(CONFTEST) nvidiafb_sanity_check full_output; then exit 1; fi
 
-xen-sanity-check:
-	@if ! $(CONFTEST) xen_sanity_check full_output; then exit 1; fi
-
 compile-tests:
 	@if ! $(CONFTEST) compile_tests $(COMPILE_TESTS); then exit 1; fi
 
@@ -261,7 +258,7 @@
 # the "package-install" target below.
 #
 
-module: cc-version-check xen-sanity-check rivafb-sanity-check nvidiafb-sanity-check
+module: cc-version-check rivafb-sanity-check nvidiafb-sanity-check
 	@if [ -z "$(PATCHLEVEL)" ]; then \
 	 echo "failed to determine PATCHLEVEL!"; \
 	 exit 1; \
diff -x conftest.h -X /home/ijc/development/dontdiff.txt -urN nv.orig/Makefile.kbuild nv.noxen/Makefile.kbuild
--- nv.orig/Makefile.kbuild	2008-05-22 07:57:38.000000000 +0100
+++ nv.noxen/Makefile.kbuild	2008-05-22 08:01:45.000000000 +0100
@@ -250,9 +250,6 @@
 nvidiafb-sanity-check:
 	@if ! $(CONFTEST) nvidiafb_sanity_check full_output; then exit 1; fi
 
-xen-sanity-check:
-	@if ! $(CONFTEST) xen_sanity_check full_output; then exit 1; fi
-
 compile-tests:
 	@if ! $(CONFTEST) compile_tests $(COMPILE_TESTS); then exit 1; fi
 
@@ -261,7 +258,7 @@
 # the "package-install" target below.
 #
 
-module: cc-version-check xen-sanity-check rivafb-sanity-check nvidiafb-sanity-check
+module: cc-version-check rivafb-sanity-check nvidiafb-sanity-check
 	@if [ -z "$(PATCHLEVEL)" ]; then \
 	 echo "failed to determine PATCHLEVEL!"; \
 	 exit 1; \
diff -x conftest.h -X /home/ijc/development/dontdiff.txt -urN nv.orig/nv.c nv.noxen/nv.c
--- nv.orig/nv.c	2008-05-22 07:57:39.000000000 +0100
+++ nv.noxen/nv.c	2008-05-22 08:01:46.000000000 +0100
@@ -2018,20 +2018,6 @@
         nvl->tasklet.data = (unsigned long) nv;
         tasklet_enable(&nvl->tasklet);
 
-#if defined(CONFIG_XEN)
-        if ((nvl->dev->dma_mask <= 0xffffffff) &&
-            (HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL) > 0xfffff))
-        {
-            NV_SHUTDOWN_ADAPTER(sp, nv, nvl);
-            nv_printf(NV_DBG_ERRORS,
-                "NVRM: GPUs incapable of addressing more than 4GB of memory\n"
-                "NVRM: are not supported when using Xen kernels on systems with\n"
-                "NVRM: system memory mapped above the 4GB boundary.\n");
-            rc = -EIO;
-            goto failed;
-        }
-#endif
-
         nv->flags |= NV_FLAG_OPEN;
     }
 
@@ -3887,7 +3873,6 @@
     U032         config
 )
 {
-#if !defined(CONFIG_XEN)
     RM_STATUS status = RM_ERROR;
     static int old_error = 0;
     nv_stack_t *sp = NULL;
@@ -4025,10 +4010,6 @@
         old_error = 0; /* report new errors */
 
     return status;
-#else
-    nv_printf(NV_DBG_ERRORS, "NVRM: AGP is not supported on Xen kernels.\n");
-    return RM_ERR_NOT_SUPPORTED;
-#endif
 }
 
 RM_STATUS NV_API_CALL nv_agp_teardown(
diff -x conftest.h -X /home/ijc/development/dontdiff.txt -urN nv.orig/nv_compiler.h nv.noxen/nv_compiler.h
--- nv.orig/nv_compiler.h	1970-01-01 01:00:00.000000000 +0100
+++ nv.noxen/nv_compiler.h	2008-05-22 08:01:46.000000000 +0100
@@ -0,0 +1 @@
+#define NV_COMPILER "gcc version 4.1.3 20080420 (prerelease) (Debian 4.1.2-22)"
diff -x conftest.h -X /home/ijc/development/dontdiff.txt -urN nv.orig/nv-linux.h nv.noxen/nv-linux.h
--- nv.orig/nv-linux.h	2008-05-22 07:57:39.000000000 +0100
+++ nv.noxen/nv-linux.h	2008-05-22 08:01:46.000000000 +0100
@@ -108,11 +108,6 @@
 #include <linux/completion.h>
 #include <linux/highmem.h>
 
-#ifdef CONFIG_XEN
-#include <asm/maddr.h>
-#include <xen/interface/memory.h>
-#endif
-
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
 #endif
@@ -144,7 +139,7 @@
 #include <linux/agpgart.h>
 #endif
 
-#if (defined(NVCPU_X86) || defined(NVCPU_X86_64)) && !defined(CONFIG_XEN)
+#if defined(NVCPU_X86) || defined(NVCPU_X86_64)
 #define NV_BUILD_NV_PAT_SUPPORT 1
 #endif
 
@@ -713,11 +708,7 @@
 #define NV_TASK_STRUCT_RLIM(current)  ((current)->rlim)
 #endif
 
-#ifdef CONFIG_XEN
-#define NV_GET_DMA_ADDRESS(phys_addr) phys_to_machine(phys_addr)
-#else
 #define NV_GET_DMA_ADDRESS(phys_addr) (phys_addr)
-#endif
 
 #define NV_GET_PAGE_STRUCT(phys_page) virt_to_page(__va(phys_page))
 #define NV_VMA_PGOFF(vma)             ((vma)->vm_pgoff)
@@ -861,13 +852,8 @@
 #else
 #error "NV_REMAP_PAGE_RANGE() undefined!"
 #endif
-#if !defined(CONFIG_XEN)
 #define NV_IO_REMAP_PAGE_RANGE(from, offset, x...) \
     NV_REMAP_PAGE_RANGE(from, offset, x)
-#else
-#define NV_IO_REMAP_PAGE_RANGE(from, offset, x...) \
-    io_remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x)
-#endif
 
 #define NV_PGD_OFFSET(address, kernel, mm)              \
    ({                                                   \
diff -x conftest.h -X /home/ijc/development/dontdiff.txt -urN nv.orig/os-interface.c nv.noxen/os-interface.c
--- nv.orig/os-interface.c	2008-05-22 07:57:39.000000000 +0100
+++ nv.noxen/os-interface.c	2008-05-22 08:01:46.000000000 +0100
@@ -598,7 +598,6 @@
     if (jiffies) 
     {
         // if we have at least 1 full jiffy to wait, give up the cpu
-#if !defined(CONFIG_XEN)
         // but first, make sure we haven't raised the irql level on
         // this cpu (most likely holding a lock). I'm seeing cases
         // where we give up the cpu with raised irql, and never get
@@ -609,10 +608,8 @@
         // the local CPU.
         if (!NV_IRQL_IS_RAISED())
         {
-#endif
             /* give up the cpu */
             current->state = TASK_INTERRUPTIBLE;
-#if !defined(CONFIG_XEN)
         }
         else
         {
@@ -622,7 +619,6 @@
             os_dbg_breakpoint();
             return RM_ERROR;
         }
-#endif
         do
         {
             schedule_timeout(jiffies);
@@ -1361,13 +1357,10 @@
      * If you prefer to manually grant the necessary capability and 
      * adjust the resource limit, disable the lines below.
      */
-#if !defined(CONFIG_XEN)
     struct rlimit *rlim = NV_TASK_STRUCT_RLIM(current);
     rlim[RLIMIT_MEMLOCK].rlim_cur = RLIM_INFINITY;
     cap_raise(current->cap_effective, CAP_IPC_LOCK);
     return RM_OK;
-#endif
-    return RM_ERR_NOT_SUPPORTED;
 }
 
 RM_STATUS NV_API_CALL os_check_process_map_limit(

Reply to: