commit 124769c6a45d26c2a3c88f8eb494befe99cf78d2
Author: leigh123linux <leigh123linux(a)googlemail.com>
Date: Mon Feb 20 20:55:32 2017 +0000
patch for kernel-4.10
4.10.0_kernel.patch | 131 +++++++++++++++++++++++++++++++++++++++++++++++++
nvidia-340xx-kmod.spec | 7 ++-
2 files changed, 137 insertions(+), 1 deletion(-)
---
diff --git a/4.10.0_kernel.patch b/4.10.0_kernel.patch
new file mode 100644
index 0000000..f4297b1
--- /dev/null
+++ b/4.10.0_kernel.patch
@@ -0,0 +1,131 @@
+From 983a2ca221a371e08bb5ad11758a729cfa5aa88c Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone(a)canonical.com>
+Date: Wed, 15 Feb 2017 17:05:55 +0100
+Subject: [PATCH 1/1] Add support for Linux 4.10
+
+---
+ nv-linux.h | 7 +++++++
+ nv-pat.c | 40 ++++++++++++++++++++++++++++++++++++++++
+ uvm/nvidia_uvm_lite.c | 4 ++++
+ 3 files changed, 51 insertions(+)
+
+diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h
+index e7068e3..2d62492 100644
+--- a/kernel/nv-linux.h
++++ b/kernel/nv-linux.h
+@@ -2082,6 +2082,8 @@ static inline NvU64 nv_node_end_pfn(int nid)
+ * 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
+ */
+
++#include <linux/version.h>
++
+ #if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
+ #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
+ #define NV_GET_USER_PAGES get_user_pages
+@@ -2129,8 +2131,13 @@ static inline NvU64 nv_node_end_pfn(int nid)
+
+ #else
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+ return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
+ pages, vmas);
++#else
++ return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
++ pages, vmas, NULL);
++#endif
+
+ #endif
+
+diff --git a/kernel/nv-pat.c b/kernel/nv-pat.c
+index a725533..cec6f3f 100644
+--- a/kernel/nv-pat.c
++++ b/kernel/nv-pat.c
+@@ -203,6 +203,7 @@ void nv_disable_pat_support(void)
+ }
+
+ #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+ static int
+ nvidia_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
+ {
+@@ -234,6 +235,34 @@ static struct notifier_block nv_hotcpu_nfb = {
+ .notifier_call = nvidia_cpu_callback,
+ .priority = 0
+ };
++#else
++static int nvidia_cpu_online(unsigned int hcpu)
++{
++ unsigned int cpu = get_cpu();
++ if (cpu == hcpu)
++ nv_setup_pat_entries(NULL);
++ else
++ NV_SMP_CALL_FUNCTION(nv_setup_pat_entries, (void *)(long int)hcpu, 1);
++
++ put_cpu();
++
++ return 0;
++}
++
++static int nvidia_cpu_down_prep(unsigned int hcpu)
++{
++ unsigned int cpu = get_cpu();
++ if (cpu == hcpu)
++ nv_restore_pat_entries(NULL);
++ else
++ NV_SMP_CALL_FUNCTION(nv_restore_pat_entries, (void *)(long int)hcpu, 1);
++
++ put_cpu();
++
++ return 0;
++}
++#endif
++
+ #endif
+
+ int nv_init_pat_support(nv_stack_t *sp)
+@@ -255,7 +284,14 @@ int nv_init_pat_support(nv_stack_t *sp)
+ #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
+ if (nv_pat_mode == NV_PAT_MODE_BUILTIN)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+ if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0)
++#else
++ if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
++ "gpu/nvidia:online",
++ nvidia_cpu_online,
++ nvidia_cpu_down_prep) != 0)
++#endif
+ {
+ nv_disable_pat_support();
+ nv_printf(NV_DBG_ERRORS,
+@@ -280,7 +316,11 @@ void nv_teardown_pat_support(void)
+ {
+ nv_disable_pat_support();
+ #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+ unregister_hotcpu_notifier(&nv_hotcpu_nfb);
++#else
++ cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN);
++#endif
+ #endif
+ }
+ }
+diff --git a/kernel/uvm/nvidia_uvm_lite.c b/kernel/uvm/nvidia_uvm_lite.c
+index 9627f60..2158b45 100644
+--- a/kernel/uvm/nvidia_uvm_lite.c
++++ b/kernel/uvm/nvidia_uvm_lite.c
+@@ -820,7 +820,11 @@ done:
+ #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
+ int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+ unsigned long vaddr = (unsigned long)vmf->virtual_address;
++#else
++ unsigned long vaddr = (unsigned long)vmf->address;
++#endif
+ struct page *page = NULL;
+ int retval;
+
+--
+2.7.4
+
diff --git a/nvidia-340xx-kmod.spec b/nvidia-340xx-kmod.spec
index b4bad5f..cd2324d 100644
--- a/nvidia-340xx-kmod.spec
+++ b/nvidia-340xx-kmod.spec
@@ -10,7 +10,7 @@ Name: nvidia-340xx-kmod
Epoch: 1
Version: 340.102
# Taken over by kmodtool
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: NVIDIA display driver kernel module
Group: System Environment/Kernel
License: Redistributable, no modification permitted
@@ -19,6 +19,7 @@ URL:
http://www.nvidia.com/
Source11: nvidia-kmodtool-excludekernel-filterfile
Patch0: nv-linux-arm.patch
Patch1: 4.9.0_kernel.patch
+Patch2: 4.10.0_kernel.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -48,6 +49,7 @@ tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{versi
# patch loop
%patch0 -p1
%patch1 -p1
+%patch2 -p1
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
@@ -95,6 +97,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Mon Feb 20 2017 Leigh Scott <leigh123linux(a)googlemail.com> - 1:340.102-2
+- patch for kernel-4.10
+
* Wed Feb 15 2017 Leigh Scott <leigh123linux(a)googlemail.com> - 1:340.102-1
- Update to 340.102