From c86f185d1022de18a1a1073aa91d2b06aa59e2fc Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 16 Aug 2018 14:47:01 -0700 Subject: gpu: nvgpu: Move programming of debug page to FB Debug page was allocated and programmed to HUB MMU in GR code. This introduces a dependency from GR to FB and is anyway the wrong place. Move the code to allocate memory to generic MM code, and the code to program the addresses to FB. Change-Id: Ib6d3c96efde6794cf5e8cd4c908525c85b57c233 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1801423 Reviewed-by: svc-misra-checker GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/mm.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'drivers/gpu/nvgpu/common/mm/mm.c') diff --git a/drivers/gpu/nvgpu/common/mm/mm.c b/drivers/gpu/nvgpu/common/mm/mm.c index 54f621ae..988b1e5c 100644 --- a/drivers/gpu/nvgpu/common/mm/mm.c +++ b/drivers/gpu/nvgpu/common/mm/mm.c @@ -173,6 +173,9 @@ static void nvgpu_remove_mm_support(struct mm_gk20a *mm) { struct gk20a *g = gk20a_from_mm(mm); + nvgpu_dma_free(g, &mm->mmu_wr_mem); + nvgpu_dma_free(g, &mm->mmu_rd_mem); + if (g->ops.mm.fault_info_mem_destroy) { g->ops.mm.fault_info_mem_destroy(g); } @@ -294,6 +297,32 @@ static int nvgpu_init_ce_vm(struct mm_gk20a *mm) return 0; } +static int nvgpu_init_mmu_debug(struct mm_gk20a *mm) +{ + struct gk20a *g = gk20a_from_mm(mm); + int err; + + if (!nvgpu_mem_is_valid(&mm->mmu_wr_mem)) { + err = nvgpu_dma_alloc_sys(g, SZ_4K, &mm->mmu_wr_mem); + if (err) { + goto err; + } + } + + if (!nvgpu_mem_is_valid(&mm->mmu_rd_mem)) { + err = nvgpu_dma_alloc_sys(g, SZ_4K, &mm->mmu_rd_mem); + if (err) { + goto err_free_wr_mem; + } + } + return 0; + + err_free_wr_mem: + nvgpu_dma_free(g, &mm->mmu_wr_mem); + err: + return -ENOMEM; +} + void nvgpu_init_mm_ce_context(struct gk20a *g) { #if defined(CONFIG_GK20A_VIDMEM) @@ -459,6 +488,10 @@ static int nvgpu_init_mm_setup_sw(struct gk20a *g) return err; } + err = nvgpu_init_mmu_debug(mm); + if (err) + return err; + mm->remove_support = nvgpu_remove_mm_support; mm->remove_ce_support = nvgpu_remove_mm_ce_support; -- cgit v1.2.2