From 8095b3cf9cadbcf42a0e5fdcf3fb32cf87c55798 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 4 Sep 2014 19:32:00 +0530 Subject: gpu: nvgpu: get VM reference for TSG We store a reference to common address space of channels in struct tsg_gk20a without increasing the refcount This could result in freeing the address space even when some channel in TSG needs it or when we need to free common gr_ctx Fix this by getting ref using gk20a_vm_get() when we store the VM reference. We drop this reference with gk20a_vm_put() when closing the TSG Bug 1470692 Change-Id: Ifc1f29d32cd721810bfbb5a4db96095770318c17 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/495668 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 69fe4901..976e9171 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -2830,10 +2830,13 @@ int gk20a_alloc_obj_ctx(struct channel_gk20a *c, } else { if (!tsg->tsg_gr_ctx) { tsg->vm = c->vm; + gk20a_vm_get(tsg->vm); err = gr_gk20a_alloc_tsg_gr_ctx(g, tsg); if (err) { gk20a_err(dev_from_gk20a(g), "fail to allocate TSG gr ctx buffer"); + gk20a_vm_put(tsg->vm); + tsg->vm = NULL; goto out; } } -- cgit v1.2.2