From 3877adcd656e8e4329e2c4250119de2256f30730 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Wed, 14 Jan 2015 14:04:08 +0200 Subject: gpu: nvgpu: add hw perfmon buffer mapping ioctls Map/unmap buffers for HWPM and deal with its instance block, the minimum work required to run the HWPM via regops from userspace. Bug 1517458 Bug 1573150 Change-Id: If14086a88b54bf434843d7c2fee8a9113023a3b0 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/673689 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 8d9488fd..80c766b6 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -101,6 +101,7 @@ static int update_gmmu_ptes_locked(struct vm_gk20a *vm, int rw_flag); static int __must_check gk20a_init_system_vm(struct mm_gk20a *mm); static int __must_check gk20a_init_bar1_vm(struct mm_gk20a *mm); +static int __must_check gk20a_init_hwpm(struct mm_gk20a *mm); struct gk20a_dmabuf_priv { @@ -280,6 +281,7 @@ static void gk20a_remove_mm_support(struct mm_gk20a *mm) { 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); } int gk20a_init_mm_setup_sw(struct gk20a *g) @@ -315,6 +317,10 @@ int gk20a_init_mm_setup_sw(struct gk20a *g) if (err) return err; + err = gk20a_init_hwpm(mm); + if (err) + return err; + /* set vm_alloc_share op here as gk20a_as_alloc_share needs it */ g->ops.mm.vm_alloc_share = gk20a_vm_alloc_share; mm->remove_support = gk20a_remove_mm_support; @@ -2720,6 +2726,21 @@ clean_up_va: return err; } +static int gk20a_init_hwpm(struct mm_gk20a *mm) +{ + int err; + struct vm_gk20a *vm = &mm->pmu.vm; + struct gk20a *g = gk20a_from_mm(mm); + struct inst_desc *inst_block = &mm->hwpm.inst_block; + + err = gk20a_alloc_inst_block(g, inst_block); + if (err) + return err; + gk20a_init_inst_block(inst_block, vm, 0); + + return 0; +} + void gk20a_init_inst_block(struct inst_desc *inst_block, struct vm_gk20a *vm, u32 big_page_size) { -- cgit v1.2.2