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 1189-1195 extern void *nvidia_stack_t_cache; Link Here
1189
#if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
1189
#if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
1190
#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \
1190
#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \
1191
    kmem_cache_create(name, size, align, flags, ctor)
1191
    kmem_cache_create(name, size, align, flags, ctor)
1192
1192
#define NV_KMEM_CACHE_CREATE_FULL_USERCOPY(name, size, align, flags, useroffset, usersize, ctor) \
1193
    kmem_cache_create_usercopy(name, size, align, flags, useroffset, usersize, ctor)
1193
#else
1194
#else
1194
#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \
1195
#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \
1195
    kmem_cache_create(name, size, align, flags, ctor, NULL)
1196
    kmem_cache_create(name, size, align, flags, ctor, NULL)
Lines 1198-1203 extern void *nvidia_stack_t_cache; Link Here
1198
#define NV_KMEM_CACHE_CREATE(name, type)    \
1199
#define NV_KMEM_CACHE_CREATE(name, type)    \
1199
    NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, 0, NULL)
1200
    NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, 0, NULL)
1200
1201
1202
#ifdef SLAB_USERCOPY
1203
#define NV_KMEM_CACHE_CREATE_USERCOPY(name, type)    \
1204
    NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, SLAB_USERCOPY, NULL)
1205
#else
1206
#define NV_KMEM_CACHE_CREATE_USERCOPY(name, type)    \
1207
    NV_KMEM_CACHE_CREATE_FULL_USERCOPY(name, sizeof(type), 0, 0, 0, sizeof(type), NULL)
1208
#endif
1209
1201
#define NV_KMEM_CACHE_DESTROY(kmem_cache)   \
1210
#define NV_KMEM_CACHE_DESTROY(kmem_cache)   \
1202
    kmem_cache_destroy(kmem_cache)
1211
    kmem_cache_destroy(kmem_cache)
