summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2014-10-22 10:33:36 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:12:05 -0400
commit97e6847cb1f52fc59701dcc4d9e53caf3faacb64 (patch)
treee7900f9001a733669c06a4f79fa708165d6ce6bc /drivers/gpu/nvgpu/gk20a/mm_gk20a.c
parente4654ebb01c49d91b7cad89a9fd30d21457eeb23 (diff)
gpu: nvgpu: don't kfree vm's inside other structs
Trying to kfree pmu.vm or bar1.vm is not allowed, since they are not directly allocated. Separate the vm kfree from the actual vm support removal, so that they can be done individually. Change-Id: I7628f546b94e0de909371ce315e4cb065e5ef953 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/592112 Reviewed-by: Automatic_Commit_Validation_User Reviewed-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.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 0e005f7c..8f2d4079 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -116,6 +116,8 @@ struct gk20a_dmabuf_priv {
116 struct list_head states; 116 struct list_head states;
117}; 117};
118 118
119static void gk20a_vm_remove_support_nofree(struct vm_gk20a *vm);
120
119static void gk20a_mm_delete_priv(void *_priv) 121static void gk20a_mm_delete_priv(void *_priv)
120{ 122{
121 struct gk20a_buffer_state *s, *s_tmp; 123 struct gk20a_buffer_state *s, *s_tmp;
@@ -278,7 +280,7 @@ static void gk20a_remove_mm_support(struct mm_gk20a *mm)
278 inst_block->cpuva = NULL; 280 inst_block->cpuva = NULL;
279 inst_block->iova = 0; 281 inst_block->iova = 0;
280 282
281 gk20a_vm_remove_support(vm); 283 gk20a_vm_remove_support_nofree(vm);
282} 284}
283 285
284int gk20a_init_mm_setup_sw(struct gk20a *g) 286int gk20a_init_mm_setup_sw(struct gk20a *g)
@@ -2076,7 +2078,7 @@ void gk20a_vm_unmap(struct vm_gk20a *vm, u64 offset)
2076 mutex_unlock(&vm->update_gmmu_lock); 2078 mutex_unlock(&vm->update_gmmu_lock);
2077} 2079}
2078 2080
2079void gk20a_vm_remove_support(struct vm_gk20a *vm) 2081static void gk20a_vm_remove_support_nofree(struct vm_gk20a *vm)
2080{ 2082{
2081 struct gk20a *g = vm->mm->g; 2083 struct gk20a *g = vm->mm->g;
2082 struct mapped_buffer_node *mapped_buffer; 2084 struct mapped_buffer_node *mapped_buffer;
@@ -2140,7 +2142,11 @@ void gk20a_vm_remove_support(struct vm_gk20a *vm)
2140 if (vm->zero_page_cpuva) 2142 if (vm->zero_page_cpuva)
2141 dma_free_coherent(&g->dev->dev, vm->big_page_size, 2143 dma_free_coherent(&g->dev->dev, vm->big_page_size,
2142 vm->zero_page_cpuva, vm->zero_page_iova); 2144 vm->zero_page_cpuva, vm->zero_page_iova);
2145}
2143 2146
2147void gk20a_vm_remove_support(struct vm_gk20a *vm)
2148{
2149 gk20a_vm_remove_support_nofree(vm);
2144 /* vm is not used anymore. release it. */ 2150 /* vm is not used anymore. release it. */
2145 kfree(vm); 2151 kfree(vm);
2146} 2152}