void-packages/srcpkgs/nvidia340/files/usercopy.patch
Joseph Benden 4dafc46a93 nvidia340: redo kernel patch
Fixes: #19199 (nvidia340: broken with linux5.4)
Signed-off-by: Joseph Benden <joe@benden.us>
2020-02-16 22:39:50 +01:00

33 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");