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

Collapse All | Expand All

(-)work.orig/kernel/common/inc/nv-linux.h (-1 / +10 lines)
Lines 1114-1120 Link Here
1114
#if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
1114
#if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
1115
#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \
1115
#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \
1116
    kmem_cache_create(name, size, align, flags, ctor)
1116
    kmem_cache_create(name, size, align, flags, ctor)
1117
1117
#define NV_KMEM_CACHE_CREATE_FULL_USERCOPY(name, size, align, flags, useroffset, usersize, ctor) \
1118
    kmem_cache_create_usercopy(name, size, align, flags, useroffset, usersize, ctor)
1118
#else
1119
#else
1119
#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \
1120
#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \
1120
    kmem_cache_create(name, size, align, flags, ctor, NULL)
1121
    kmem_cache_create(name, size, align, flags, ctor, NULL)
Lines 1123-1128 Link Here
1123
#define NV_KMEM_CACHE_CREATE(name, type)    \
1124
#define NV_KMEM_CACHE_CREATE(name, type)    \
1124
    NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, 0, NULL)
1125
    NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, 0, NULL)
1125
1126
1127
#ifdef SLAB_USERCOPY
1128
#define NV_KMEM_CACHE_CREATE_USERCOPY(name, type)    \
1129
    NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, SLAB_USERCOPY, NULL)
1130
#else
1131
#define NV_KMEM_CACHE_CREATE_USERCOPY(name, type)    \
1132
    NV_KMEM_CACHE_CREATE_FULL_USERCOPY(name, sizeof(type), 0, 0, 0, sizeof(type), NULL)
1133
#endif
1134
1126
#define NV_KMEM_CACHE_DESTROY(kmem_cache)   \
1135
#define NV_KMEM_CACHE_DESTROY(kmem_cache)   \
1127
    kmem_cache_destroy(kmem_cache)
1136
    kmem_cache_destroy(kmem_cache)
1128
1137
(-)work.orig/kernel/common/inc/nv-modeset-interface.h (-3 / +3 lines)
Lines 72-78 Link Here
72
     * mix nvidia and nvidia-modeset kernel modules from different
72
     * mix nvidia and nvidia-modeset kernel modules from different
73
     * releases.
73
     * releases.
74
     */
74
     */
75
    const char *version_string;
75
//    const char *version_string;
76
76
77
    /*
77
    /*
78
     * Return system information.
78
     * Return system information.
Lines 115-122 Link Here
115
115
116
    int (*set_callbacks)(const nvidia_modeset_callbacks_t *cb);
116
    int (*set_callbacks)(const nvidia_modeset_callbacks_t *cb);
117
117
118
} nvidia_modeset_rm_ops_t;
118
} __do_const nvidia_modeset_rm_ops_t;
119
119
120
NV_STATUS nvidia_get_rm_ops(nvidia_modeset_rm_ops_t *rm_ops);
120
NV_STATUS nvidia_get_rm_ops(const nvidia_modeset_rm_ops_t **rm_ops, const char **version_string);
121
121
122
#endif /* _NV_MODESET_INTERFACE_H_ */
122
#endif /* _NV_MODESET_INTERFACE_H_ */
(-)work.orig/kernel/common/inc/nv-register-module.h (-1 / +1 lines)
Lines 34-40 Link Here
34
    int (*ioctl)(struct inode *, struct file * file, unsigned int cmd, unsigned long arg);
34
    int (*ioctl)(struct inode *, struct file * file, unsigned int cmd, unsigned long arg);
35
    unsigned int (*poll)(struct file * file, poll_table *wait);
35
    unsigned int (*poll)(struct file * file, poll_table *wait);
36
36
37
} nvidia_module_t;
37
} __do_const nvidia_module_t;
38
38
39
int nvidia_register_module(nvidia_module_t *);
39
int nvidia_register_module(nvidia_module_t *);
40
int nvidia_unregister_module(nvidia_module_t *);
40
int nvidia_unregister_module(nvidia_module_t *);
(-)work.orig/kernel/nvidia/nv.c (-1 / +1 lines)
Lines 798-804 Link Here
798
798
799
    nv_memdbg_init();
799
    nv_memdbg_init();
800
800
801
    nvidia_stack_t_cache = NV_KMEM_CACHE_CREATE(nvidia_stack_cache_name,
801
    nvidia_stack_t_cache = NV_KMEM_CACHE_CREATE_USERCOPY(nvidia_stack_cache_name,
802
                                                nvidia_stack_t);
802
                                                nvidia_stack_t);
803
    if (nvidia_stack_t_cache == NULL)
