diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 28 |
3 files changed, 33 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 643adca5..c12f196d 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -2155,7 +2155,7 @@ static int gk20a_ioctl_channel_submit_gpfifo( | |||
2155 | * synchronization; we might still wait and do an increment */ | 2155 | * synchronization; we might still wait and do an increment */ |
2156 | size = args->num_entries * sizeof(struct nvgpu_gpfifo); | 2156 | size = args->num_entries * sizeof(struct nvgpu_gpfifo); |
2157 | if (size) { | 2157 | if (size) { |
2158 | gpfifo = vmalloc(size); | 2158 | gpfifo = nvgpu_alloc(size, false); |
2159 | if (!gpfifo) | 2159 | if (!gpfifo) |
2160 | return -ENOMEM; | 2160 | return -ENOMEM; |
2161 | 2161 | ||
@@ -2190,7 +2190,7 @@ static int gk20a_ioctl_channel_submit_gpfifo( | |||
2190 | gk20a_fence_put(fence_out); | 2190 | gk20a_fence_put(fence_out); |
2191 | 2191 | ||
2192 | clean_up: | 2192 | clean_up: |
2193 | vfree(gpfifo); | 2193 | nvgpu_free(gpfifo); |
2194 | return ret; | 2194 | return ret; |
2195 | } | 2195 | } |
2196 | 2196 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index a38db709..342d3ace 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -745,8 +745,8 @@ int gk20a_vm_get_buffers(struct vm_gk20a *vm, | |||
745 | 745 | ||
746 | mutex_lock(&vm->update_gmmu_lock); | 746 | mutex_lock(&vm->update_gmmu_lock); |
747 | 747 | ||
748 | buffer_list = kzalloc(sizeof(*buffer_list) * | 748 | buffer_list = nvgpu_alloc(sizeof(*buffer_list) * |
749 | vm->num_user_mapped_buffers, GFP_KERNEL); | 749 | vm->num_user_mapped_buffers, true); |
750 | if (!buffer_list) { | 750 | if (!buffer_list) { |
751 | mutex_unlock(&vm->update_gmmu_lock); | 751 | mutex_unlock(&vm->update_gmmu_lock); |
752 | return -ENOMEM; | 752 | return -ENOMEM; |
@@ -795,7 +795,7 @@ void gk20a_vm_put_buffers(struct vm_gk20a *vm, | |||
795 | 795 | ||
796 | mutex_unlock(&vm->update_gmmu_lock); | 796 | mutex_unlock(&vm->update_gmmu_lock); |
797 | 797 | ||
798 | kfree(mapped_buffers); | 798 | nvgpu_free(mapped_buffers); |
799 | } | 799 | } |
800 | 800 | ||
801 | static void gk20a_vm_unmap_user(struct vm_gk20a *vm, u64 offset) | 801 | static void gk20a_vm_unmap_user(struct vm_gk20a *vm, u64 offset) |
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index 82003cd0..7a627354 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/dma-attrs.h> | 22 | #include <linux/dma-attrs.h> |
23 | #include <linux/iommu.h> | 23 | #include <linux/iommu.h> |
24 | #include <linux/tegra-soc.h> | 24 | #include <linux/tegra-soc.h> |
25 | #include <linux/vmalloc.h> | ||
25 | #include <asm/dma-iommu.h> | 26 | #include <asm/dma-iommu.h> |
26 | #include <asm/cacheflush.h> | 27 | #include <asm/cacheflush.h> |
27 | #include "gk20a_allocator.h" | 28 | #include "gk20a_allocator.h" |
@@ -628,4 +629,31 @@ void gk20a_mm_init_pdb(struct gk20a *g, void *inst_ptr, u64 pdb_addr); | |||
628 | extern const struct gk20a_mmu_level gk20a_mm_levels_64k[]; | 629 | extern const struct gk20a_mmu_level gk20a_mm_levels_64k[]; |
629 | extern const struct gk20a_mmu_level gk20a_mm_levels_128k[]; | 630 | extern const struct gk20a_mmu_level gk20a_mm_levels_128k[]; |
630 | 631 | ||
632 | static inline void *nvgpu_alloc(size_t size, bool clear) | ||
633 | { | ||
634 | void *p; | ||
635 | |||
636 | if (size > PAGE_SIZE) { | ||
637 | if (clear) | ||
638 | p = vzalloc(size); | ||
639 | else | ||
640 | p = vmalloc(size); | ||
641 | } else { | ||
642 | if (clear) | ||
643 | p = kzalloc(size, GFP_KERNEL); | ||
644 | else | ||
645 | p = kmalloc(size, GFP_KERNEL); | ||
646 | } | ||
647 | |||
648 | return p; | ||
649 | } | ||
650 | |||
651 | static inline void nvgpu_free(void *p) | ||
652 | { | ||
653 | if (virt_addr_valid(p)) | ||
654 | kfree(p); | ||
655 | else | ||
656 | vfree(p); | ||
657 | } | ||
658 | |||
631 | #endif /* MM_GK20A_H */ | 659 | #endif /* MM_GK20A_H */ |