Lines 203-208
Link Here
|
203 |
} |
203 |
} |
204 |
|
204 |
|
205 |
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) |
205 |
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) |
|
|
206 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) |
206 |
static int |
207 |
static int |
207 |
nvidia_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) |
208 |
nvidia_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) |
208 |
{ |
209 |
{ |
Lines 234-239
Link Here
|
234 |
.notifier_call = nvidia_cpu_callback, |
235 |
.notifier_call = nvidia_cpu_callback, |
235 |
.priority = 0 |
236 |
.priority = 0 |
236 |
}; |
237 |
}; |
|
|
238 |
#else |
239 |
static int nvidia_cpu_online(unsigned int hcpu) |
240 |
{ |
241 |
unsigned int cpu = get_cpu(); |
242 |
if (cpu == hcpu) |
243 |
nv_setup_pat_entries(NULL); |
244 |
else |
245 |
NV_SMP_CALL_FUNCTION(nv_setup_pat_entries, (void *)(long int)hcpu, 1); |
246 |
|
247 |
put_cpu(); |
248 |
|
249 |
return 0; |
250 |
} |
251 |
|
252 |
static int nvidia_cpu_down_prep(unsigned int hcpu) |
253 |
{ |
254 |
unsigned int cpu = get_cpu(); |
255 |
if (cpu == hcpu) |
256 |
nv_restore_pat_entries(NULL); |
257 |
else |
258 |
NV_SMP_CALL_FUNCTION(nv_restore_pat_entries, (void *)(long int)hcpu, 1); |
259 |
|
260 |
put_cpu(); |
261 |
|
262 |
return 0; |
263 |
} |
264 |
#endif |
265 |
|
237 |
#endif |
266 |
#endif |
238 |
|
267 |
|
239 |
int nv_init_pat_support(nv_stack_t *sp) |
268 |
int nv_init_pat_support(nv_stack_t *sp) |
Lines 255-261
Link Here
|
255 |
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) |
284 |
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) |
256 |
if (nv_pat_mode == NV_PAT_MODE_BUILTIN) |
285 |
if (nv_pat_mode == NV_PAT_MODE_BUILTIN) |
257 |
{ |
286 |
{ |
|
|
287 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) |
258 |
if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0) |
288 |
if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0) |
|
|
289 |
#else |
290 |
if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, |
291 |
"gpu/nvidia:online", |
292 |
nvidia_cpu_online, |
293 |
nvidia_cpu_down_prep) != 0) |
294 |
#endif |
259 |
{ |
295 |
{ |
260 |
nv_disable_pat_support(); |
296 |
nv_disable_pat_support(); |
261 |
nv_printf(NV_DBG_ERRORS, |
297 |
nv_printf(NV_DBG_ERRORS, |
Lines 280-286
Link Here
|
280 |
{ |
316 |
{ |
281 |
nv_disable_pat_support(); |
317 |
nv_disable_pat_support(); |
282 |
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) |
318 |
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) |
|
|
319 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) |
283 |
unregister_hotcpu_notifier(&nv_hotcpu_nfb); |
320 |
unregister_hotcpu_notifier(&nv_hotcpu_nfb); |
|
|
321 |
#else |
322 |
cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN); |
323 |
#endif |
284 |
#endif |
324 |
#endif |
285 |
} |
325 |
} |
286 |
} |
326 |
} |