~ubuntu-branches/ubuntu/utopic/nvidia-graphics-drivers-331-updates/utopic-updates

« back to all changes in this revision

Viewing changes to debian/dkms_nvidia/patches/buildfix_kernel_3.11.patch

  • Committer: Package Import Robot
  • Author(s): Alberto Milone
  • Date: 2013-11-12 13:48:36 UTC
  • Revision ID: package-import@ubuntu.com-20131112134836-2cu25iu0llghkyy4
Tags: 331.20-0ubuntu1
Initial release (LP: #1250449).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From bc0e98fa2956e429179ee1901ed037ede321bc96 Mon Sep 17 00:00:00 2001
 
2
From: Alberto Milone <alberto.milone@canonical.com>
 
3
Date: Wed, 6 Nov 2013 15:47:41 +0100
 
4
Subject: [PATCH 1/1] Add support for Linux 3.11
 
5
 
 
6
Original patch by NVIDIA.
 
7
---
 
8
 Makefile    |    1 +
 
9
 conftest.sh |   24 ++++++++++++++++++++++++
 
10
 nv-linux.h  |    4 ++++
 
11
 nv-vm.c     |    5 +++++
 
12
 4 files changed, 34 insertions(+)
 
13
 
 
14
diff --git a/Makefile b/Makefile
 
15
index d4045f8..8b9e5c9 100644
 
16
--- a/Makefile
 
17
+++ b/Makefile
 
18
@@ -125,6 +125,7 @@ COMPILE_TESTS = \
 
19
        file_operations \
 
20
        sg_init_table \
 
21
        pci_get_domain_bus_and_slot \
 
22
+       get_num_physpages \
 
23
        efi_enabled \
 
24
        dom0_kernel_present \
 
25
        drm_available \
 
26
diff --git a/conftest.sh b/conftest.sh
 
27
index db0fb3a..08fae3c 100755
 
28
--- a/conftest.sh
 
29
+++ b/conftest.sh
 
30
@@ -1676,6 +1676,30 @@ compile_test() {
 
31
             fi
 
32
         ;;
 
33
 
 
34
+        get_num_physpages)
 
35
+            #
 
36
+            # Determine if the get_num_physpages() function is
 
37
+            # present.
 
38
+            #
 
39
+            echo "$CONFTEST_PREAMBLE
 
40
+            #include <linux/mm.h>
 
41
+            void conftest_get_num_physpages(void) {
 
42
+                get_num_physpages(NULL);
 
43
+            }" > conftest$$.c
 
44
+
 
45
+            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
 
46
+            rm -f conftest$$.c
 
47
+
 
48
+            if [ -f conftest$$.o ]; then
 
49
+                echo "#undef NV_GET_NUM_PHYSPAGES_PRESENT" | append_conftest "functions"
 
50
+                rm -f conftest$$.o
 
51
+                return
 
52
+            else
 
53
+                echo "#define NV_GET_NUM_PHYSPAGES_PRESENT" | append_conftest "functions"
 
54
+                return
 
55
+            fi
 
56
+        ;;
 
57
+
 
58
         proc_remove)
 
59
             #
 
60
             # Determine if the proc_remove() function is present.
 
61
diff --git a/nv-linux.h b/nv-linux.h
 
62
index ecdce1a..9c524e3 100644
 
63
--- a/nv-linux.h
 
64
+++ b/nv-linux.h
 
65
@@ -956,7 +956,11 @@ static inline int nv_execute_on_all_cpus(void (*func)(void *info), void *info)
 
66
 #endif
 
67
 
 
68
 #if !defined(NV_VMWARE)
 
69
+#if defined(NV_GET_NUM_PHYSPAGES_PRESENT)
 
70
+#define NV_NUM_PHYSPAGES                get_num_physpages()
 
71
+#else
 
72
 #define NV_NUM_PHYSPAGES                num_physpages
 
73
+#endif
 
74
 #define NV_GET_CURRENT_PROCESS()        current->tgid
 
75
 #define NV_IN_ATOMIC()                  in_atomic()
 
76
 #define NV_LOCAL_BH_DISABLE()           local_bh_disable()
 
77
diff --git a/nv-vm.c b/nv-vm.c
 
78
index 42e3dbb..5c1a236 100644
 
79
--- a/nv-vm.c
 
80
+++ b/nv-vm.c
 
81
@@ -434,8 +434,13 @@ static unsigned int nv_compute_gfp_mask(
 
82
     system_memory_size = (os_get_system_memory_size() * RM_PAGE_SIZE);
 
83
     if (system_memory_size != 0)
 
84
     {
 
85
+#if !defined(NV_GET_NUM_PHYSPAGES_PRESENT)
 
86
         if (dev->dma_mask < (system_memory_size - 1))
 
87
             gfp_mask = NV_GFP_DMA32;
 
88
+#else
 
89
+        if (dev->dma_mask <= (system_memory_size - 1))
 
90
+            gfp_mask = NV_GFP_DMA32;
 
91
+#endif
 
92
     }
 
93
     else if (dev->dma_mask < 0xffffffffffULL)
 
94
     {
 
95
-- 
 
96
1.7.9.5
 
97