]>
Commit | Line | Data |
---|---|---|
d82a4816 JR |
1 | --- NVIDIA-Linux-x86_64-390.87-no-compat32/kernel/conftest.sh~ 2018-08-22 06:47:57.000000000 +0900 |
2 | +++ NVIDIA-Linux-x86_64-390.87-no-compat32/kernel/conftest.sh 2018-12-29 09:33:30.537541114 +0900 | |
3 | @@ -2725,6 +2725,32 @@ | |
4 | return | |
5 | fi | |
6 | ||
7 | + # Conftest #3: Check if get_user_pages has gup_flags instead of write and force parameters. | |
8 | + # Return if available. | |
9 | + # Fall through to default case if absent. | |
10 | + | |
11 | + echo "$CONFTEST_PREAMBLE | |
12 | + #include <linux/mm.h> | |
13 | + long get_user_pages(struct task_struct *tsk, | |
14 | + struct mm_struct *mm, | |
15 | + unsigned long start, | |
16 | + unsigned long nr_pages, | |
17 | + unsigned int gup_flags, | |
18 | + struct page **pages, | |
19 | + struct vm_area_struct **vmas) { | |
20 | + return 0; | |
21 | + }" > conftest$$.c | |
22 | + | |
23 | + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 | |
24 | + rm -f conftest$$.c | |
25 | + | |
26 | + if [ -f conftest$$.o ]; then | |
27 | + echo "#undef NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions" | |
28 | + echo "#define NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest "functions" | |
29 | + rm -f conftest$$.o | |
30 | + return | |
31 | + fi | |
32 | + | |
33 | echo "#define NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions" | |
34 | echo "#define NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest "functions" | |
35 | ||
36 | --- NVIDIA-Linux-x86_64-390.87-no-compat32/kernel/nv-linux.h~ 2018-08-22 09:55:23.000000000 +0900 | |
37 | +++ NVIDIA-Linux-x86_64-390.87-no-compat32/kernel/nv-linux.h 2018-12-29 09:30:55.797962776 +0900 | |
38 | @@ -2100,8 +2100,31 @@ | |
39 | */ | |
40 | ||
41 | #if defined(NV_GET_USER_PAGES_HAS_TASK_STRUCT) | |
42 | + #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS) | |
43 | #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \ | |
44 | get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas) | |
45 | + #else | |
46 | + #include <asm/current.h> | |
47 | + #include <linux/mm.h> | |
48 | + #include <linux/sched.h> | |
49 | + | |
50 | + static inline long NV_GET_USER_PAGES(unsigned long start, | |
51 | + unsigned long nr_pages, | |
52 | + int write, | |
53 | + int force, | |
54 | + struct page **pages, | |
55 | + struct vm_area_struct **vmas) | |
56 | + { | |
57 | + unsigned int flags = 0; | |
58 | + | |
59 | + if (write) | |
60 | + flags |= FOLL_WRITE; | |
61 | + if (force) | |
62 | + flags |= FOLL_FORCE; | |
63 | + | |
64 | + return get_user_pages(current, current->mm, start, nr_pages, flags, pages, vmas); | |
65 | + } | |
66 | + #endif | |
67 | #else | |
68 | #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS) | |
69 | #define NV_GET_USER_PAGES get_user_pages |