[packages/xorg-driver-video-nvidia-legacy-340xx] - fix building kernel module with kernel 4.4.169 - rel 2

baggins baggins at pld-linux.org
Sat Dec 29 02:18:22 CET 2018


commit d82a4816ba5cd6a48b38d540b86bf78b281c4b27
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sat Dec 29 10:17:49 2018 +0900

    - fix building kernel module with kernel 4.4.169
    - rel 2

 kernel-4.4.169.patch                       | 69 ++++++++++++++++++++++++++++++
 xorg-driver-video-nvidia-legacy-340xx.spec |  4 +-
 2 files changed, 72 insertions(+), 1 deletion(-)
---
diff --git a/xorg-driver-video-nvidia-legacy-340xx.spec b/xorg-driver-video-nvidia-legacy-340xx.spec
index 97c0157..d46f5af 100644
--- a/xorg-driver-video-nvidia-legacy-340xx.spec
+++ b/xorg-driver-video-nvidia-legacy-340xx.spec
@@ -25,7 +25,7 @@ exit 1
 
 %define		no_install_post_check_so 1
 
-%define		rel	1
+%define		rel	2
 %define		pname	xorg-driver-video-nvidia-legacy-340xx
 Summary:	Linux Drivers for nVidia GeForce/Quadro Chips
 Summary(hu.UTF-8):	Linux meghajtók nVidia GeForce/Quadro chipekhez
@@ -48,6 +48,7 @@ Source5:	10-nvidia-modules.conf
 Patch0:		X11-driver-nvidia-GL.patch
 Patch1:		X11-driver-nvidia-desktop.patch
 Patch2:		linux-4.0.patch
+Patch3:		kernel-4.4.169.patch
 URL:		http://www.nvidia.com/object/unix.html
 BuildRequires:	rpmbuild(macros) >= 1.701
 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
@@ -250,6 +251,7 @@ rm -rf NVIDIA-Linux-x86*-%{version}*
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 echo 'EXTRA_CFLAGS += -Wno-pointer-arith -Wno-sign-compare -Wno-unused' >> kernel/Makefile.kbuild
 
 %build
diff --git a/kernel-4.4.169.patch b/kernel-4.4.169.patch
new file mode 100644
index 0000000..3a52e67
--- /dev/null
+++ b/kernel-4.4.169.patch
@@ -0,0 +1,69 @@
+--- NVIDIA-Linux-x86_64-390.87-no-compat32/kernel/conftest.sh~	2018-08-22 06:47:57.000000000 +0900
++++ NVIDIA-Linux-x86_64-390.87-no-compat32/kernel/conftest.sh	2018-12-29 09:33:30.537541114 +0900
+@@ -2725,6 +2725,32 @@
+                 return
+             fi
+             
++            # Conftest #3: Check if get_user_pages has gup_flags instead of write and force parameters.
++            # Return if available.
++            # Fall through to default case if absent.
++
++            echo "$CONFTEST_PREAMBLE
++            #include <linux/mm.h>
++            long get_user_pages(struct task_struct *tsk,
++                                struct mm_struct *mm,
++                                unsigned long start,
++                                unsigned long nr_pages,
++                                unsigned int gup_flags,
++                                struct page **pages,
++                                struct vm_area_struct **vmas) {
++                return 0;
++            }" > conftest$$.c
++
++            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
++            rm -f conftest$$.c
++
++            if [ -f conftest$$.o ]; then
++                echo "#undef NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions"
++                echo "#define NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest "functions"
++                rm -f conftest$$.o
++                return
++            fi
++            
+             echo "#define NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions"
+             echo "#define NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest "functions"
+ 
+--- NVIDIA-Linux-x86_64-390.87-no-compat32/kernel/nv-linux.h~	2018-08-22 09:55:23.000000000 +0900
++++ NVIDIA-Linux-x86_64-390.87-no-compat32/kernel/nv-linux.h	2018-12-29 09:30:55.797962776 +0900
+@@ -2100,8 +2100,31 @@
+  */
+ 
+ #if defined(NV_GET_USER_PAGES_HAS_TASK_STRUCT)
++    #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
+     #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \
+         get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
++    #else
++        #include <asm/current.h>
++        #include <linux/mm.h>
++        #include <linux/sched.h>
++
++        static inline long NV_GET_USER_PAGES(unsigned long start,
++                                             unsigned long nr_pages,
++                                             int write,
++                                             int force,
++                                             struct page **pages,
++                                             struct vm_area_struct **vmas)
++        {
++            unsigned int flags = 0;
++
++            if (write)
++                flags |= FOLL_WRITE;
++            if (force)
++                flags |= FOLL_FORCE;
++
++            return get_user_pages(current, current->mm, start, nr_pages, flags, pages, vmas);
++        }
++    #endif
+ #else
+     #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
+         #define NV_GET_USER_PAGES get_user_pages
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/xorg-driver-video-nvidia-legacy-340xx.git/commitdiff/d82a4816ba5cd6a48b38d540b86bf78b281c4b27



More information about the pld-cvs-commit mailing list