diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index b9678fbb..bb7c7985 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -2929,15 +2929,23 @@ int gk20a_gmmu_alloc_sys(struct gk20a *g, size_t size, struct mem_desc *mem) | |||
2929 | return gk20a_gmmu_alloc_flags_sys(g, 0, size, mem); | 2929 | return gk20a_gmmu_alloc_flags_sys(g, 0, size, mem); |
2930 | } | 2930 | } |
2931 | 2931 | ||
2932 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) | ||
2933 | static void gk20a_dma_flags_to_attrs(unsigned long *attrs, | ||
2934 | unsigned long flags) | ||
2935 | #define ATTR_ARG(x) *x | ||
2936 | #else | ||
2932 | static void gk20a_dma_flags_to_attrs(struct dma_attrs *attrs, | 2937 | static void gk20a_dma_flags_to_attrs(struct dma_attrs *attrs, |
2933 | unsigned long flags) | 2938 | unsigned long flags) |
2939 | #define ATTR_ARG(x) x | ||
2940 | #endif | ||
2934 | { | 2941 | { |
2935 | if (flags & NVGPU_DMA_NO_KERNEL_MAPPING) | 2942 | if (flags & NVGPU_DMA_NO_KERNEL_MAPPING) |
2936 | dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs); | 2943 | dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, ATTR_ARG(attrs)); |
2937 | if (flags & NVGPU_DMA_FORCE_CONTIGUOUS) | 2944 | if (flags & NVGPU_DMA_FORCE_CONTIGUOUS) |
2938 | dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, attrs); | 2945 | dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, ATTR_ARG(attrs)); |
2939 | if (flags & NVGPU_DMA_READ_ONLY) | 2946 | if (flags & NVGPU_DMA_READ_ONLY) |
2940 | dma_set_attr(DMA_ATTR_READ_ONLY, attrs); | 2947 | dma_set_attr(DMA_ATTR_READ_ONLY, ATTR_ARG(attrs)); |
2948 | #undef ATTR_ARG | ||
2941 | } | 2949 | } |
2942 | 2950 | ||
2943 | int gk20a_gmmu_alloc_flags_sys(struct gk20a *g, unsigned long flags, | 2951 | int gk20a_gmmu_alloc_flags_sys(struct gk20a *g, unsigned long flags, |
@@ -2956,12 +2964,14 @@ int gk20a_gmmu_alloc_flags_sys(struct gk20a *g, unsigned long flags, | |||
2956 | 2964 | ||
2957 | if (flags & NVGPU_DMA_NO_KERNEL_MAPPING) { | 2965 | if (flags & NVGPU_DMA_NO_KERNEL_MAPPING) { |
2958 | mem->pages = dma_alloc_attrs(d, | 2966 | mem->pages = dma_alloc_attrs(d, |
2959 | size, &iova, GFP_KERNEL, &dma_attrs); | 2967 | size, &iova, GFP_KERNEL, |
2968 | __DMA_ATTR(dma_attrs)); | ||
2960 | if (!mem->pages) | 2969 | if (!mem->pages) |
2961 | return -ENOMEM; | 2970 | return -ENOMEM; |
2962 | } else { | 2971 | } else { |
2963 | mem->cpu_va = dma_alloc_attrs(d, | 2972 | mem->cpu_va = dma_alloc_attrs(d, |
2964 | size, &iova, GFP_KERNEL, &dma_attrs); | 2973 | size, &iova, GFP_KERNEL, |
2974 | __DMA_ATTR(dma_attrs)); | ||
2965 | if (!mem->cpu_va) | 2975 | if (!mem->cpu_va) |
2966 | return -ENOMEM; | 2976 | return -ENOMEM; |
2967 | } | 2977 | } |
@@ -3009,11 +3019,11 @@ static void gk20a_gmmu_free_sys(struct gk20a *g, struct mem_desc *mem) | |||
3009 | if (mem->flags & NVGPU_DMA_NO_KERNEL_MAPPING) { | 3019 | if (mem->flags & NVGPU_DMA_NO_KERNEL_MAPPING) { |
3010 | dma_free_attrs(d, mem->size, mem->pages, | 3020 | dma_free_attrs(d, mem->size, mem->pages, |
3011 | sg_dma_address(mem->sgt->sgl), | 3021 | sg_dma_address(mem->sgt->sgl), |
3012 | &dma_attrs); | 3022 | __DMA_ATTR(dma_attrs)); |
3013 | } else { | 3023 | } else { |
3014 | dma_free_attrs(d, mem->size, mem->cpu_va, | 3024 | dma_free_attrs(d, mem->size, mem->cpu_va, |
3015 | sg_dma_address(mem->sgt->sgl), | 3025 | sg_dma_address(mem->sgt->sgl), |
3016 | &dma_attrs); | 3026 | __DMA_ATTR(dma_attrs)); |
3017 | } | 3027 | } |
3018 | } else { | 3028 | } else { |
3019 | dma_free_coherent(d, mem->size, mem->cpu_va, | 3029 | dma_free_coherent(d, mem->size, mem->cpu_va, |