1 --- kernel/nv-linux.h
\r
2 +++ kernel/nv-linux.h
\r
3 @@ -2082,6 +2082,8 @@ static inline NvU64 nv_node_end_pfn(int nid)
\r
4 * 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
\r
7 +#include <linux/version.h>
\r
9 #if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
\r
10 #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
\r
11 #define NV_GET_USER_PAGES get_user_pages
\r
12 @@ -2129,8 +2131,13 @@ static inline NvU64 nv_node_end_pfn(int nid)
\r
16 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
\r
17 return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
\r
20 + return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
\r
21 + pages, vmas, NULL);
\r
28 @@ -203,6 +203,7 @@ void nv_disable_pat_support(void)
\r
31 #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
\r
32 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
\r
34 nvidia_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
\r
36 @@ -234,6 +235,34 @@ static struct notifier_block nv_hotcpu_nfb = {
\r
37 .notifier_call = nvidia_cpu_callback,
\r
41 +static int nvidia_cpu_online(unsigned int hcpu)
\r
43 + unsigned int cpu = get_cpu();
\r
45 + nv_setup_pat_entries(NULL);
\r
47 + NV_SMP_CALL_FUNCTION(nv_setup_pat_entries, (void *)(long int)hcpu, 1);
\r
54 +static int nvidia_cpu_down_prep(unsigned int hcpu)
\r
56 + unsigned int cpu = get_cpu();
\r
58 + nv_restore_pat_entries(NULL);
\r
60 + NV_SMP_CALL_FUNCTION(nv_restore_pat_entries, (void *)(long int)hcpu, 1);
\r
70 int nv_init_pat_support(nv_stack_t *sp)
\r
71 @@ -255,7 +284,14 @@ int nv_init_pat_support(nv_stack_t *sp)
\r
72 #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
\r
73 if (nv_pat_mode == NV_PAT_MODE_BUILTIN)
\r
75 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
\r
76 if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0)
\r
78 + if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
\r
79 + "gpu/nvidia:online",
\r
80 + nvidia_cpu_online,
\r
81 + nvidia_cpu_down_prep) != 0)
\r
84 nv_disable_pat_support();
\r
85 nv_printf(NV_DBG_ERRORS,
\r
86 @@ -280,7 +316,11 @@ void nv_teardown_pat_support(void)
\r
88 nv_disable_pat_support();
\r
89 #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
\r
90 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
\r
91 unregister_hotcpu_notifier(&nv_hotcpu_nfb);
\r
93 + cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN);
\r
98 --- kernel/uvm/nvidia_uvm_lite.c
\r
99 +++ kernel/uvm/nvidia_uvm_lite.c
\r
100 @@ -820,7 +820,11 @@ done:
\r
101 #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
\r
102 int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
\r
104 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
\r
105 unsigned long vaddr = (unsigned long)vmf->virtual_address;
\r
107 + unsigned long vaddr = (unsigned long)vmf->address;
\r
109 struct page *page = NULL;
\r
112 --- kernel/nv-drm.c 2017-03-31 03:42:21.000000000 +0200
\r
113 +++ kernel/nv-drm.c 2017-04-06 23:53:14.273356795 +0200
\r
118 -static int nv_drm_unload(
\r
119 +static void nv_drm_unload(
\r
120 struct drm_device *dev
\r
125 BUG_ON(nvl->drm != dev);
\r
140 static void nv_gem_free(
\r
141 --- kernel/uvm/nvidia_uvm_linux.h 2017-03-31 03:42:21.000000000 +0200
\r
142 +++ kernel/uvm/nvidia_uvm_linux.h 2017-04-06 23:53:14.273356795 +0200
\r
143 @@ -124,6 +124,7 @@
\r
144 #include <linux/delay.h> /* mdelay, udelay */
\r
146 #include <linux/sched.h> /* suser(), capable() replacement */
\r
147 +#include <linux/sched/signal.h>
\r
148 #include <linux/moduleparam.h> /* module_param() */
\r
149 #if !defined(NV_VMWARE)
\r
150 #include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
\r
151 @@ -362,17 +363,6 @@
\r
152 void address_space_init_once(struct address_space *mapping);
\r
155 -#if !defined(NV_FATAL_SIGNAL_PENDING_PRESENT)
\r
156 - static inline int __fatal_signal_pending(struct task_struct *p)
\r
158 - return unlikely(sigismember(&p->pending.signal, SIGKILL));
\r
161 - static inline int fatal_signal_pending(struct task_struct *p)
\r
163 - return signal_pending(p) && __fatal_signal_pending(p);
\r
168 // Before the current->cred structure was introduced, current->euid,
\r
169 --- kernel/uvm/nvidia_uvm_lite.c 2017-03-31 03:42:21.000000000 +0200
\r
170 +++ kernel/uvm/nvidia_uvm_lite.c 2017-04-06 23:53:14.273356795 +0200
\r
171 @@ -818,7 +818,7 @@
\r
174 #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
\r
175 -int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
\r
176 +int _fault(struct vm_fault *vmf)
\r
178 unsigned long vaddr = (unsigned long)vmf->virtual_address;
\r
179 struct page *page = NULL;
\r
180 @@ -828,7 +828,7 @@
\r
181 struct page *page = NULL;
\r
184 - retval = _fault_common(vma, vaddr, &page, vmf->flags);
\r
185 + retval = _fault_common(NULL, vaddr, &page, vmf->flags);
\r
189 @@ -866,7 +866,7 @@
\r
190 // it's dealing with anonymous mapping (see handle_pte_fault).
\r
192 #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
\r
193 -int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
\r
194 +int _sigbus_fault(struct vm_fault *vmf)
\r
197 return VM_FAULT_SIGBUS;
\r
198 --- kernel/nv-drm.c
\r
199 +++ kernel/nv-drm.c
\r
200 @@ -115,7 +115,11 @@ static const struct file_operations nv_drm_fops = {
\r
203 static struct drm_driver nv_drm_driver = {
\r
204 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
\r
205 + .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
\r
207 .driver_features = DRIVER_GEM | DRIVER_PRIME,
\r
209 .load = nv_drm_load,
\r
210 .unload = nv_drm_unload,
\r
211 .fops = &nv_drm_fops,