commit d846180727ed248223f91e9e3a7d38babe8377bf
Author: leigh123linux <leigh123linux(a)googlemail.com>
Date: Sun Jul 30 12:37:34 2017 +0100
patch for kernel-4.12
4.10.0_kernel.patch | 16 +++----
4.11_kernel.patch | 39 ++++++++++++-----
4.12_kernel.patch | 115 +++++++++++++++++++++++++++++++++++++++++++++++++
4.9.0_kernel.patch | 20 +++++++--
nvidia-340xx-kmod.spec | 8 +++-
5 files changed, 175 insertions(+), 23 deletions(-)
---
diff --git a/4.10.0_kernel.patch b/4.10.0_kernel.patch
index f4297b1..9227a97 100644
--- a/4.10.0_kernel.patch
+++ b/4.10.0_kernel.patch
@@ -1,12 +1,12 @@
-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
+From 9480eefced90ecd4aa0e9c8953eb073eb57ab681 Mon Sep 17 00:00:00 2001
+From: leigh123linux <leigh123linux(a)googlemail.com>
+Date: Sun, 30 Jul 2017 12:17:01 +0100
+Subject: [PATCH 2/4] 4.10.0_kernel
---
- nv-linux.h | 7 +++++++
- nv-pat.c | 40 ++++++++++++++++++++++++++++++++++++++++
- uvm/nvidia_uvm_lite.c | 4 ++++
+ kernel/nv-linux.h | 7 +++++++
+ kernel/nv-pat.c | 40 ++++++++++++++++++++++++++++++++++++++++
+ kernel/uvm/nvidia_uvm_lite.c | 4 ++++
3 files changed, 51 insertions(+)
diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h
@@ -127,5 +127,5 @@ index 9627f60..2158b45 100644
int retval;
--
-2.7.4
+2.13.3
diff --git a/4.11_kernel.patch b/4.11_kernel.patch
index 5ee3e4f..228c691 100644
--- a/4.11_kernel.patch
+++ b/4.11_kernel.patch
@@ -1,3 +1,16 @@
+From 457a5db504405f2ce2afad82bdcc59a9349b5d77 Mon Sep 17 00:00:00 2001
+From: leigh123linux <leigh123linux(a)googlemail.com>
+Date: Sun, 30 Jul 2017 12:17:39 +0100
+Subject: [PATCH 3/4] 4.11_kernel
+
+---
+ kernel/nv-drm.c | 14 ++++++++++++++
+ kernel/uvm/nvidia_uvm_linux.h | 5 +++++
+ kernel/uvm/nvidia_uvm_lite.c | 12 ++++++++++++
+ 3 files changed, 31 insertions(+)
+
+diff --git a/kernel/nv-drm.c b/kernel/nv-drm.c
+index ea9f17e..bcb7cfe 100644
--- a/kernel/nv-drm.c
+++ b/kernel/nv-drm.c
@@ -22,6 +22,8 @@
@@ -9,7 +22,7 @@
extern nv_linux_state_t *nv_linux_devices;
struct nv_gem_object {
-@@ -48,7 +50,11 @@
+@@ -48,7 +50,11 @@ static int nv_drm_load(
return -ENODEV;
}
@@ -21,7 +34,7 @@
struct drm_device *dev
)
{
-@@ -60,11 +66,19 @@
+@@ -60,11 +66,19 @@ static int nv_drm_unload(
{
BUG_ON(nvl->drm != dev);
nvl->drm = NULL;
@@ -41,7 +54,8 @@
}
static void nv_gem_free(
-
+diff --git a/kernel/uvm/nvidia_uvm_linux.h b/kernel/uvm/nvidia_uvm_linux.h
+index f69c107..0fb3b3b 100644
--- a/kernel/uvm/nvidia_uvm_linux.h
+++ b/kernel/uvm/nvidia_uvm_linux.h
@@ -124,6 +124,9 @@
@@ -54,7 +68,7 @@
#include <linux/moduleparam.h> /* module_param() */
#if !defined(NV_VMWARE)
#include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
-@@ -362,6 +365,7 @@
+@@ -362,6 +365,7 @@ typedef void irqreturn_t;
void address_space_init_once(struct address_space *mapping);
#endif
@@ -62,18 +76,19 @@
#if !defined(NV_FATAL_SIGNAL_PENDING_PRESENT)
static inline int __fatal_signal_pending(struct task_struct *p)
{
-@@ -372,6 +376,7 @@
- {
+@@ -373,6 +377,7 @@ typedef void irqreturn_t;
return signal_pending(p) && __fatal_signal_pending(p);
}
-+#endif
#endif
++#endif
//
-
+ // Before the current->cred structure was introduced, current->euid,
+diff --git a/kernel/uvm/nvidia_uvm_lite.c b/kernel/uvm/nvidia_uvm_lite.c
+index 2158b45..5150f3d 100644
--- a/kernel/uvm/nvidia_uvm_lite.c
+++ b/kernel/uvm/nvidia_uvm_lite.c
-@@ -818,7 +818,11 @@
+@@ -818,7 +818,11 @@ done:
}
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
@@ -85,7 +100,7 @@
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
unsigned long vaddr = (unsigned long)vmf->virtual_address;
-@@ -828,7 +832,11 @@
+@@ -828,7 +832,11 @@ int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
struct page *page = NULL;
int retval;
@@ -97,7 +112,7 @@
vmf->page = page;
-@@ -866,7 +874,11 @@
+@@ -866,7 +874,11 @@ static struct vm_operations_struct uvmlite_vma_ops =
// it's dealing with anonymous mapping (see handle_pte_fault).
//
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
@@ -109,4 +124,6 @@
{
vmf->page = NULL;
return VM_FAULT_SIGBUS;
+--
+2.13.3
diff --git a/4.12_kernel.patch b/4.12_kernel.patch
new file mode 100644
index 0000000..d2ba219
--- /dev/null
+++ b/4.12_kernel.patch
@@ -0,0 +1,115 @@
+From 7cd576da2c2312cbfd20edfd55b20ed601b96240 Mon Sep 17 00:00:00 2001
+From: leigh123linux <leigh123linux(a)googlemail.com>
+Date: Sun, 30 Jul 2017 12:24:33 +0100
+Subject: [PATCH 4/4] 4.12_kernel
+
+---
+ kernel/conftest.sh | 18 +++++++++++++++---
+ kernel/nv-vm.c | 4 ++++
+ kernel/uvm/conftest.sh | 18 +++++++++++++++---
+ 3 files changed, 34 insertions(+), 6 deletions(-)
+
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index d74ddf3..7ac1d1b 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -362,7 +362,11 @@ compile_test() {
+ # Determine if the set_memory_uc() function is present.
+ #
+ CODE="
+- #include <asm/cacheflush.h>
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ #include <asm/set_memory.h>
++ #else
++ #include <asm/cacheflush.h>
++ #endif
+ void conftest_set_memory_uc(void) {
+ set_memory_uc();
+ }"
+@@ -375,7 +379,11 @@ compile_test() {
+ # Determine if the set_memory_array_uc() function is present.
+ #
+ CODE="
+- #include <asm/cacheflush.h>
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ #include <asm/set_memory.h>
++ #else
++ #include <asm/cacheflush.h>
++ #endi
+ void conftest_set_memory_array_uc(void) {
+ set_memory_array_uc();
+ }"
+@@ -388,7 +396,11 @@ compile_test() {
+ # Determine if the set_pages_uc() function is present.
+ #
+ CODE="
+- #include <asm/cacheflush.h>
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ #include <asm/set_memory.h>
++ #else
++ #include <asm/cacheflush.h>
++ #endif
+ void conftest_set_pages_uc(void) {
+ set_pages_uc();
+ }"
+diff --git a/kernel/nv-vm.c b/kernel/nv-vm.c
+index 0a9e59e..ef04694 100644
+--- a/kernel/nv-vm.c
++++ b/kernel/nv-vm.c
+@@ -13,6 +13,10 @@
+ #include "nv.h"
+ #include "nv-linux.h"
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ #include <asm/set_memory.h>
++#endif
++
+ static inline void nv_set_contig_memory_uc(nv_pte_t *page_ptr, NvU32 num_pages)
+ {
+ if (nv_update_memory_types)
+diff --git a/kernel/uvm/conftest.sh b/kernel/uvm/conftest.sh
+index d74ddf3..a412a45 100755
+--- a/kernel/uvm/conftest.sh
++++ b/kernel/uvm/conftest.sh
+@@ -362,7 +362,11 @@ compile_test() {
+ # Determine if the set_memory_uc() function is present.
+ #
+ CODE="
+- #include <asm/cacheflush.h>
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ #include <asm/set_memory.h>
++ #else
++ #include <asm/cacheflush.h>
++ #endif
+ void conftest_set_memory_uc(void) {
+ set_memory_uc();
+ }"
+@@ -375,7 +379,11 @@ compile_test() {
+ # Determine if the set_memory_array_uc() function is present.
+ #
+ CODE="
+- #include <asm/cacheflush.h>
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ #include <asm/set_memory.h>
++ #else
++ #include <asm/cacheflush.h>
++ #endif
+ void conftest_set_memory_array_uc(void) {
+ set_memory_array_uc();
+ }"
+@@ -388,7 +396,11 @@ compile_test() {
+ # Determine if the set_pages_uc() function is present.
+ #
+ CODE="
+- #include <asm/cacheflush.h>
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++ #include <asm/set_memory.h>
++ #else
++ #include <asm/cacheflush.h>
++ #endif
+ void conftest_set_pages_uc(void) {
+ set_pages_uc();
+ }"
+--
+2.13.3
+
diff --git a/4.9.0_kernel.patch b/4.9.0_kernel.patch
index dc80b97..78c00f3 100644
--- a/4.9.0_kernel.patch
+++ b/4.9.0_kernel.patch
@@ -1,6 +1,17 @@
---- a/kernel/nv-drm.c 2016-12-15 12:41:26.000000000 +0100
-+++ b/kernel/nv-drm.c 2016-12-15 12:58:48.000000000 +0100
-@@ -115,7 +115,11 @@
+From 19996a25efb250a1b8c7d06fdb85b5462e2a7797 Mon Sep 17 00:00:00 2001
+From: leigh123linux <leigh123linux(a)googlemail.com>
+Date: Sun, 30 Jul 2017 12:16:14 +0100
+Subject: [PATCH 1/4] 4.9.0_kernel
+
+---
+ kernel/nv-drm.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/kernel/nv-drm.c b/kernel/nv-drm.c
+index 4c1a3ae..ea9f17e 100644
+--- a/kernel/nv-drm.c
++++ b/kernel/nv-drm.c
+@@ -115,7 +115,11 @@ static const struct file_operations nv_drm_fops = {
};
static struct drm_driver nv_drm_driver = {
@@ -12,3 +23,6 @@
.load = nv_drm_load,
.unload = nv_drm_unload,
.fops = &nv_drm_fops,
+--
+2.13.3
+
diff --git a/nvidia-340xx-kmod.spec b/nvidia-340xx-kmod.spec
index 972c586..c13ab15 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: 3%{?dist}
+Release: 4%{?dist}
Summary: NVIDIA display driver kernel module
Group: System Environment/Kernel
License: Redistributable, no modification permitted
@@ -21,6 +21,7 @@ Patch0: nv-linux-arm.patch
Patch1: 4.9.0_kernel.patch
Patch2: 4.10.0_kernel.patch
Patch3: 4.11_kernel.patch
+Patch4: 4.12_kernel.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -52,6 +53,7 @@ tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{versi
%patch1 -p1
%patch2 -p1
%patch3 -p1
+%patch4 -p1
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
@@ -99,6 +101,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Sun Jul 30 2017 Leigh Scott <leigh123linux(a)googlemail.com> - 1:340.102-4
+- patch for kernel-4.12
+- rebase patches
+
* Sun Apr 23 2017 Leigh Scott <leigh123linux(a)googlemail.com> - 1:340.102-3
- patch for kernel-4.11rc