summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-05-09 21:34:54 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-06 20:09:16 -0400
commitc21f5bca9ae81804130e30ea3e6f7a18d51203dc (patch)
treefb1a2d67532df19d70468610ad2a62c3464876c1 /drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
parentc2b63150cd947557b8d17637258b988459b8e0ec (diff)
gpu: nvgpu: Remove extraneous VM init/deinit APIs
Support only VM pointers and ref-counting for maintaining VMs. This dramatically reduces the complexity of the APIs, avoids the API abuse that has existed, and ensures that future VM usage is consistent with current usage. Also remove the combined VM free/instance block deletion. Any place where this was done is now replaced with an explict free of the instance block and a nvgpu_vm_put(). JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: Ib73e8d574ecc9abf6dad0b40a2c5795d6396cc8c Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1480227 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index 09268b6b..4bfa041e 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -1838,7 +1838,6 @@ static int gk20a_perfbuf_map(struct dbg_session_gk20a *dbg_s,
1838{ 1838{
1839 struct gk20a *g = dbg_s->g; 1839 struct gk20a *g = dbg_s->g;
1840 struct mm_gk20a *mm = &g->mm; 1840 struct mm_gk20a *mm = &g->mm;
1841 struct vm_gk20a *vm = &mm->perfbuf.vm;
1842 int err; 1841 int err;
1843 u32 virt_size; 1842 u32 virt_size;
1844 u32 virt_addr_lo; 1843 u32 virt_addr_lo;
@@ -1853,23 +1852,23 @@ static int gk20a_perfbuf_map(struct dbg_session_gk20a *dbg_s,
1853 return -EBUSY; 1852 return -EBUSY;
1854 } 1853 }
1855 1854
1856 err = nvgpu_init_vm(mm, vm, big_page_size, 1855 mm->perfbuf.vm = nvgpu_vm_init(g, big_page_size,
1857 big_page_size << 10, 1856 big_page_size << 10,
1858 NV_MM_DEFAULT_KERNEL_SIZE, 1857 NV_MM_DEFAULT_KERNEL_SIZE,
1859 NV_MM_DEFAULT_KERNEL_SIZE + NV_MM_DEFAULT_USER_SIZE, 1858 NV_MM_DEFAULT_KERNEL_SIZE + NV_MM_DEFAULT_USER_SIZE,
1860 false, false, "perfbuf"); 1859 false, false, "perfbuf");
1861 if (err) { 1860 if (!mm->perfbuf.vm) {
1862 nvgpu_mutex_release(&g->dbg_sessions_lock); 1861 nvgpu_mutex_release(&g->dbg_sessions_lock);
1863 return err; 1862 return -ENOMEM;
1864 } 1863 }
1865 1864
1866 err = gk20a_alloc_inst_block(g, &mm->perfbuf.inst_block); 1865 err = gk20a_alloc_inst_block(g, &mm->perfbuf.inst_block);
1867 if (err) 1866 if (err)
1868 goto err_remove_vm; 1867 goto err_remove_vm;
1869 1868
1870 g->ops.mm.init_inst_block(&mm->perfbuf.inst_block, vm, 0); 1869 g->ops.mm.init_inst_block(&mm->perfbuf.inst_block, mm->perfbuf.vm, 0);
1871 1870
1872 err = nvgpu_vm_map_buffer(vm, 1871 err = nvgpu_vm_map_buffer(mm->perfbuf.vm,
1873 args->dmabuf_fd, 1872 args->dmabuf_fd,
1874 &args->offset, 1873 &args->offset,
1875 0, 1874 0,
@@ -1922,9 +1921,10 @@ static int gk20a_perfbuf_map(struct dbg_session_gk20a *dbg_s,
1922 return 0; 1921 return 0;
1923 1922
1924err_unmap: 1923err_unmap:
1925 nvgpu_vm_unmap_buffer(vm, args->offset, NULL); 1924 nvgpu_vm_unmap_buffer(mm->perfbuf.vm, args->offset, NULL);
1926err_remove_vm: 1925err_remove_vm:
1927 nvgpu_vm_remove_inst(vm, &mm->perfbuf.inst_block); 1926 gk20a_free_inst_block(g, &mm->perfbuf.inst_block);
1927 nvgpu_vm_put(mm->perfbuf.vm);
1928 nvgpu_mutex_release(&g->dbg_sessions_lock); 1928 nvgpu_mutex_release(&g->dbg_sessions_lock);
1929 return err; 1929 return err;
1930} 1930}
@@ -1956,13 +1956,14 @@ static int gk20a_perfbuf_disable_locked(struct gk20a *g)
1956static int gk20a_perfbuf_release_locked(struct gk20a *g, u64 offset) 1956static int gk20a_perfbuf_release_locked(struct gk20a *g, u64 offset)
1957{ 1957{
1958 struct mm_gk20a *mm = &g->mm; 1958 struct mm_gk20a *mm = &g->mm;
1959 struct vm_gk20a *vm = &mm->perfbuf.vm; 1959 struct vm_gk20a *vm = mm->perfbuf.vm;
1960 int err; 1960 int err;
1961 1961
1962 err = gk20a_perfbuf_disable_locked(g); 1962 err = gk20a_perfbuf_disable_locked(g);
1963 1963
1964 nvgpu_vm_unmap_buffer(vm, offset, NULL); 1964 nvgpu_vm_unmap_buffer(vm, offset, NULL);
1965 nvgpu_vm_remove_inst(vm, &mm->perfbuf.inst_block); 1965 gk20a_free_inst_block(g, &mm->perfbuf.inst_block);
1966 nvgpu_vm_put(vm);
1966 1967
1967 g->perfbuf.owner = NULL; 1968 g->perfbuf.owner = NULL;
1968 g->perfbuf.offset = 0; 1969 g->perfbuf.offset = 0;