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
6
Original patch by NVIDIA.
9
conftest.sh | 24 ++++++++++++++++++++++++
12
4 files changed, 34 insertions(+)
14
diff --git a/Makefile b/Makefile
15
index d4045f8..8b9e5c9 100644
18
@@ -125,6 +125,7 @@ COMPILE_TESTS = \
21
pci_get_domain_bus_and_slot \
26
diff --git a/conftest.sh b/conftest.sh
27
index db0fb3a..08fae3c 100755
30
@@ -1676,6 +1676,30 @@ compile_test() {
36
+ # Determine if the get_num_physpages() function is
39
+ echo "$CONFTEST_PREAMBLE
40
+ #include <linux/mm.h>
41
+ void conftest_get_num_physpages(void) {
42
+ get_num_physpages(NULL);
45
+ $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
48
+ if [ -f conftest$$.o ]; then
49
+ echo "#undef NV_GET_NUM_PHYSPAGES_PRESENT" | append_conftest "functions"
53
+ echo "#define NV_GET_NUM_PHYSPAGES_PRESENT" | append_conftest "functions"
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
65
@@ -956,7 +956,11 @@ static inline int nv_execute_on_all_cpus(void (*func)(void *info), void *info)
68
#if !defined(NV_VMWARE)
69
+#if defined(NV_GET_NUM_PHYSPAGES_PRESENT)
70
+#define NV_NUM_PHYSPAGES get_num_physpages()
72
#define NV_NUM_PHYSPAGES num_physpages
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
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)
85
+#if !defined(NV_GET_NUM_PHYSPAGES_PRESENT)
86
if (dev->dma_mask < (system_memory_size - 1))
87
gfp_mask = NV_GFP_DMA32;
89
+ if (dev->dma_mask <= (system_memory_size - 1))
90
+ gfp_mask = NV_GFP_DMA32;
93
else if (dev->dma_mask < 0xffffffffffULL)