803
    if (nvidia_stack_t_cache == NULL)
804
    {
804
    {
(-)work.orig/kernel/nvidia/nv-chrdev.c (-2 lines)
Lines 20-27 Link Here
20
{
20
{
21
    nvidia_module_t *module = (nvidia_module_t *)param;
21
    nvidia_module_t *module = (nvidia_module_t *)param;
22
22
23
    module->instance = nv_module_instance;
24
25
    return (nvidia_register_module(module));
23
    return (nvidia_register_module(module));
26
}
24
}
27
25
(-)work.orig/kernel/nvidia/nv-instance.c (+1 lines)
Lines 51-56 Link Here
51
nvidia_module_t nv_fops = {
51
nvidia_module_t nv_fops = {
52
    .owner       = THIS_MODULE,
52
    .owner       = THIS_MODULE,
53
    .module_name = MODULE_NAME,
53
    .module_name = MODULE_NAME,
54
    .instance    = MODULE_INSTANCE_NUMBER,
54
    .open        = nvidia_open,
55
    .open        = nvidia_open,
55
    .close       = nvidia_close,
56
    .close       = nvidia_close,
56
    .ioctl       = nvidia_ioctl,
57
    .ioctl       = nvidia_ioctl,
(-)work.orig/kernel/nvidia/nv-mmap.c (-2 / +2 lines)
Lines 103-114 Link Here
103
}
103
}
104
104
105
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_ACCESS)
105
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_ACCESS)
106
static int
106
static ssize_t
107
nvidia_vma_access(
107
nvidia_vma_access(
108
    struct vm_area_struct *vma,
108
    struct vm_area_struct *vma,
109
    unsigned long addr,
109
    unsigned long addr,
110
    void *buffer,
110
    void *buffer,
111
    int length,
111
    size_t length,
112
    int write
112
    int write
113
)
113
)
114
{
114
{
(-)work.orig/kernel/nvidia/nv-modeset-interface.c (-12 / +20 lines)
Lines 8-21 Link Here
8
 * _NVRM_COPYRIGHT_END_
8
 * _NVRM_COPYRIGHT_END_
9
 */
9
 */
10
10
11
#include "nv-modeset-interface.h"
12
13
#include "nv-misc.h"
11
#include "nv-misc.h"
14
#include "os-interface.h"
12
#include "os-interface.h"
15
#include "nv-linux.h"
13
#include "nv-linux.h"
16
#include "nvstatus.h"
14
#include "nvstatus.h"
17
#include "nv.h"
15
#include "nv.h"
18
16
17
#include "nv-modeset-interface.h"
18
19
static const nvidia_modeset_callbacks_t *nv_modeset_callbacks;
19
static const nvidia_modeset_callbacks_t *nv_modeset_callbacks;
20
20
21
static int nvidia_modeset_rm_ops_alloc_stack(nvidia_stack_t **sp)
21
static int nvidia_modeset_rm_ops_alloc_stack(nvidia_stack_t **sp)
Lines 100-109 Link Here
100
    return count;
100
    return count;
101
}
101
}
102
102
103
NV_STATUS nvidia_get_rm_ops(nvidia_modeset_rm_ops_t *rm_ops)
103
NV_STATUS nvidia_get_rm_ops(const nvidia_modeset_rm_ops_t **rm_ops, const char **version_string)
104
{
104
{
105
    const nvidia_modeset_rm_ops_t local_rm_ops = {
105
    static const nvidia_modeset_rm_ops_t local_rm_ops = {
106
        .version_string = NV_VERSION_STRING,
107
        .system_info    = {
106
        .system_info    = {
108
            .allow_write_combining = NV_FALSE,
107
            .allow_write_combining = NV_FALSE,
109
        },
108
        },
Lines 116-132 Link Here
116
        .set_callbacks  = nvidia_modeset_set_callbacks,
115
        .set_callbacks  = nvidia_modeset_set_callbacks,
117
    };
116
    };
118
117
119
    if (strcmp(rm_ops->version_string, NV_VERSION_STRING) != 0)
118
    static const nvidia_modeset_rm_ops_t local_rm_ops_wc = {
119
        .system_info    = {
120
            .allow_write_combining = NV_TRUE,
121
        },
122
        .alloc_stack    = nvidia_modeset_rm_ops_alloc_stack,
123
        .free_stack     = nvidia_modeset_rm_ops_free_stack,
124
        .enumerate_gpus = nvidia_modeset_enumerate_gpus,
125
        .open_gpu       = nvidia_dev_get,
126
        .close_gpu      = nvidia_dev_put,
127
        .op             = rm_kernel_rmapi_op, /* provided by nv-kernel.o */
128
        .set_callbacks  = nvidia_modeset_set_callbacks,
129
    };
130
131
    if (strcmp(*version_string, NV_VERSION_STRING) != 0)
120
    {
132
    {
121
        rm_ops->version_string = NV_VERSION_STRING;
133
        *version_string = NV_VERSION_STRING;
122
        return NV_ERR_GENERIC;
134
        return NV_ERR_GENERIC;
123
    }
135
    }
124
136
125
    *rm_ops = local_rm_ops;
137
    *rm_ops = NV_ALLOW_WRITE_COMBINING(NV_MEMORY_TYPE_FRAMEBUFFER) ? &local_rm_ops_wc : &local_rm_ops;
126
127
    if (NV_ALLOW_WRITE_COMBINING(NV_MEMORY_TYPE_FRAMEBUFFER)) {
128
        rm_ops->system_info.allow_write_combining = NV_TRUE;
129
    }
130
138
131
    return NV_OK;
139
    return NV_OK;
132
}
140
}
(-)work.orig/kernel/nvidia-drm/nvidia-drm-drv.c (-1 / +3 lines)
Lines 594-600 static const struct drm_ioctl_desc nv_dr Link Here
594
                      DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
