From 7e403974d3584ab8880e42d422ee3afb7f49d6f3 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 29 Nov 2016 16:01:41 -0800 Subject: gpu: nvgpu: Simplify ref-counting on VMs Simplify ref-counting on VMs: take a ref when a VM is bound to a channel and drop a ref when a channel is freed. Previously ref-counts were scattered over the driver. Also the CE and CDE code would bind channels with custom rolled code. This was because the gk20a_vm_bind_channel() function took an as_share as the VM argument (the VM was then inferred from that as_share). However, it is trivial to abtract that bit out and allow a central bind channel function that just takes a VM and a channel. Bug 1846718 Change-Id: I156aab259f6c7a2fa338408c6c4a3a464cd44a0c Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1261886 Reviewed-by: Richard Zhao Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/gpu/nvgpu/vgpu/mm_vgpu.c') diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index 76631b96..f97acd47 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c @@ -446,6 +446,9 @@ static int vgpu_vm_bind_channel(struct gk20a_as_share *as_share, err = -ENOMEM; } + if (ch->vm) + gk20a_vm_get(ch->vm); + return err; } -- cgit v1.2.2