Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 627550 | Differences between
and this patch

Collapse All | Expand All

(-)a/kernel/conftest.sh (-3 / +15 lines)
Lines 362-368 Link Here
362
            # Determine if the set_memory_uc() function is present.
362
            # Determine if the set_memory_uc() function is present.
363
            #
363
            #
364
            CODE="
364
            CODE="
365
            #include <asm/cacheflush.h>
365
            #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
366
                #include <asm/set_memory.h>
367
            #else
368
                #include <asm/cacheflush.h>
369
            #endif
366
            void conftest_set_memory_uc(void) {
370
            void conftest_set_memory_uc(void) {
367
                set_memory_uc();
371
                set_memory_uc();
368
            }"
372
            }"
Lines 375-381 Link Here
375
            # Determine if the set_memory_array_uc() function is present.
379
            # Determine if the set_memory_array_uc() function is present.
376
            #
380
            #
377
            CODE="
381
            CODE="
378
            #include <asm/cacheflush.h>
382
            #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
383
                #include <asm/set_memory.h>
384
            #else
385
                #include <asm/cacheflush.h>
386
            #endif
379
            void conftest_set_memory_array_uc(void) {
387
            void conftest_set_memory_array_uc(void) {
380
                set_memory_array_uc();
388
                set_memory_array_uc();
381
            }"
389
            }"
Lines 388-394 Link Here
388
            # Determine if the set_pages_uc() function is present.
396
            # Determine if the set_pages_uc() function is present.
389
            #
397
            #
390
            CODE="
398
            CODE="
391
            #include <asm/cacheflush.h>
399
            #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
400
                #include <asm/set_memory.h>
401
            #else
402
                #include <asm/cacheflush.h>
403
            #endif
392
            void conftest_set_pages_uc(void) {
404
            void conftest_set_pages_uc(void) {
393
                set_pages_uc();
405
                set_pages_uc();
394
            }"
406
            }"
(-)a/kernel/nv-drm.c (-3 / +7 lines)
Lines 48-54 Link Here
48
    return -ENODEV;
48
    return -ENODEV;
49
}
49
}
50
50
51
static int nv_drm_unload(
51
static void nv_drm_unload(
52
    struct drm_device *dev
52
    struct drm_device *dev
53
)
53
)
54
{
54
{
Lines 60-70 Link Here
60
        {
60
        {
61
            BUG_ON(nvl->drm != dev);
61
            BUG_ON(nvl->drm != dev);
62
            nvl->drm = NULL;
62
            nvl->drm = NULL;
63
            return 0;
63
            return;
64
        }
64
        }
65
    }
65
    }
66
66
67
    return -ENODEV;
67
    return;
68
}
68
}
69
69
70
static void nv_gem_free(
70
static void nv_gem_free(
Lines 115-121 Link Here
115
};
115
};
116
116
117
static struct drm_driver nv_drm_driver = {
117
static struct drm_driver nv_drm_driver = {
118
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
119
    .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
120
#else
118
    .driver_features = DRIVER_GEM | DRIVER_PRIME,
121
    .driver_features = DRIVER_GEM | DRIVER_PRIME,
122
#endif
119
    .load = nv_drm_load,
123
    .load = nv_drm_load,
120
    .unload = nv_drm_unload,
124
    .unload = nv_drm_unload,
121
    .fops = &nv_drm_fops,
125
    .fops = &nv_drm_fops,
(-)a/kernel/nv-linux.h (+7 lines)
Lines 2082-2087 Link Here
2082
 *    2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
2082
 *    2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
2083
 */
2083
 */
2084
2084
2085
#include <linux/version.h>
2086
2085
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
2087
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
2086
    #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
2088
    #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
2087
        #define NV_GET_USER_PAGES           get_user_pages
2089
        #define NV_GET_USER_PAGES           get_user_pages
Lines 2129-2136 Link Here
2129
2131
2130
        #else
2132
        #else
2131
2133
2134
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
2132
               return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
2135
               return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
2133
                                            pages, vmas);
2136
                                            pages, vmas);
2137
#else
2138
               return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
2139
                                            pages, vmas, NULL);
2140
#endif
2134
2141
2135
        #endif
2142
        #endif
2136
2143
(-)a/kernel/nv-pat.c (+40 lines)
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
}
(-)a/kernel/nv-vm.c (+4 lines)
Lines 13-18 Link Here
13
#include "nv.h"
13
#include "nv.h"
14
#include "nv-linux.h"
14
#include "nv-linux.h"
15
15
16
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
17
    #include <asm/set_memory.h>