1203
1212
(-)work.orig/kernel/common/inc/nv-modeset-interface.h (-3 / +3 lines)
Lines 72-78 typedef struct { 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 typedef struct { 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 typedef struct nvidia_module_s { 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 682-688 int __init nvidia_init_module(void) Link Here
682
682
683
    nv_memdbg_init();
683
    nv_memdbg_init();
684
684
685
    nvidia_stack_t_cache = NV_KMEM_CACHE_CREATE(nvidia_stack_cache_name,
685
    nvidia_stack_t_cache = NV_KMEM_CACHE_CREATE_USERCOPY(nvidia_stack_cache_name,
686
                                                nvidia_stack_t);
686
                                                nvidia_stack_t);
687
    if (nvidia_stack_t_cache == NULL)
687
    if (nvidia_stack_t_cache == NULL)
688
    {
688
    {
(-)work.orig/kernel/nvidia/nv-chrdev.c (-2 lines)
Lines 20-27 int nv_register_chrdev(void *param) 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 struct pci_driver nv_pci_driver = { 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 102-113 nvidia_vma_release(struct vm_area_struct Link Here
102
}
102
}
103
103
104
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_ACCESS)
104
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_ACCESS)
105
static int
105
static ssize_t
106
nvidia_vma_access(
106
nvidia_vma_access(
107
    struct vm_area_struct *vma,
107
    struct vm_area_struct *vma,
108
    unsigned long addr,
108
    unsigned long addr,
109
    void *buffer,
109
    void *buffer,
110
    int length,
110
    size_t length,
111
    int write
111
    int write
112
)
112
)
113
{
113
{
(-)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 static NvU32 nvidia_modeset_enumerate_gp 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 NV_STATUS nvidia_get_rm_ops(nvidia_modes 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 (+2 lines)
Lines 771-776 static void nvidia_update_drm_driver_fea Link Here
771
        return;
771
        return;
772
    }
772
    }
773
773
774
    pax_open_kernel();
774
    nv_drm_driver.driver_features |= DRIVER_MODESET | DRIVER_ATOMIC;
775
    nv_drm_driver.driver_features |= DRIVER_MODESET | DRIVER_ATOMIC;
775
776
776
    nv_drm_driver.master_set       = nvidia_drm_master_set;
777
    nv_drm_driver.master_set       = nvidia_drm_master_set;
Lines 781-786 static void nvidia_update_drm_driver_fea Link Here
781
    nv_drm_driver.dumb_destroy     = drm_gem_dumb_destroy;
782
    nv_drm_driver.dumb_destroy     = drm_gem_dumb_destroy;
782
783
783
    nv_drm_driver.gem_vm_ops       = &nv_drm_gem_vma_ops;
784
    nv_drm_driver.gem_vm_ops       = &nv_drm_gem_vma_ops;
785
    pax_close_kernel();
784
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
786
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
785
}
787
}
786
788
(-)work.orig/kernel/nvidia-modeset/nvidia-modeset-linux.c (-20 / +19 lines)
Lines 341-369 static void nvkms_resume(NvU32 gpuId) Link Here
341
 * Interface with resman.
341
 * Interface with resman.
342
 *************************************************************************/
342
 *************************************************************************/
343
343
344
static nvidia_modeset_rm_ops_t __rm_ops = { 0 };
344
static const nvidia_modeset_rm_ops_t *__rm_ops;
345
static nvidia_modeset_callbacks_t nvkms_rm_callbacks = {
345
static nvidia_modeset_callbacks_t nvkms_rm_callbacks = {
346
    .suspend = nvkms_suspend,
346
    .suspend = nvkms_suspend,
347
    .resume  = nvkms_resume
347
    .resume = nvkms_resume
348
};
348
};
349
349
350
static int nvkms_alloc_rm(void)
350
static int nvkms_alloc_rm(void)
351
{
351
{
352
    NV_STATUS nvstatus;
352
    NV_STATUS nvstatus;
353
    int ret;
353
    int ret;
354
    const char *version_string = NV_VERSION_STRING;
354
355
355
    __rm_ops.version_string = NV_VERSION_STRING;
356
    nvstatus = nvidia_get_rm_ops(&__rm_ops, &version_string);
356
357
    nvstatus = nvidia_get_rm_ops(&__rm_ops);
358
357
359
    if (nvstatus != NV_OK) {
358
    if (nvstatus != NV_OK) {
360
        printk(KERN_ERR NVKMS_LOG_PREFIX "Version mismatch: "
359
        printk(KERN_ERR NVKMS_LOG_PREFIX "Version mismatch: "
361
               "nvidia.ko(%s) nvidia-modeset.ko(%s)\n",
360
               "nvidia.ko(%s) nvidia-modeset.ko(%s)\n",
362
               __rm_ops.version_string, NV_VERSION_STRING);
361
               version_string, NV_VERSION_STRING);
363
        return -EINVAL;
362
        return -EINVAL;
364
    }
363
    }
365
364
366
    ret = __rm_ops.set_callbacks(&nvkms_rm_callbacks);
365
    ret = __rm_ops->set_callbacks(&nvkms_rm_callbacks);
367
    if (ret < 0) {
366
    if (ret < 0) {
368
        printk(KERN_ERR NVKMS_LOG_PREFIX "Failed to register callbacks\n");
367
        printk(KERN_ERR NVKMS_LOG_PREFIX "Failed to register callbacks\n");
369
        return ret;
368
        return ret;
Lines 374-393 static int nvkms_alloc_rm(void) Link Here
374
373
375
static void nvkms_free_rm(void)
374
static void nvkms_free_rm(void)
376
{
375
{
377
    __rm_ops.set_callbacks(NULL);
376
    __rm_ops->set_callbacks(NULL);
378
}
377
}
379
378
380
void NVKMS_API_CALL nvkms_call_rm(void *ops)
379
void NVKMS_API_CALL nvkms_call_rm(void *ops)
381
{
380
{
382
    nvidia_modeset_stack_ptr stack = NULL;
381
    nvidia_modeset_stack_ptr stack = NULL;
383
382
384
    if (__rm_ops.alloc_stack(&stack) != 0) {
383
    if (__rm_ops->alloc_stack(&stack) != 0) {
385
        return;
384
        return;
386
    }
385
    }
387
386
388
    __rm_ops.op(stack, ops);
387
    __rm_ops->op(stack, ops);
389
388
390
    __rm_ops.free_stack(stack);
389
    __rm_ops->free_stack(stack);
391
}
390
}
392
391
393
/*************************************************************************
392
/*************************************************************************
Lines 723-735 NvBool NVKMS_API_CALL nvkms_open_gpu(NvU Link Here
723
    nvidia_modeset_stack_ptr stack = NULL;
722
    nvidia_modeset_stack_ptr stack = NULL;
724
    NvBool ret;
723
    NvBool ret;
725
724
726
    if (__rm_ops.alloc_stack(&stack) != 0) {
725
    if (__rm_ops->alloc_stack(&stack) != 0) {
727
        return NV_FALSE;
726
        return NV_FALSE;
728
    }
727
    }
729
728
730
    ret = __rm_ops.open_gpu(gpuId, stack) == 0;
729
    ret = __rm_ops->open_gpu(gpuId, stack) == 0;
731
730
732
    __rm_ops.free_stack(stack);
731
    __rm_ops->free_stack(stack);
733
732
734
    return ret;
733
    return ret;
735
}
734
}
Lines 738-760 void NVKMS_API_CALL nvkms_close_gpu(NvU3 Link Here
738
{
737
{
739
    nvidia_modeset_stack_ptr stack = NULL;
738
    nvidia_modeset_stack_ptr stack = NULL;
740
739
741
    if (__rm_ops.alloc_stack(&stack) != 0) {
740
    if (__rm_ops->alloc_stack(&stack) != 0) {
742
        return;
741
        return;
743
    }
742
    }
744
743
745
    __rm_ops.close_gpu(gpuId, stack);
744
    __rm_ops->close_gpu(gpuId, stack);
746
745
747
    __rm_ops.free_stack(stack);
746
    __rm_ops->free_stack(stack);
748
}
747
}
749
748
750
NvU32 NVKMS_API_CALL nvkms_enumerate_gpus(nv_gpu_info_t *gpu_info)
749
NvU32 NVKMS_API_CALL nvkms_enumerate_gpus(nv_gpu_info_t *gpu_info)
751
{
750
{
752
    return __rm_ops.enumerate_gpus(gpu_info);
751
    return __rm_ops->enumerate_gpus(gpu_info);
753
}
752
}
754
753
755
NvBool NVKMS_API_CALL nvkms_allow_write_combining(void)
754
NvBool NVKMS_API_CALL nvkms_allow_write_combining(void)
756
{
755
{
757
    return __rm_ops.system_info.allow_write_combining;
756
    return __rm_ops->system_info.allow_write_combining;
758
}
757
}
759
758
760
/*************************************************************************
759
/*************************************************************************
(-)work.orig/kernel/nvidia-uvm/uvm8_global.c (-5 / +5 lines)
Lines 35-51 Link Here
35
#include "nv_uvm_interface.h"
35
#include "nv_uvm_interface.h"
36
36
37
uvm_global_t g_uvm_global;
37
uvm_global_t g_uvm_global;
38
static struct UvmOpsUvmEvents g_exported_uvm8_ops;
38
static struct UvmOpsUvmEvents g_exported_uvm8_ops = {
39
    .startDevice = NULL,
40
    .stopDevice  = NULL,
41
    .isrTopHalf  = uvm8_isr_top_half,
42
};
39
static bool g_ops_registered = false;
43
static bool g_ops_registered = false;
40
44
41
static NV_STATUS uvm8_register_callbacks(void)
45
static NV_STATUS uvm8_register_callbacks(void)
42
{
46
{
43
    NV_STATUS status = NV_OK;
47
    NV_STATUS status = NV_OK;
44
48
45
    g_exported_uvm8_ops.startDevice = NULL;
46
    g_exported_uvm8_ops.stopDevice  = NULL;
47
    g_exported_uvm8_ops.isrTopHalf  = uvm8_isr_top_half;
48
49
    // Register the UVM callbacks with the main GPU driver:
49
    // Register the UVM callbacks with the main GPU driver:
50
    status = uvm_rm_locked_call(nvUvmInterfaceRegisterUvmCallbacks(&g_exported_uvm8_ops));
50
    status = uvm_rm_locked_call(nvUvmInterfaceRegisterUvmCallbacks(&g_exported_uvm8_ops));
51
    if (status != NV_OK)
51
    if (status != NV_OK)
(-)work.orig/kernel/nvidia-uvm/uvm8_gpu_semaphore.c (-1 / +1 lines)
Lines 368-374 void uvm_gpu_semaphore_set_payload(uvm_g 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 429-435 typedef struct Link Here
429
        // access_counter_buffer_ops: id is a hardware class
429
        // access_counter_buffer_ops: id is a hardware class
430
        uvm_access_counter_buffer_hal_t access_counter_buffer_ops;
430
        uvm_access_counter_buffer_hal_t access_counter_buffer_ops;
431
    } u;
431
    } u;
432
} uvm_hal_class_ops_t;
432
} __do_const uvm_hal_class_ops_t;
433
433
434
NV_STATUS uvm_hal_init_table(void);
434
NV_STATUS uvm_hal_init_table(void);
435
NV_STATUS uvm_hal_init_gpu(uvm_gpu_t *gpu);
435
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 436-442 static inline NvU64 NV_GETTIME(void) Link Here
436
436
437
// WRITE_ONCE/READ_ONCE have incompatible definitions across versions, which produces warnings.
437
// WRITE_ONCE/READ_ONCE have incompatible definitions across versions, which produces warnings.
438
// Therefore, we define our own macros
438
// Therefore, we define our own macros
439
#define UVM_WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val))
439
#define UVM_WRITE_ONCE(x, val) (ACCESS_ONCE_RW(x) = (val))
440
#define UVM_READ_ONCE(x) ACCESS_ONCE(x)
440
#define UVM_READ_ONCE(x) ACCESS_ONCE(x)
441
441
442
// Added in 3.11
442
// Added in 3.11

Return to bug 650482