summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
diff options
context:
space:
mode:
authorLakshmanan M <lm@nvidia.com>2016-06-09 01:00:16 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2016-06-13 10:45:19 -0400
commita295d90cac87949256b629e29f97fa5e28a1feb3 (patch)
tree7c1a104c0a0594869955074fe8abe86097cacae8 /drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
parent987de665838f6b4aceadf52f076b91da4cc633ca (diff)
gpu: nvgpu: Add uapi support for non-graphics engines
Extend the existing NVGPU_GPU_IOCTL_OPEN_CHANNEL interface to allow opening channels for other than the primary (i.e., the graphics) runlists. This is required to push work to dGPU engines that have their own runlists, such as the asynchronous copy engines and the multimedia engines. Minor change - Added active_engines_list allocation and assignment for fifo_vgpu back end. JIRA DNVGPU-25 Change-Id: I3ed377e2c9a2b4dd72e8256463510a62c64e7a8f Signed-off-by: Lakshmanan M <lm@nvidia.com> Reviewed-on: http://git-master/r/1161541 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-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.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index f7d5535d..603ed6f5 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -114,6 +114,16 @@ int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg,
114 114
115 ch->tsgid = tsg->tsgid; 115 ch->tsgid = tsg->tsgid;
116 116
117 /* all the channel part of TSG should need to be same runlist_id */
118 if (tsg->runlist_id == ~0)
119 tsg->runlist_id = ch->runlist_id;
120 else if (tsg->runlist_id != ch->runlist_id) {
121 gk20a_err(dev_from_gk20a(tsg->g),
122 "Error: TSG channel should be share same runlist ch[%d] tsg[%d]\n",
123 ch->runlist_id, tsg->runlist_id);
124 return -EINVAL;
125 }
126
117 mutex_lock(&tsg->ch_list_lock); 127 mutex_lock(&tsg->ch_list_lock);
118 list_add_tail(&ch->ch_entry, &tsg->ch_list); 128 list_add_tail(&ch->ch_entry, &tsg->ch_list);
119 mutex_unlock(&tsg->ch_list_lock); 129 mutex_unlock(&tsg->ch_list_lock);
@@ -185,7 +195,7 @@ static int gk20a_tsg_set_priority(struct gk20a *g, struct tsg_gk20a *tsg,
185 gk20a_channel_get_timescale_from_timeslice(g, tsg->timeslice_us, 195 gk20a_channel_get_timescale_from_timeslice(g, tsg->timeslice_us,
186 &tsg->timeslice_timeout, &tsg->timeslice_scale); 196 &tsg->timeslice_timeout, &tsg->timeslice_scale);
187 197
188 g->ops.fifo.update_runlist(g, 0, ~0, true, true); 198 g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true);
189 199
190 return 0; 200 return 0;
191} 201}
@@ -346,7 +356,7 @@ static int gk20a_tsg_set_runlist_interleave(struct tsg_gk20a *tsg, u32 level)
346 break; 356 break;
347 } 357 }
348 358
349 return ret ? ret : g->ops.fifo.update_runlist(g, 0, ~0, true, true); 359 return ret ? ret : g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true);
350} 360}
351 361
352static int gk20a_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice) 362static int gk20a_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice)
@@ -360,7 +370,7 @@ static int gk20a_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice)
360 gk20a_channel_get_timescale_from_timeslice(g, timeslice, 370 gk20a_channel_get_timescale_from_timeslice(g, timeslice,
361 &tsg->timeslice_timeout, &tsg->timeslice_scale); 371 &tsg->timeslice_timeout, &tsg->timeslice_scale);
362 372
363 return g->ops.fifo.update_runlist(g, 0, ~0, true, true); 373 return g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true);
364} 374}
365 375
366static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) 376static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg)
@@ -411,6 +421,7 @@ int gk20a_tsg_open(struct gk20a *g, struct file *filp)
411 tsg->timeslice_us = 0; 421 tsg->timeslice_us = 0;
412 tsg->timeslice_timeout = 0; 422 tsg->timeslice_timeout = 0;
413 tsg->timeslice_scale = 0; 423 tsg->timeslice_scale = 0;
424 tsg->runlist_id = ~0;
414 425
415 filp->private_data = tsg; 426 filp->private_data = tsg;
416 427
@@ -448,6 +459,8 @@ static void gk20a_tsg_release(struct kref *ref)
448 459
449 release_used_tsg(&g->fifo, tsg); 460 release_used_tsg(&g->fifo, tsg);
450 461
462 tsg->runlist_id = ~0;
463
451 gk20a_dbg(gpu_dbg_fn, "tsg released %d\n", tsg->tsgid); 464 gk20a_dbg(gpu_dbg_fn, "tsg released %d\n", tsg->tsgid);
452} 465}
453 466