18
#endif
19
16
static inline void nv_set_contig_memory_uc(nv_pte_t *page_ptr, NvU32 num_pages)
20
static inline void nv_set_contig_memory_uc(nv_pte_t *page_ptr, NvU32 num_pages)
17
{
21
{
18
    if (nv_update_memory_types)
22
    if (nv_update_memory_types)
(-)a/kernel/uvm/conftest.sh (-3 / +15 lines)
Lines 362-368 Link Here
362
            # Determine if the set_memory_uc() function is present.
362
            # Determine if the set_memory_uc() function is present.
363
            #
363
            #
364
            CODE="
364
            CODE="
365
            #include <asm/cacheflush.h>
365
            #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
366
                #include <asm/set_memory.h>
367
            #else
368
                #include <asm/cacheflush.h>
369
            #endif
366
            void conftest_set_memory_uc(void) {
370
            void conftest_set_memory_uc(void) {
367
                set_memory_uc();
371
                set_memory_uc();
368
            }"
372
            }"
Lines 375-381 Link Here
375
            # Determine if the set_memory_array_uc() function is present.
379
            # Determine if the set_memory_array_uc() function is present.
376
            #
380
            #
377
            CODE="
381
            CODE="
378
            #include <asm/cacheflush.h>
382
            #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
383
                #include <asm/set_memory.h>
384
            #else
385
                #include <asm/cacheflush.h>
386
            #endif
379
            void conftest_set_memory_array_uc(void) {
387
            void conftest_set_memory_array_uc(void) {
380
                set_memory_array_uc();
388
                set_memory_array_uc();
381
            }"
389
            }"
Lines 388-394 Link Here
388
            # Determine if the set_pages_uc() function is present.
396
            # Determine if the set_pages_uc() function is present.
389
            #
397
            #
390
            CODE="
398
            CODE="
391
            #include <asm/cacheflush.h>
399
            #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
400
                #include <asm/set_memory.h>
401
            #else
402
                #include <asm/cacheflush.h>
403
            #endif
392
            void conftest_set_pages_uc(void) {
404
            void conftest_set_pages_uc(void) {
393
                set_pages_uc();
405
                set_pages_uc();
394
            }"
406
            }"
(-)a/kernel/uvm/nvidia_uvm_linux.h (-12 / +1 lines)
Lines 124-129 Link Here
124
#include <linux/delay.h>            /* mdelay, udelay                   */
124
#include <linux/delay.h>            /* mdelay, udelay                   */
125
125
126
#include <linux/sched.h>            /* suser(), capable() replacement   */
126
#include <linux/sched.h>            /* suser(), capable() replacement   */
127
#include <linux/sched/signal.h>
127
#include <linux/moduleparam.h>      /* module_param()                   */
128
#include <linux/moduleparam.h>      /* module_param()                   */
128
#if !defined(NV_VMWARE)
129
#if !defined(NV_VMWARE)
129
#include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
130
#include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
Lines 362-379 Link Here
362
    void address_space_init_once(struct address_space *mapping);
363
    void address_space_init_once(struct address_space *mapping);
363
#endif
364
#endif
364
365
365
#if !defined(NV_FATAL_SIGNAL_PENDING_PRESENT)
366
    static inline int __fatal_signal_pending(struct task_struct *p)
367
    {
368
        return unlikely(sigismember(&p->pending.signal, SIGKILL));
369
    }
370
371
    static inline int fatal_signal_pending(struct task_struct *p)
372
    {
373
        return signal_pending(p) && __fatal_signal_pending(p);
374
    }
375
#endif
376
377
//
366
//
378
// Before the current->cred structure was introduced, current->euid,
367
// Before the current->cred structure was introduced, current->euid,
379
// or early implementations of current_euid() were sufficient. However, the
368
// or early implementations of current_euid() were sufficient. However, the
(-)a/kernel/uvm/nvidia_uvm_lite.c (-3 / +7 lines)
Lines 818-830 Link Here
818
}
818
}
819
819
820
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
820
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
821
int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
821
int _fault(struct vm_fault *vmf)
822
{
822
{
823
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
823
    unsigned long vaddr = (unsigned long)vmf->virtual_address;
824
    unsigned long vaddr = (unsigned long)vmf->virtual_address;
825
#else
826
    unsigned long vaddr = (unsigned long)vmf->address;
827
#endif
824
    struct page *page = NULL;
828
    struct page *page = NULL;
825
    int retval;
829
    int retval;
826
830
827
    retval = _fault_common(vma, vaddr, &page, vmf->flags);
831
    retval = _fault_common(NULL, vaddr, &page, vmf->flags);
828
832
829
    vmf->page = page;
833
    vmf->page = page;
830
834
Lines 862-868 Link Here
862
// it's dealing with anonymous mapping (see handle_pte_fault).
866
// it's dealing with anonymous mapping (see handle_pte_fault).
863
//
867
//
864
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
868
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
865
int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
869
int _sigbus_fault(struct vm_fault *vmf)
866
{
870
{
867
    vmf->page = NULL;
871
    vmf->page = NULL;
868
    return VM_FAULT_SIGBUS;
872
    return VM_FAULT_SIGBUS;

Return to bug 627550