summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2015-12-23 09:09:42 -0500
committerSachin Nikam <snikam@nvidia.com>2016-01-13 02:00:26 -0500
commit544873525d58a4dc4375e56798ae598c832302a7 (patch)
tree27176a6f2746da70a6688eaa2a3f48649d97d4d7 /drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
parentb51ffba58f83f0324e22884906fcb70d055c287a (diff)
gpu: nvgpu: APIs to enable/disable TSG
export below APIs for TSGs : gk20a_enable_tsg() - enable only TSG gk20a_disable_tsg() - disable only TSG gk20a_enable_channel_tsg() - if channel is part of TSG, enable TSG otherwise enable channel gk20a_disable_channel_tsg() - if channel is part of TSG, disable TSG otherwise disable channel Bug 200156699 Change-Id: Icdaca35235c3f323687f839fe32c6c5fe964b230 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/927131 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index 5cd43329..4421744c 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -32,6 +32,36 @@ bool gk20a_is_channel_marked_as_tsg(struct channel_gk20a *ch)
32 return !(ch->tsgid == NVGPU_INVALID_TSG_ID); 32 return !(ch->tsgid == NVGPU_INVALID_TSG_ID);
33} 33}
34 34
35int gk20a_enable_tsg(struct tsg_gk20a *tsg)
36{
37 struct channel_gk20a *ch;
38
39 mutex_lock(&tsg->ch_list_lock);
40 list_for_each_entry(ch, &tsg->ch_list, ch_entry) {
41 gk20a_writel(ch->g, ccsr_channel_r(ch->hw_chid),
42 gk20a_readl(ch->g, ccsr_channel_r(ch->hw_chid))
43 | ccsr_channel_enable_set_true_f());
44 }
45 mutex_unlock(&tsg->ch_list_lock);
46
47 return 0;
48}
49
50int gk20a_disable_tsg(struct tsg_gk20a *tsg)
51{
52 struct channel_gk20a *ch;
53
54 mutex_lock(&tsg->ch_list_lock);
55 list_for_each_entry(ch, &tsg->ch_list, ch_entry) {
56 gk20a_writel(ch->g, ccsr_channel_r(ch->hw_chid),
57 gk20a_readl(ch->g, ccsr_channel_r(ch->hw_chid))
58 | ccsr_channel_enable_clr_true_f());
59 }
60 mutex_unlock(&tsg->ch_list_lock);
61
62 return 0;
63}
64
35static bool gk20a_is_channel_active(struct gk20a *g, struct channel_gk20a *ch) 65static bool gk20a_is_channel_active(struct gk20a *g, struct channel_gk20a *ch)
36{ 66{
37 struct fifo_gk20a *f = &g->fifo; 67 struct fifo_gk20a *f = &g->fifo;
@@ -296,40 +326,26 @@ long gk20a_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
296 326
297 case NVGPU_IOCTL_TSG_ENABLE: 327 case NVGPU_IOCTL_TSG_ENABLE:
298 { 328 {
299 struct channel_gk20a *ch;
300 err = gk20a_busy(g->dev); 329 err = gk20a_busy(g->dev);
301 if (err) { 330 if (err) {
302 gk20a_err(&g->dev->dev, 331 gk20a_err(&g->dev->dev,
303 "failed to host gk20a for ioctl cmd: 0x%x", cmd); 332 "failed to host gk20a for ioctl cmd: 0x%x", cmd);
304 return err; 333 return err;
305 } 334 }
306 mutex_lock(&tsg->ch_list_lock); 335 gk20a_enable_tsg(tsg);
307 list_for_each_entry(ch, &tsg->ch_list, ch_entry) {
308 gk20a_writel(ch->g, ccsr_channel_r(ch->hw_chid),
309 gk20a_readl(ch->g, ccsr_channel_r(ch->hw_chid))
310 | ccsr_channel_enable_set_true_f());
311 }
312 mutex_unlock(&tsg->ch_list_lock);
313 gk20a_idle(g->dev); 336 gk20a_idle(g->dev);
314 break; 337 break;
315 } 338 }
316 339
317 case NVGPU_IOCTL_TSG_DISABLE: 340 case NVGPU_IOCTL_TSG_DISABLE:
318 { 341 {
319 struct channel_gk20a *ch;
320 err = gk20a_busy(g->dev); 342 err = gk20a_busy(g->dev);
321 if (err) { 343 if (err) {
322 gk20a_err(&g->dev->dev, 344 gk20a_err(&g->dev->dev,
323 "failed to host gk20a for ioctl cmd: 0x%x", cmd); 345 "failed to host gk20a for ioctl cmd: 0x%x", cmd);
324 return err; 346 return err;
325 } 347 }
326 mutex_lock(&tsg->ch_list_lock); 348 gk20a_disable_tsg(tsg);
327 list_for_each_entry(ch, &tsg->ch_list, ch_entry) {
328 gk20a_writel(ch->g, ccsr_channel_r(ch->hw_chid),
329 gk20a_readl(ch->g, ccsr_channel_r(ch->hw_chid))
330 | ccsr_channel_enable_clr_true_f());
331 }
332 mutex_unlock(&tsg->ch_list_lock);
333 gk20a_idle(g->dev); 349 gk20a_idle(g->dev);
334 break; 350 break;
335 } 351 }