594
                      DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
595
};
595
};
596
596
597
static struct drm_driver nv_drm_driver = {
597
static drm_driver_no_const nv_drm_driver __read_only = {
598
598
599
    .driver_features        = DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER,
599
    .driver_features        = DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER,
600
600
Lines 731-736 Link Here
731
        return;
731
        return;
732
    }
732
    }
733
733
734
    pax_open_kernel();
734
    nv_drm_driver.driver_features |= DRIVER_MODESET | DRIVER_ATOMIC;
735
    nv_drm_driver.driver_features |= DRIVER_MODESET | DRIVER_ATOMIC;
735
736
736
    nv_drm_driver.master_set       = nv_drm_master_set;
737
    nv_drm_driver.master_set       = nv_drm_master_set;
Lines 741-746 Link Here
741
    nv_drm_driver.dumb_destroy     = drm_gem_dumb_destroy;
742
    nv_drm_driver.dumb_destroy     = drm_gem_dumb_destroy;
742
743
743
    nv_drm_driver.gem_vm_ops       = &nv_drm_gem_vma_ops;
744
    nv_drm_driver.gem_vm_ops       = &nv_drm_gem_vma_ops;
745
    pax_close_kernel();
744
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
746
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
745
}
747
}
746
748
(-)work.orig/kernel/nvidia-modeset/nvidia-modeset-linux.c (-18 / +17 lines)
Lines 337-343 Link Here
337
 * Interface with resman.
337
 * Interface with resman.
338
 *************************************************************************/
338
 *************************************************************************/
