From 60b655330a233fd0ea1ab97341e025284d55186f Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 10 Oct 2017 12:28:02 -0700 Subject: gpu: nvgpu: Remove SGL reference from mm_gk20a.c Remove an SGL reference from the mm_gk20a.c code. This code is common code and as such all linuxisms need to be fixed. It just so happens that this particular function is only used by the CDE code which is only present in Linux. So simply move this function over to the CDE code. JIRA NVGPU-30 JIRA NVGPU-225 JIRA NVGPU-226 Change-Id: Ifb0cb427c742c6d9cada382ace4a52f52474c379 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1576436 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/common/linux/cde.c | 21 ++++++++++++++++++--- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 15 --------------- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 1 - 3 files changed, 18 insertions(+), 19 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c index 0c52271a..2832408d 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.c +++ b/drivers/gpu/nvgpu/common/linux/cde.c @@ -57,6 +57,21 @@ static struct gk20a_cde_ctx *gk20a_cde_allocate_context(struct nvgpu_os_linux *l #define MAX_CTX_USE_COUNT 42 #define MAX_CTX_RETRY_TIME 2000 +static dma_addr_t gpuva_to_iova_base(struct vm_gk20a *vm, u64 gpu_vaddr) +{ + struct nvgpu_mapped_buf *buffer; + dma_addr_t addr = 0; + struct gk20a *g = gk20a_from_vm(vm); + + nvgpu_mutex_acquire(&vm->update_gmmu_lock); + buffer = __nvgpu_vm_find_mapped_buf(vm, gpu_vaddr); + if (buffer) + addr = nvgpu_mem_get_addr_sgl(g, buffer->sgt->sgl); + nvgpu_mutex_release(&vm->update_gmmu_lock); + + return addr; +} + static void gk20a_deinit_cde_img(struct gk20a_cde_ctx *cde_ctx) { unsigned int i; @@ -419,8 +434,8 @@ static int gk20a_cde_patch_params(struct gk20a_cde_ctx *cde_ctx) new_data = g->gr.compbit_store.mem.size; break; case TYPE_PARAM_SOURCE_SMMU_ADDR: - new_data = gk20a_mm_gpuva_to_iova_base(cde_ctx->vm, - cde_ctx->surf_vaddr); + new_data = gpuva_to_iova_base(cde_ctx->vm, + cde_ctx->surf_vaddr); if (new_data == 0) return -EINVAL; break; @@ -1100,7 +1115,7 @@ __releases(&l->cde_app->mutex) /* store surface vaddr. This is actually compbit vaddr, but since compbits live in the same surface, and we can get the alloc base - address by using gk20a_mm_gpuva_to_iova_base, this will do */ + address by using gpuva_to_iova_base, this will do */ cde_ctx->surf_vaddr = map_vaddr; /* store information about destination */ diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 32c74f3a..670e16d0 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -717,21 +717,6 @@ int setup_buffer_kind_and_compression(struct vm_gk20a *vm, return 0; } -dma_addr_t gk20a_mm_gpuva_to_iova_base(struct vm_gk20a *vm, u64 gpu_vaddr) -{ - struct nvgpu_mapped_buf *buffer; - dma_addr_t addr = 0; - struct gk20a *g = gk20a_from_vm(vm); - - nvgpu_mutex_acquire(&vm->update_gmmu_lock); - buffer = __nvgpu_vm_find_mapped_buf(vm, gpu_vaddr); - if (buffer) - addr = nvgpu_mem_get_addr_sgl(g, buffer->sgt->sgl); - nvgpu_mutex_release(&vm->update_gmmu_lock); - - return addr; -} - /* for gk20a the "video memory" apertures here are misnomers. */ static inline u32 big_valid_pde0_bits(struct gk20a *g, struct nvgpu_gmmu_pd *pd, u64 addr) diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index 3a8fea45..448496f5 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -383,7 +383,6 @@ int __gk20a_vm_bind_channel(struct vm_gk20a *vm, struct channel_gk20a *ch); void gk20a_get_comptags(struct device *dev, struct dma_buf *dmabuf, struct gk20a_comptags *comptags); -dma_addr_t gk20a_mm_gpuva_to_iova_base(struct vm_gk20a *vm, u64 gpu_vaddr); int gk20a_dmabuf_alloc_drvdata(struct dma_buf *dmabuf, struct device *dev); -- cgit v1.2.2