diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2015-01-14 07:04:08 -0500 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-04-04 21:08:02 -0400 |
commit | 3877adcd656e8e4329e2c4250119de2256f30730 (patch) | |
tree | e1228aea1b348e6c2fcd2bcab30e4ea9ef2f5bea /drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |
parent | f93a8cc36b68500c1d1ae235f929c35c4a039497 (diff) |
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 <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/673689
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 21 |
1 files changed, 21 insertions, 0 deletions
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, | |||
101 | int rw_flag); | 101 | int rw_flag); |
102 | static int __must_check gk20a_init_system_vm(struct mm_gk20a *mm); | 102 | static int __must_check gk20a_init_system_vm(struct mm_gk20a *mm); |
103 | static int __must_check gk20a_init_bar1_vm(struct mm_gk20a *mm); | 103 | static int __must_check gk20a_init_bar1_vm(struct mm_gk20a *mm); |
104 | static int __must_check gk20a_init_hwpm(struct mm_gk20a *mm); | ||
104 | 105 | ||
105 | 106 | ||
106 | struct gk20a_dmabuf_priv { | 107 | struct gk20a_dmabuf_priv { |
@@ -280,6 +281,7 @@ static void gk20a_remove_mm_support(struct mm_gk20a *mm) | |||
280 | { | 281 | { |
281 | gk20a_remove_vm(&mm->bar1.vm, &mm->bar1.inst_block); | 282 | gk20a_remove_vm(&mm->bar1.vm, &mm->bar1.inst_block); |
282 | gk20a_remove_vm(&mm->pmu.vm, &mm->pmu.inst_block); | 283 | gk20a_remove_vm(&mm->pmu.vm, &mm->pmu.inst_block); |
284 | gk20a_free_inst_block(gk20a_from_mm(mm), &mm->hwpm.inst_block); | ||
283 | } | 285 | } |
284 | 286 | ||
285 | int gk20a_init_mm_setup_sw(struct gk20a *g) | 287 | int gk20a_init_mm_setup_sw(struct gk20a *g) |
@@ -315,6 +317,10 @@ int gk20a_init_mm_setup_sw(struct gk20a *g) | |||
315 | if (err) | 317 | if (err) |
316 | return err; | 318 | return err; |
317 | 319 | ||
320 | err = gk20a_init_hwpm(mm); | ||
321 | if (err) | ||
322 | return err; | ||
323 | |||
318 | /* set vm_alloc_share op here as gk20a_as_alloc_share needs it */ | 324 | /* set vm_alloc_share op here as gk20a_as_alloc_share needs it */ |
319 | g->ops.mm.vm_alloc_share = gk20a_vm_alloc_share; | 325 | g->ops.mm.vm_alloc_share = gk20a_vm_alloc_share; |
320 | mm->remove_support = gk20a_remove_mm_support; | 326 | mm->remove_support = gk20a_remove_mm_support; |
@@ -2720,6 +2726,21 @@ clean_up_va: | |||
2720 | return err; | 2726 | return err; |
2721 | } | 2727 | } |
2722 | 2728 | ||
2729 | static int gk20a_init_hwpm(struct mm_gk20a *mm) | ||
2730 | { | ||
2731 | int err; | ||
2732 | struct vm_gk20a *vm = &mm->pmu.vm; | ||
2733 | struct gk20a *g = gk20a_from_mm(mm); | ||
2734 | struct inst_desc *inst_block = &mm->hwpm.inst_block; | ||
2735 | |||
2736 | err = gk20a_alloc_inst_block(g, inst_block); | ||
2737 | if (err) | ||
2738 | return err; | ||
2739 | gk20a_init_inst_block(inst_block, vm, 0); | ||
2740 | |||
2741 | return 0; | ||
2742 | } | ||
2743 | |||
2723 | void gk20a_init_inst_block(struct inst_desc *inst_block, struct vm_gk20a *vm, | 2744 | void gk20a_init_inst_block(struct inst_desc *inst_block, struct vm_gk20a *vm, |
2724 | u32 big_page_size) | 2745 | u32 big_page_size) |
2725 | { | 2746 | { |