From 5b7b59714a6f6ea34295e4827eca68f496f5df18 Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Thu, 8 Oct 2015 10:09:37 -0700 Subject: gpu: nvgpu: add support to remove bar2 mm Adding support to remove bar2 mm on gpu module remove. Change-Id: Id5f680b1abf7056da9871d5460d9fbc40422673e Signed-off-by: Seshendra Gadagottu Reviewed-on: http://git-master/r/814571 (cherry picked from commit e7c6c87dd6b0893d26a9a3b4568121a691e1eb3c) Reviewed-on: http://git-master/r/815429 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a.h | 1 + drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 6 +++++- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index bec2d2a0..b5e8ce9c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -379,6 +379,7 @@ struct gpu_ops { int (*init_mm_setup_hw)(struct gk20a *g); int (*init_bar2_vm)(struct gk20a *g); int (*init_bar2_mm_hw_setup)(struct gk20a *g); + void (*remove_bar2_vm)(struct gk20a *g); const struct gk20a_mmu_level * (*get_mmu_levels)(struct gk20a *g, u32 big_page_size); void (*init_pdb)(struct gk20a *g, void *inst_ptr, u64 pdb_addr); diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 4b06ff3c..859e46fc 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -325,7 +325,7 @@ static int gk20a_init_mm_reset_enable_hw(struct gk20a *g) return 0; } -static void gk20a_remove_vm(struct vm_gk20a *vm, struct mem_desc *inst_block) +void gk20a_remove_vm(struct vm_gk20a *vm, struct mem_desc *inst_block) { struct gk20a *g = vm->mm->g; @@ -337,6 +337,10 @@ static void gk20a_remove_vm(struct vm_gk20a *vm, struct mem_desc *inst_block) static void gk20a_remove_mm_support(struct mm_gk20a *mm) { + struct gk20a *g = gk20a_from_mm(mm); + + if (g->ops.mm.remove_bar2_vm) + g->ops.mm.remove_bar2_vm(g); gk20a_remove_vm(&mm->bar1.vm, &mm->bar1.inst_block); gk20a_remove_vm(&mm->pmu.vm, &mm->pmu.inst_block); gk20a_free_inst_block(gk20a_from_mm(mm), &mm->hwpm.inst_block); diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index c60f1bb7..8f328696 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -649,6 +649,8 @@ const struct gk20a_mmu_level *gk20a_mm_get_mmu_levels(struct gk20a *g, u32 big_page_size); void gk20a_mm_init_pdb(struct gk20a *g, void *inst_ptr, u64 pdb_addr); +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[]; -- cgit v1.2.2