From 411c3a9a4f7451a8f6fe3b533bfd77d3f46f7387 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Fri, 9 Oct 2015 13:36:08 +0300 Subject: gpu: nvgpu: use a separate big vm for cde Allocate a separate VM for CDE channels instead of using the system (PMU) vm, and make it much bigger than the PMU's to fit the maximum number of CDE channels there. Bug 1566740 Change-Id: I4f487c40c9ec79cc9ffb880b0ecd3f47eb450336 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/815149 Reviewed-by: Automatic_Commit_Validation_User --- drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 4 ++-- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 19 +++++++++++++++++++ drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 3 +++ 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 6d8633a7..01fca058 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c @@ -1194,8 +1194,8 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx) } /* bind the channel to the vm */ - gk20a_vm_get(&g->mm.pmu.vm); - ch->vm = &g->mm.pmu.vm; + gk20a_vm_get(&g->mm.cde.vm); + ch->vm = &g->mm.cde.vm; err = channel_gk20a_commit_va(ch); if (err) { gk20a_warn(&cde_ctx->pdev->dev, "cde: could not bind vm"); diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 15fd32d3..7876af63 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -105,6 +105,7 @@ static int update_gmmu_ptes_locked(struct vm_gk20a *vm, 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); +static int __must_check gk20a_init_cde_vm(struct mm_gk20a *mm); struct gk20a_dmabuf_priv { @@ -344,6 +345,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); + gk20a_vm_remove_support_nofree(&mm->cde.vm); } int gk20a_init_mm_setup_sw(struct gk20a *g) @@ -386,6 +388,10 @@ int gk20a_init_mm_setup_sw(struct gk20a *g) if (err) return err; + err = gk20a_init_cde_vm(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; @@ -3268,6 +3274,19 @@ static int gk20a_init_hwpm(struct mm_gk20a *mm) return 0; } +static int gk20a_init_cde_vm(struct mm_gk20a *mm) +{ + struct vm_gk20a *vm = &mm->cde.vm; + struct gk20a *g = gk20a_from_mm(mm); + u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size; + + return gk20a_init_vm(mm, vm, big_page_size, + SZ_4K * 16, + NV_MM_DEFAULT_KERNEL_SIZE, + NV_MM_DEFAULT_KERNEL_SIZE + NV_MM_DEFAULT_USER_SIZE, + false, "cde"); +} + void gk20a_mm_init_pdb(struct gk20a *g, void *inst_ptr, u64 pdb_addr) { u32 pdb_addr_lo = u64_lo32(pdb_addr >> ram_in_base_shift_v()); diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index 9e373d8e..7bbaf283 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -318,6 +318,9 @@ struct mm_gk20a { struct mem_desc inst_block; } hwpm; + struct { + struct vm_gk20a vm; + } cde; struct mutex l2_op_lock; #ifdef CONFIG_ARCH_TEGRA_18x_SOC -- cgit v1.2.2