summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/as_gk20a.c
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2014-10-02 08:25:53 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:49 -0400
commita870ff1d294126a3b46db4e0fdc14276035a2840 (patch)
treeb4bb2e094ff77d57636ba887ecd3e14f8fc04689 /drivers/gpu/nvgpu/gk20a/as_gk20a.c
parent23d15214ae7d1e98b33552cd4cd2346cfea5725f (diff)
gpu: nvgpu: Remove get and put client routines
gk20a_get_client() and gk20a_put_client() routines are effectively dead code. The GPU has been using pm_runtime for reference counting whether the device should be turned on or off, and gk20a_get_client() and gk20a_put_client() have had no positive effect on the behaviour. In worst case these functions trigger some issues as they may trigger code paths that should not be run. There is also a race between get/put and busy/idle. This patch removes the functions and reworks as_gk20a.c to correctly use gk20a_busy()/gk20a_idle() where put/get was required. Additionally, finalize_poweron() is moved to gk20a_busy(), similarly as it was with gk20a_get_client(). If pm_runtime is not in use, the device is only powered on and never off. Currently this affects vgpu power management since it does not use pm_runtime yet. Bug 1562096 Change-Id: I3162655f83457e9caccd9264eed36b5d51e60c52 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/414998 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Tested-by: Seshendra Gadagottu <sgadagottu@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/as_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/as_gk20a.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/as_gk20a.c b/drivers/gpu/nvgpu/gk20a/as_gk20a.c
index 74d83a7d..27608cec 100644
--- a/drivers/gpu/nvgpu/gk20a/as_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/as_gk20a.c
@@ -56,14 +56,19 @@ int gk20a_as_alloc_share(struct gk20a_as *as,
56 as_share->ref_cnt.counter = 1; 56 as_share->ref_cnt.counter = 1;
57 57
58 /* this will set as_share->vm. */ 58 /* this will set as_share->vm. */
59 err = gk20a_busy(g->dev);
60 if (err)
61 goto failed;
59 err = g->ops.mm.vm_alloc_share(as_share, flags); 62 err = g->ops.mm.vm_alloc_share(as_share, flags);
63 gk20a_idle(g->dev);
64
60 if (err) 65 if (err)
61 goto failed; 66 goto failed;
62 67
63 *out = as_share; 68 *out = as_share;
64 return 0; 69 return 0;
65 70
66 failed: 71failed:
67 kfree(as_share); 72 kfree(as_share);
68 return err; 73 return err;
69} 74}
@@ -180,16 +185,9 @@ int gk20a_as_dev_open(struct inode *inode, struct file *filp)
180 185
181 g = container_of(inode->i_cdev, struct gk20a, as.cdev); 186 g = container_of(inode->i_cdev, struct gk20a, as.cdev);
182 187
183 err = gk20a_get_client(g);
184 if (err) {
185 gk20a_dbg_fn("fail to get channel!");
186 return err;
187 }
188
189 err = gk20a_as_alloc_share(&g->as, 0, &as_share); 188 err = gk20a_as_alloc_share(&g->as, 0, &as_share);
190 if (err) { 189 if (err) {
191 gk20a_dbg_fn("failed to alloc share"); 190 gk20a_dbg_fn("failed to alloc share");
192 gk20a_put_client(g);
193 return err; 191 return err;
194 } 192 }
195 193
@@ -200,16 +198,10 @@ int gk20a_as_dev_open(struct inode *inode, struct file *filp)
200int gk20a_as_dev_release(struct inode *inode, struct file *filp) 198int gk20a_as_dev_release(struct inode *inode, struct file *filp)
201{ 199{
202 struct gk20a_as_share *as_share = filp->private_data; 200 struct gk20a_as_share *as_share = filp->private_data;
203 int ret;
204 struct gk20a *g = gk20a_from_as(as_share->as);
205 201
206 gk20a_dbg_fn(""); 202 gk20a_dbg_fn("");
207 203
208 ret = gk20a_as_release_share(as_share); 204 return gk20a_as_release_share(as_share);
209
210 gk20a_put_client(g);
211
212 return ret;
213} 205}
214 206
215long gk20a_as_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 207long gk20a_as_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)