commit f0535885f9239ea16b53f763ef1132af4b8202b5
Author: leigh123linux <leigh123linux(a)googlemail.com>
Date: Mon Feb 20 21:22:14 2017 +0000
patch for kernel-4.10
kernel_4.10.patch | 105 +++++++++++++++++++++++++++++++++++++++++++++++++
nvidia-304xx-kmod.spec | 7 +++-
2 files changed, 111 insertions(+), 1 deletion(-)
---
diff --git a/kernel_4.10.patch b/kernel_4.10.patch
new file mode 100644
index 0000000..08a29fe
--- /dev/null
+++ b/kernel_4.10.patch
@@ -0,0 +1,105 @@
+From d270372bf8abcf45409b30cdb33069280527b0ff Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone(a)canonical.com>
+Date: Wed, 15 Feb 2017 18:01:02 +0100
+Subject: [PATCH 1/1] Add support for Linux 4.10
+
+---
+ nv-linux.h | 5 +++++
+ nv-pat.c | 40 ++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 45 insertions(+)
+
+diff --git a/kernels/nv-linux.h b/kernels/nv-linux.h
+index b46e71f..3081c06 100644
+--- a/kernels/nv-linux.h
++++ b/kernels/nv-linux.h
+@@ -1895,8 +1895,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/kernels/nv-pat.c b/kernels/nv-pat.c
+index e71e81c..d742789 100644
+--- a/kernels/nv-pat.c
++++ b/kernels/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
+ nv_kern_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
+ {
+@@ -234,6 +235,34 @@ static struct notifier_block nv_hotcpu_nfb = {
+ .notifier_call = nv_kern_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
+ }
+ }
+--
+2.7.4
+
diff --git a/nvidia-304xx-kmod.spec b/nvidia-304xx-kmod.spec
index b31fba8..e526092 100644
--- a/nvidia-304xx-kmod.spec
+++ b/nvidia-304xx-kmod.spec
@@ -9,7 +9,7 @@
Name: nvidia-304xx-kmod
Version: 304.135
# Taken over by kmodtool
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: NVIDIA display driver kernel module
Group: System Environment/Kernel
License: Redistributable, no modification permitted
@@ -23,6 +23,7 @@ Source11: nvidia-304xx-kmodtool-excludekernel-filterfile
#
https://anonscm.debian.org/viewvc/pkg-nvidia/packages/nvidia-graphics-dri...
#Patch0: disable-mtrr.patch
Patch1: 4.9.0_kernel.patch
+Patch2: kernel_4.10.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -51,6 +52,7 @@ do
pushd nvidiapkg-${arch}
#patch0 -p0
%patch1 -p1
+%patch2 -p1
popd
done
@@ -84,6 +86,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Mon Feb 20 2017 Leigh Scott <leigh123linux(a)googlemail.com> - 304.135-3
+- patch for kernel-4.10
+
* Wed Feb 15 2017 Leigh Scott <leigh123linux(a)googlemail.com> - 304.135-2
- remove disable mtrr patch