summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/fifo/tsg.c
diff options
context:
space:
mode:
authorSeema Khowala <seemaj@nvidia.com>2018-12-27 22:23:06 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2019-03-18 14:30:16 -0400
commite00804594b83781bc9f7c17ac68cd9c5dd30953c (patch)
treef687d4da54c3b2afc867b8fcdde12bf8489f95f3 /drivers/gpu/nvgpu/common/fifo/tsg.c
parent0c47ce7d72e4c95ca293a222e2462f52683838a3 (diff)
gpu: nvgpu: remove gk20a_is_channel_marked_as_tsg
Use tsg_gk20a_from_ch to get tsg pointer for tsgid of a channel. For invalid tsgid, tsg pointer will be NULL Bug 2092051 Bug 2429295 Bug 2484211 Change-Id: I82cd6a2dc5fab4acb147202af667ca97a2842a73 Signed-off-by: Seema Khowala <seemaj@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2006722 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> (cherry picked from commit 13f37f9c70b9ae2e0d179830cded93a0a6f86494 in dev-kernel) Reviewed-on: https://git-master.nvidia.com/r/2025507 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/fifo/tsg.c')
-rw-r--r--drivers/gpu/nvgpu/common/fifo/tsg.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c
index 9790553f..e6dfbae6 100644
--- a/drivers/gpu/nvgpu/common/fifo/tsg.c
+++ b/drivers/gpu/nvgpu/common/fifo/tsg.c
@@ -28,11 +28,6 @@
28#include <nvgpu/tsg.h> 28#include <nvgpu/tsg.h>
29#include <nvgpu/gk20a.h> 29#include <nvgpu/gk20a.h>
30 30
31bool gk20a_is_channel_marked_as_tsg(struct channel_gk20a *ch)
32{
33 return !(ch->tsgid == NVGPU_INVALID_TSG_ID);
34}
35
36int gk20a_enable_tsg(struct tsg_gk20a *tsg) 31int gk20a_enable_tsg(struct tsg_gk20a *tsg)
37{ 32{
38 struct gk20a *g = tsg->g; 33 struct gk20a *g = tsg->g;
@@ -116,7 +111,7 @@ int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg,
116 nvgpu_log_fn(g, " "); 111 nvgpu_log_fn(g, " ");
117 112
118 /* check if channel is already bound to some TSG */ 113 /* check if channel is already bound to some TSG */
119 if (gk20a_is_channel_marked_as_tsg(ch)) { 114 if (tsg_gk20a_from_ch(ch) != NULL) {
120 return -EINVAL; 115 return -EINVAL;
121 } 116 }
122 117
@@ -125,7 +120,6 @@ int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg,
125 return -EINVAL; 120 return -EINVAL;
126 } 121 }
127 122
128 ch->tsgid = tsg->tsgid;
129 123
130 /* all the channel part of TSG should need to be same runlist_id */ 124 /* all the channel part of TSG should need to be same runlist_id */
131 if (tsg->runlist_id == FIFO_INVAL_TSG_ID) { 125 if (tsg->runlist_id == FIFO_INVAL_TSG_ID) {
@@ -139,6 +133,7 @@ int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg,
139 133
140 nvgpu_rwsem_down_write(&tsg->ch_list_lock); 134 nvgpu_rwsem_down_write(&tsg->ch_list_lock);
141 nvgpu_list_add_tail(&ch->ch_entry, &tsg->ch_list); 135 nvgpu_list_add_tail(&ch->ch_entry, &tsg->ch_list);
136 ch->tsgid = tsg->tsgid;
142 nvgpu_rwsem_up_write(&tsg->ch_list_lock); 137 nvgpu_rwsem_up_write(&tsg->ch_list_lock);
143 138
144 nvgpu_ref_get(&tsg->refcount); 139 nvgpu_ref_get(&tsg->refcount);
@@ -172,14 +167,13 @@ int gk20a_tsg_unbind_channel(struct channel_gk20a *ch)
172 167
173 nvgpu_rwsem_down_write(&tsg->ch_list_lock); 168 nvgpu_rwsem_down_write(&tsg->ch_list_lock);
174 nvgpu_list_del(&ch->ch_entry); 169 nvgpu_list_del(&ch->ch_entry);
170 ch->tsgid = NVGPU_INVALID_TSG_ID;
175 nvgpu_rwsem_up_write(&tsg->ch_list_lock); 171 nvgpu_rwsem_up_write(&tsg->ch_list_lock);
176 } 172 }
173 nvgpu_log(g, gpu_dbg_fn, "UNBIND tsg:%d channel:%d",
174 tsg->tsgid, ch->chid);
177 175
178 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 176 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release);
179 ch->tsgid = NVGPU_INVALID_TSG_ID;
180
181 nvgpu_log(g, gpu_dbg_fn, "UNBIND tsg:%d channel:%d\n",
182 tsg->tsgid, ch->chid);
183 177
184 return 0; 178 return 0;
185} 179}
@@ -395,13 +389,17 @@ void gk20a_tsg_release(struct nvgpu_ref *ref)
395struct tsg_gk20a *tsg_gk20a_from_ch(struct channel_gk20a *ch) 389struct tsg_gk20a *tsg_gk20a_from_ch(struct channel_gk20a *ch)
396{ 390{
397 struct tsg_gk20a *tsg = NULL; 391 struct tsg_gk20a *tsg = NULL;
392 u32 tsgid = ch->tsgid;
398 393
399 if (gk20a_is_channel_marked_as_tsg(ch)) { 394 if (tsgid != NVGPU_INVALID_TSG_ID) {
400 struct gk20a *g = ch->g; 395 struct gk20a *g = ch->g;
401 struct fifo_gk20a *f = &g->fifo; 396 struct fifo_gk20a *f = &g->fifo;
402 tsg = &f->tsg[ch->tsgid];
403 }
404 397
398 tsg = &f->tsg[tsgid];
399 } else {
400 nvgpu_log(ch->g, gpu_dbg_fn, "tsgid is invalid for chid: %d",
401 ch->chid);
402 }
405 return tsg; 403 return tsg;
406} 404}
407 405