void-packages/srcpkgs/nvidia340/files/usercopy.patch

34 lines
1.2 KiB
Diff

--- a/kernel/nv-linux.h
+++ b/kernel/nv-linux.h
@@ -1190,7 +1190,8 @@ typedef void irqreturn_t;
#ifndef PCI_CAP_ID_EXP
#define PCI_CAP_ID_EXP 0x10
#endif
-
+#define NV_KMEM_CACHE_CREATE_FULL_USERCOPY(name, size, align, flags, useroffset, usersize, ctor) \
+ kmem_cache_create_usercopy(name, size, align, flags, useroffset, usersize, ctor)
/*
* On Linux on PPC64LE enable basic support for Linux PCI error recovery (see
* Documentation/PCI/pci-error-recovery.txt). Currently RM only supports error
@@ -1199,6 +1200,9 @@ typedef void irqreturn_t;
#if defined(NVCPU_PPC64LE)
#define NV_PCI_ERROR_RECOVERY
#define NV_PCI_ERS_BUFFER_SIZE 0x1000
#endif
+#define NV_KMEM_CACHE_CREATE_USERCOPY(name, type) \
+ NV_KMEM_CACHE_CREATE_FULL_USERCOPY(name, sizeof(type), 0, 0, 0, sizeof(type), NULL)
+
/*
--- a/kernel/nv.c
+++ b/kernel/nv.c
@@ -752,7 +752,7 @@ int __init nvidia_init_module(void)
NV_SPIN_LOCK_INIT(&km_lock);
#endif
- NV_KMEM_CACHE_CREATE(nv_stack_t_cache, NV_STACK_CACHE_STR, nv_stack_t);
+ nv_stack_t_cache = NV_KMEM_CACHE_CREATE_USERCOPY(NV_STACK_CACHE_STR, nv_stack_t);
if (nv_stack_t_cache == NULL)
{
nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n");