--- nvidia-uvm/uvm_linux.h.dist 2016-06-16 04:54:42.573247324 -0400 +++ nvidia-uvm/uvm_linux.h 2016-06-16 17:23:29.863108182 -0400 @@ -185,7 +185,11 @@ #define __GFP_NORETRY 0 #endif -#define NV_UVM_GFP_FLAGS (GFP_KERNEL | __GFP_NORETRY) +#if !defined(__GFP_USERCOPY) +#define __GFP_USERCOPY 0 +#endif + +#define NV_UVM_GFP_FLAGS (GFP_KERNEL | __GFP_NORETRY | __GFP_USERCOPY) #if defined(NV_VM_INSERT_PAGE_PRESENT) #define NV_VM_INSERT_PAGE(vma, addr, page) \ --- nvidia/nv-vm.c.dist 2016-06-09 20:37:13.000000000 -0400 +++ nvidia/nv-vm.c 2016-06-16 17:32:51.357212907 -0400 @@ -265,6 +265,9 @@ if (at->flags & NV_ALLOC_TYPE_ZEROED) gfp_mask |= __GFP_ZERO; #endif +#if defined(__GPF_USERCOPY) + gfp_mask |= __GFP_USERCOPY; +#endif return gfp_mask; } --- common/inc/nv-linux.h.dist 2016-06-16 04:49:57.775133204 -0400 +++ common/inc/nv-linux.h 2016-06-16 18:36:13.760153738 -0400 @@ -412,12 +412,16 @@ #define __GFP_COMP 0 #endif +#if !defined(GFP_USERCOPY) +#define GPF_USERCOPY 0 +#endif + #if !defined(DEBUG) && defined(__GFP_NOWARN) -#define NV_GFP_KERNEL (GFP_KERNEL | __GFP_NOWARN) -#define NV_GFP_ATOMIC (GFP_ATOMIC | __GFP_NOWARN) +#define NV_GFP_KERNEL (GFP_KERNEL | __GFP_NOWARN | GFP_USERCOPY) +#define NV_GFP_ATOMIC (GFP_ATOMIC | __GFP_NOWARN | GFP_USERCOPY) #else -#define NV_GFP_KERNEL (GFP_KERNEL) -#define NV_GFP_ATOMIC (GFP_ATOMIC) +#define NV_GFP_KERNEL (GFP_KERNEL | GFP_USERCOPY) +#define NV_GFP_ATOMIC (GFP_ATOMIC | GFP_USERCOPY) #endif #if defined(GFP_DMA32) @@ -427,9 +431,9 @@ * such as Linux/x86-64; the alternative is to use an IOMMU such * as the one implemented with the K8 GART, if available. */ -#define NV_GFP_DMA32 (NV_GFP_KERNEL | GFP_DMA32) +#define NV_GFP_DMA32 (NV_GFP_KERNEL | GFP_DMA32 | GFP_USERCOPY) #else -#define NV_GFP_DMA32 (NV_GFP_KERNEL) +#define NV_GFP_DMA32 (NV_GFP_KERNEL | GFP_USERCOPY) #endif #if defined(NVCPU_X86) || defined(NVCPU_X86_64) @@ -1307,8 +1311,12 @@ kmem_cache_create(name, size, align, flags, ctor, NULL) #endif +#if !defined(SLAB_USERCOPY) +#define SLAB_USERCOPY 0 +#endif + #define NV_KMEM_CACHE_CREATE(name, type) \ - NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, 0, NULL) + NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, SLAB_USERCOPY, NULL) #define NV_KMEM_CACHE_DESTROY(kmem_cache) \ kmem_cache_destroy(kmem_cache)