339
339
340
static nvidia_modeset_rm_ops_t __rm_ops = { 0 };
340
static const nvidia_modeset_rm_ops_t *__rm_ops;
341
static nvidia_modeset_callbacks_t nvkms_rm_callbacks = {
341
static nvidia_modeset_callbacks_t nvkms_rm_callbacks = {
342
    .suspend = nvkms_suspend,
342
    .suspend = nvkms_suspend,
343
    .resume  = nvkms_resume
343
    .resume  = nvkms_resume
Lines 347-365 Link Here
347
{
347
{
348
    NV_STATUS nvstatus;
348
    NV_STATUS nvstatus;
349
    int ret;
349
    int ret;
350
    const char *version_string = NV_VERSION_STRING;
350
351
351
    __rm_ops.version_string = NV_VERSION_STRING;
352
    nvstatus = nvidia_get_rm_ops(&__rm_ops, &version_string);
352
353
    nvstatus = nvidia_get_rm_ops(&__rm_ops);
354
353
355
    if (nvstatus != NV_OK) {
354
    if (nvstatus != NV_OK) {
356
        printk(KERN_ERR NVKMS_LOG_PREFIX "Version mismatch: "
355
        printk(KERN_ERR NVKMS_LOG_PREFIX "Version mismatch: "
357
               "nvidia.ko(%s) nvidia-modeset.ko(%s)\n",
356
               "nvidia.ko(%s) nvidia-modeset.ko(%s)\n",
358
               __rm_ops.version_string, NV_VERSION_STRING);
357
               version_string, NV_VERSION_STRING);
359
        return -EINVAL;
358
        return -EINVAL;
360
    }
359
    }
361
360
362
    ret = __rm_ops.set_callbacks(&nvkms_rm_callbacks);
361
    ret = __rm_ops->set_callbacks(&nvkms_rm_callbacks);
363
    if (ret < 0) {
362
    if (ret < 0) {
364
        printk(KERN_ERR NVKMS_LOG_PREFIX "Failed to register callbacks\n");
363
        printk(KERN_ERR NVKMS_LOG_PREFIX "Failed to register callbacks\n");
365
        return ret;
364
        return ret;
Lines 370-389 Link Here
370
369
371
static void nvkms_free_rm(void)
370
static void nvkms_free_rm(void)
372
{
371
{
373
    __rm_ops.set_callbacks(NULL);
372
    __rm_ops->set_callbacks(NULL);
374
}
373
}
375
374
376
void NVKMS_API_CALL nvkms_call_rm(void *ops)
375
void NVKMS_API_CALL nvkms_call_rm(void *ops)
377
{
376
{
378
    nvidia_modeset_stack_ptr stack = NULL;
377
    nvidia_modeset_stack_ptr stack = NULL;
379
378
380
    if (__rm_ops.alloc_stack(&stack) != 0) {
379
    if (__rm_ops->alloc_stack(&stack) != 0) {
381
        return;
380
        return;
382
    }
381
    }
383
382
384
    __rm_ops.op(stack, ops);
383
    __rm_ops->op(stack, ops);
385
384
386
    __rm_ops.free_stack(stack);
385
    __rm_ops->free_stack(stack);
387
}
386
}
388
387
389
/*************************************************************************
388
/*************************************************************************
Lines 711-723 Link Here
711
    nvidia_modeset_stack_ptr stack = NULL;
710
    nvidia_modeset_stack_ptr stack = NULL;
712
    NvBool ret;
711
    NvBool ret;
713
712
714
    if (__rm_ops.alloc_stack(&stack) != 0) {
713
    if (__rm_ops->alloc_stack(&stack) != 0) {
715
        return NV_FALSE;
714
        return NV_FALSE;
716
    }
715
    }
717
716
718
    ret = __rm_ops.open_gpu(gpuId, stack) == 0;
717
    ret = __rm_ops->open_gpu(gpuId, stack) == 0;
719
718
720
    __rm_ops.free_stack(stack);
719
    __rm_ops->free_stack(stack);
721
720
722
    return ret;
721
    return ret;
723
}
722
}
Lines 726-748 Link Here
726
{
725
{
727
    nvidia_modeset_stack_ptr stack = NULL;
726
    nvidia_modeset_stack_ptr stack = NULL;
728
727
729
    if (__rm_ops.alloc_stack(&stack) != 0) {
728
    if (__rm_ops->alloc_stack(&stack) != 0) {
730
        return;
729
        return;
731
    }
730
    }
732
731
733
    __rm_ops.close_gpu(gpuId, stack);
732
    __rm_ops->close_gpu(gpuId, stack);
734
733
735
    __rm_ops.free_stack(stack);
734
    __rm_ops->free_stack(stack);
736
}
735
}
737
736
738
NvU32 NVKMS_API_CALL nvkms_enumerate_gpus(nv_gpu_info_t *gpu_info)
737
NvU32 NVKMS_API_CALL nvkms_enumerate_gpus(nv_gpu_info_t *gpu_info)
739
{
738
{
740
    return __rm_ops.enumerate_gpus(gpu_info);
739
    return __rm_ops->enumerate_gpus(gpu_info);
741
}
740
}
742
741
743
NvBool NVKMS_API_CALL nvkms_allow_write_combining(void)
742
NvBool NVKMS_API_CALL nvkms_allow_write_combining(void)
744
{
743
{
745
    return __rm_ops.system_info.allow_write_combining;
744
    return __rm_ops->system_info.allow_write_combining;
746
}
745
}
747
746
748
/*************************************************************************
747
/*************************************************************************
(-)work.orig/kernel/nvidia-uvm/uvm8_global.c (-5 / +5 lines)
Lines 42-58 Link Here
42
                                "UVM mode by disabling (0) or enabling (1)");
42
                                "UVM mode by disabling (0) or enabling (1)");
43
43
44
uvm_global_t g_uvm_global;
44
uvm_global_t g_uvm_global;
45
static struct UvmOpsUvmEvents g_exported_uvm8_ops;
45
static struct UvmOpsUvmEvents g_exported_uvm8_ops = {
46
    .startDevice = NULL,
47
    .stopDevice  = NULL,
48
    .isrTopHalf  = uvm8_isr_top_half,
49
};
46
static bool g_ops_registered = false;
50
static bool g_ops_registered = false;
47
51
48
static NV_STATUS uvm8_register_callbacks(void)
52
static NV_STATUS uvm8_register_callbacks(void)
49
{
53
{
50
    NV_STATUS status = NV_OK;
54
    NV_STATUS status = NV_OK;
51
55
52
    g_exported_uvm8_ops.startDevice = NULL;
53
    g_exported_uvm8_ops.stopDevice  = NULL;
54
    g_exported_uvm8_ops.isrTopHalf  = uvm8_isr_top_half;
55
56
    // Register the UVM callbacks with the main GPU driver:
56
    // Register the UVM callbacks with the main GPU driver:
57
    status = uvm_rm_locked_call(nvUvmInterfaceRegisterUvmCallbacks(&g_exported_uvm8_ops));
57
    status = uvm_rm_locked_call(nvUvmInterfaceRegisterUvmCallbacks(&g_exported_uvm8_ops));
58
    if (status != NV_OK)
58
    if (status != NV_OK)
(-)work.orig/kernel/nvidia-uvm/uvm8_gpu_semaphore.c (-1 / +1 lines)
Lines 368-374 Link Here
368
    // being optimized out on non-SMP configs (we need them for interacting with
368
    // being optimized out on non-SMP configs (we need them for interacting with
369
    // the GPU correctly even on non-SMP).
369
    // the GPU correctly even on non-SMP).
370
    mb();
370
    mb();
371
    ACCESS_ONCE(*semaphore->payload) = payload;
371
    ACCESS_ONCE_RW(*semaphore->payload) = payload;
372
}
372
}
373
373
374
// This function is intended to catch channels which have been left dangling in
374
// This function is intended to catch channels which have been left dangling in
(-)work.orig/kernel/nvidia-uvm/uvm8_hal.h (-1 / +1 lines)
Lines 455-461 Link Here
455
        // access_counter_buffer_ops: id is a hardware class
455
        // access_counter_buffer_ops: id is a hardware class
456
        uvm_access_counter_buffer_hal_t access_counter_buffer_ops;
456
        uvm_access_counter_buffer_hal_t access_counter_buffer_ops;
457
    } u;
457
    } u;
458
} uvm_hal_class_ops_t;
458
} __do_const uvm_hal_class_ops_t;
459
459
460
NV_STATUS uvm_hal_init_table(void);
460
NV_STATUS uvm_hal_init_table(void);
461
NV_STATUS uvm_hal_init_gpu(uvm_gpu_t *gpu);
461
NV_STATUS uvm_hal_init_gpu(uvm_gpu_t *gpu);
(-)work.orig/kernel/nvidia-uvm/uvm8_mmu.h (-1 lines)
Lines 24-30 Link Here
24
#ifndef __UVM8_MMU_H__
24
#ifndef __UVM8_MMU_H__
25
#define __UVM8_MMU_H__
25
#define __UVM8_MMU_H__
26
26
27
#include "uvm8_forward_decl.h"
28
#include "uvm8_hal_types.h"
27
#include "uvm8_hal_types.h"
29
#include "uvm8_pmm_gpu.h"
28
#include "uvm8_pmm_gpu.h"
30
#include "uvmtypes.h"
29
#include "uvmtypes.h"
(-)work.orig/kernel/nvidia-uvm/uvm_common.c (-1 lines)
Lines 40-46 Link Here
40
#define UVM_SPIN_LOOP_PRINT_TIMEOUT_SEC     30ULL
40
#define UVM_SPIN_LOOP_PRINT_TIMEOUT_SEC     30ULL
41
41
42
static dev_t g_uvmBaseDev;
42
static dev_t g_uvmBaseDev;
43
struct UvmOpsUvmEvents g_exportedUvmOps;
44
43
45
static char* uvm_driver_mode = "8";
44
static char* uvm_driver_mode = "8";
46
45
(-)work.orig/kernel/nvidia-uvm/uvm_linux.h (-1 / +1 lines)
Lines 429-435 Link Here
429
429
430
// WRITE_ONCE/READ_ONCE have incompatible definitions across versions, which produces warnings.
430
// WRITE_ONCE/READ_ONCE have incompatible definitions across versions, which produces warnings.
431
// Therefore, we define our own macros
431
// Therefore, we define our own macros
432
#define UVM_WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val))
432
#define UVM_WRITE_ONCE(x, val) (ACCESS_ONCE_RW(x) = (val))
433
#define UVM_READ_ONCE(x) ACCESS_ONCE(x)
433
#define UVM_READ_ONCE(x) ACCESS_ONCE(x)
434
434
435
// Added in 3.11
435
// Added in 3.11

Return to bug 650482