aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Healy <lmiphay@gmail.com>2017-09-24 19:06:12 +0100
committerPaul Healy <lmiphay@gmail.com>2017-09-24 19:06:12 +0100
commitaf30de69b76199fa76e8f67f38988a0e98d8cf6d (patch)
treee3fafa5cfa331ed0917a8bb686bd1e95bfcb70cd /portage.patches
parentinitial ebuild for backup now (diff)
downloadlmiphay-af30de69b76199fa76e8f67f38988a0e98d8cf6d.tar.gz
lmiphay-af30de69b76199fa76e8f67f38988a0e98d8cf6d.tar.bz2
lmiphay-af30de69b76199fa76e8f67f38988a0e98d8cf6d.zip
add candidate patches for nv 340 and kernel 4.12 by warpme
Diffstat (limited to 'portage.patches')
-rw-r--r--portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.10.0_kernel.patch131
-rw-r--r--portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.11.0_kernel.patch112
-rw-r--r--portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.12.0_kernel.patch98
-rw-r--r--portage.patches/x11-drivers/nvidia-drivers-340.102-r1/fix-for-kernel4.9-module-loading.patch15
-rw-r--r--portage.patches/x11-drivers/nvidia-drivers-340.org12
5 files changed, 368 insertions, 0 deletions
diff --git a/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.10.0_kernel.patch b/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.10.0_kernel.patch
new file mode 100644
index 0000000..f4297b1
--- /dev/null
+++ b/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.10.0_kernel.patch
@@ -0,0 +1,131 @@
+From 983a2ca221a371e08bb5ad11758a729cfa5aa88c Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@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/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.11.0_kernel.patch b/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.11.0_kernel.patch
new file mode 100644
index 0000000..5ee3e4f
--- /dev/null
+++ b/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.11.0_kernel.patch
@@ -0,0 +1,112 @@
+--- a/kernel/nv-drm.c
++++ b/kernel/nv-drm.c
+@@ -22,6 +22,8 @@
+ #include <drm/drm_gem.h>
+ #endif
+
++#include <linux/version.h>
++
+ extern nv_linux_state_t *nv_linux_devices;
+
+ struct nv_gem_object {
+@@ -48,7 +50,11 @@
+ return -ENODEV;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
+ static int nv_drm_unload(
++#else
++static void nv_drm_unload(
++#endif
+ struct drm_device *dev
+ )
+ {
+@@ -60,11 +66,19 @@
+ {
+ BUG_ON(nvl->drm != dev);
+ nvl->drm = NULL;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
+ return 0;
++#else
++ return;
++#endif
+ }
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
+ return -ENODEV;
++#else
++ return;
++#endif
+ }
+
+ static void nv_gem_free(
+
+--- a/kernel/uvm/nvidia_uvm_linux.h
++++ b/kernel/uvm/nvidia_uvm_linux.h
+@@ -124,6 +124,9 @@
+ #include <linux/delay.h> /* mdelay, udelay */
+
+ #include <linux/sched.h> /* suser(), capable() replacement */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++#include <linux/sched/signal.h>
++#endif
+ #include <linux/moduleparam.h> /* module_param() */
+ #if !defined(NV_VMWARE)
+ #include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
+@@ -362,6 +365,7 @@
+ void address_space_init_once(struct address_space *mapping);
+ #endif
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
+ #if !defined(NV_FATAL_SIGNAL_PENDING_PRESENT)
+ static inline int __fatal_signal_pending(struct task_struct *p)
+ {
+@@ -372,6 +376,7 @@
+ {
+ return signal_pending(p) && __fatal_signal_pending(p);
+ }
++#endif
+ #endif
+
+ //
+
+--- a/kernel/uvm/nvidia_uvm_lite.c
++++ b/kernel/uvm/nvidia_uvm_lite.c
+@@ -818,7 +818,11 @@
+ }
+
+ #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++int _fault(struct vm_fault *vmf)
++#else
+ int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
++#endif
+ {
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+ unsigned long vaddr = (unsigned long)vmf->virtual_address;
+@@ -828,7 +832,11 @@
+ struct page *page = NULL;
+ int retval;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++ retval = _fault_common(NULL, vaddr, &page, vmf->flags);
++#else
+ retval = _fault_common(vma, vaddr, &page, vmf->flags);
++#endif
+
+ vmf->page = page;
+
+@@ -866,7 +874,11 @@
+ // it's dealing with anonymous mapping (see handle_pte_fault).
+ //
+ #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++int _sigbus_fault(struct vm_fault *vmf)
++#else
+ int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
++#endif
+ {
+ vmf->page = NULL;
+ return VM_FAULT_SIGBUS;
+
diff --git a/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.12.0_kernel.patch b/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.12.0_kernel.patch
new file mode 100644
index 0000000..095a1fc
--- /dev/null
+++ b/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/4.12.0_kernel.patch
@@ -0,0 +1,98 @@
+diff -Naur NVIDIA-Linux-x86_64-340.102-old/kernel/conftest.sh NVIDIA-Linux-x86_64-340.102-new/kernel/conftest.sh
+--- NVIDIA-Linux-x86_64-340.102-old/kernel/conftest.sh 2017-01-16 21:15:32.000000000 +0100
++++ NVIDIA-Linux-x86_64-340.102-new/kernel/conftest.sh 2017-07-05 20:58:45.283333334 +0200
+@@ -362,7 +362,11 @@
+ # 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 @@
+ # 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 @@
+ # 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 -Naur NVIDIA-Linux-x86_64-340.102-old/kernel/nv-vm.c NVIDIA-Linux-x86_64-340.102-new/kernel/nv-vm.c
+--- NVIDIA-Linux-x86_64-340.102-old/kernel/nv-vm.c 2017-01-16 21:15:32.000000000 +0100
++++ NVIDIA-Linux-x86_64-340.102-new/kernel/nv-vm.c 2017-07-05 20:58:45.286666667 +0200
+@@ -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 -Naur NVIDIA-Linux-x86_64-340.102-old/kernel/uvm/conftest.sh NVIDIA-Linux-x86_64-340.102-new/kernel/uvm/conftest.sh
+--- NVIDIA-Linux-x86_64-340.102-old/kernel/uvm/conftest.sh 2017-01-16 21:15:33.000000000 +0100
++++ NVIDIA-Linux-x86_64-340.102-new/kernel/uvm/conftest.sh 2017-07-05 20:58:45.286666667 +0200
+@@ -362,7 +362,11 @@
+ # 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 @@
+ # 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 @@
+ # 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/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/fix-for-kernel4.9-module-loading.patch b/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/fix-for-kernel4.9-module-loading.patch
new file mode 100644
index 0000000..6b358b9
--- /dev/null
+++ b/portage.patches/x11-drivers/nvidia-drivers-340.102-r1/fix-for-kernel4.9-module-loading.patch
@@ -0,0 +1,15 @@
+diff -Naur NVIDIA-Linux-x86_64-340.101-old/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.101-new/kernel/nv-drm.c
+--- NVIDIA-Linux-x86_64-340.101-old/kernel/nv-drm.c 2016-12-01 23:48:28.000000000 +0100
++++ NVIDIA-Linux-x86_64-340.101-new/kernel/nv-drm.c 2016-12-18 18:04:44.016666639 +0100
+@@ -115,7 +115,11 @@
+ };
+
+ static struct drm_driver nv_drm_driver = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
++ .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
++#else
+ .driver_features = DRIVER_GEM | DRIVER_PRIME,
++#endif
+ .load = nv_drm_load,
+ .unload = nv_drm_unload,
+ .fops = &nv_drm_fops,
diff --git a/portage.patches/x11-drivers/nvidia-drivers-340.org b/portage.patches/x11-drivers/nvidia-drivers-340.org
new file mode 100644
index 0000000..76d10db
--- /dev/null
+++ b/portage.patches/x11-drivers/nvidia-drivers-340.org
@@ -0,0 +1,12 @@
+* 340.104
+looks clean from:
+https://github.com/warpme/minimyth2/tree/master/script/nvidia/nvidia-340.104
+
+* 340.102
+Post & patches for 340.102 by warpme:
+forum: https://forums.geforce.com/default/topic/1012391/340-xx-compilation-fails-under-4-12-kernel-/
+source: https://github.com/warpme/minimyth2/tree/master/script/nvidia/nvidia-340.102/files
+
+** alt (not tried):
+https://github.com/Hoshpak/void-packages/tree/master/srcpkgs/nvidia340/files
+