From 6df3992b60959d32c7113cb77e131a2547174f3a Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 20 Dec 2016 13:55:48 -0800 Subject: gpu: nvgpu: Move allocators to common/mm/ Move the GPU allocators to common/mm/ since the allocators are common code across all GPUs. Also rename the allocator code to move away from gk20a_ prefixed structs and functions. This caused one issue with the nvgpu_alloc() and nvgpu_free() functions. There was a function for allocating either with kmalloc() or vmalloc() depending on the size of the allocation. Those have now been renamed to nvgpu_kalloc() and nvgpu_kfree(). Bug 1799159 Change-Id: Iddda92c013612bcb209847084ec85b8953002fa5 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1274400 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index d32e121a..f58b5df5 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -27,7 +27,8 @@ #include #include #include -#include "gk20a_allocator.h" + +#include #ifdef CONFIG_ARM64 #define outer_flush_range(a, b) @@ -70,7 +71,7 @@ struct mem_desc { u64 gpu_va; bool fixed; /* vidmem only */ bool user_mem; /* vidmem only */ - struct gk20a_allocator *allocator; /* vidmem only */ + struct nvgpu_allocator *allocator; /* vidmem only */ struct list_head clear_list_entry; /* vidmem only */ bool skip_wmb; }; @@ -295,10 +296,10 @@ struct vm_gk20a { struct gk20a_mm_entry pdb; - struct gk20a_allocator vma[gmmu_nr_page_sizes]; + struct nvgpu_allocator vma[gmmu_nr_page_sizes]; /* If necessary, split fixed from non-fixed. */ - struct gk20a_allocator fixed; + struct nvgpu_allocator fixed; struct rb_root mapped_buffers; @@ -421,8 +422,8 @@ struct mm_gk20a { size_t bootstrap_size; u64 bootstrap_base; - struct gk20a_allocator allocator; - struct gk20a_allocator bootstrap_allocator; + struct nvgpu_allocator allocator; + struct nvgpu_allocator bootstrap_allocator; u32 ce_ctx_id; volatile bool cleared; @@ -470,13 +471,13 @@ static inline u64 __nv_gmmu_va_small_page_limit(void) static inline int __nv_gmmu_va_is_big_page_region(struct vm_gk20a *vm, u64 addr) { - struct gk20a_allocator *a = &vm->vma[gmmu_page_size_big]; + struct nvgpu_allocator *a = &vm->vma[gmmu_page_size_big]; if (!vm->big_pages) return 0; - return addr >= gk20a_alloc_base(a) && - addr < gk20a_alloc_base(a) + gk20a_alloc_length(a); + return addr >= nvgpu_alloc_base(a) && + addr < nvgpu_alloc_base(a) + nvgpu_alloc_length(a); } /* @@ -825,7 +826,7 @@ void gk20a_remove_vm(struct vm_gk20a *vm, struct mem_desc *inst_block); extern const struct gk20a_mmu_level gk20a_mm_levels_64k[]; extern const struct gk20a_mmu_level gk20a_mm_levels_128k[]; -static inline void *nvgpu_alloc(size_t size, bool clear) +static inline void *nvgpu_kalloc(size_t size, bool clear) { void *p; @@ -844,7 +845,7 @@ static inline void *nvgpu_alloc(size_t size, bool clear) return p; } -static inline void nvgpu_free(void *p) +static inline void nvgpu_kfree(void *p) { if (virt_addr_valid(p)) kfree(p); -- cgit v1.2.2