diff options
author | Richard Zhao <rizhao@nvidia.com> | 2016-01-14 20:40:48 -0500 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-01-25 18:22:22 -0500 |
commit | 8fb33d92b03b9ee2db421c69252822d09477cce5 (patch) | |
tree | ca3708bc20bb13a743a50a0a5660f42e487dea9f /drivers/gpu/nvgpu/vgpu | |
parent | 42b0f49d42eeadffc221bd4d9990010dfebd4a10 (diff) |
gpu: nvgpu: vgpu: add channel_set_priority support
- add gops.fifo.channel_set_priority and move current code
as native callback.
- implement the callback for vgpu
Bug 1701079
Change-Id: If1cd13ea4478d11d578da2f682598e0c4522bcaf
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: http://git-master/r/932829
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/fifo_vgpu.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c index 3db215bc..e776e97c 100644 --- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c | |||
@@ -194,6 +194,12 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f) | |||
194 | if (!runlist->active_channels) | 194 | if (!runlist->active_channels) |
195 | goto clean_up_runlist_info; | 195 | goto clean_up_runlist_info; |
196 | 196 | ||
197 | runlist->high_prio_channels = | ||
198 | kzalloc(DIV_ROUND_UP(f->num_channels, BITS_PER_BYTE), | ||
199 | GFP_KERNEL); | ||
200 | if (!runlist->high_prio_channels) | ||
201 | goto clean_up_runlist_info; | ||
202 | |||
197 | runlist_size = sizeof(u16) * f->num_channels; | 203 | runlist_size = sizeof(u16) * f->num_channels; |
198 | for (i = 0; i < MAX_RUNLIST_BUFFERS; i++) { | 204 | for (i = 0; i < MAX_RUNLIST_BUFFERS; i++) { |
199 | int err = gk20a_gmmu_alloc(g, runlist_size, &runlist->mem[i]); | 205 | int err = gk20a_gmmu_alloc(g, runlist_size, &runlist->mem[i]); |
@@ -215,10 +221,13 @@ clean_up_runlist: | |||
215 | for (i = 0; i < MAX_RUNLIST_BUFFERS; i++) | 221 | for (i = 0; i < MAX_RUNLIST_BUFFERS; i++) |
216 | gk20a_gmmu_free(g, &runlist->mem[i]); | 222 | gk20a_gmmu_free(g, &runlist->mem[i]); |
217 | 223 | ||
224 | clean_up_runlist_info: | ||
225 | kfree(runlist->high_prio_channels); | ||
226 | runlist->high_prio_channels = NULL; | ||
227 | |||
218 | kfree(runlist->active_channels); | 228 | kfree(runlist->active_channels); |
219 | runlist->active_channels = NULL; | 229 | runlist->active_channels = NULL; |
220 | 230 | ||
221 | clean_up_runlist_info: | ||
222 | kfree(f->runlist_info); | 231 | kfree(f->runlist_info); |
223 | f->runlist_info = NULL; | 232 | f->runlist_info = NULL; |
224 | 233 | ||
@@ -521,6 +530,26 @@ static int vgpu_fifo_wait_engine_idle(struct gk20a *g) | |||
521 | return 0; | 530 | return 0; |
522 | } | 531 | } |
523 | 532 | ||
533 | static int vgpu_channel_set_priority(struct channel_gk20a *ch, u32 priority) | ||
534 | { | ||
535 | struct gk20a_platform *platform = gk20a_get_platform(ch->g->dev); | ||
536 | struct tegra_vgpu_cmd_msg msg; | ||
537 | struct tegra_vgpu_channel_priority_params *p = | ||
538 | &msg.params.channel_priority; | ||
539 | int err; | ||
540 | |||
541 | gk20a_dbg_info("channel %d set priority %u", ch->hw_chid, priority); | ||
542 | |||
543 | msg.cmd = TEGRA_VGPU_CMD_CHANNEL_SET_PRIORITY; | ||
544 | msg.handle = platform->virt_handle; | ||
545 | p->handle = ch->virt_ctx; | ||
546 | p->priority = priority; | ||
547 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); | ||
548 | WARN_ON(err || msg.ret); | ||
549 | |||
550 | return err ? err : msg.ret; | ||
551 | } | ||
552 | |||
524 | static void vgpu_fifo_set_ctx_mmu_error(struct gk20a *g, | 553 | static void vgpu_fifo_set_ctx_mmu_error(struct gk20a *g, |
525 | struct channel_gk20a *ch) | 554 | struct channel_gk20a *ch) |
526 | { | 555 | { |
@@ -605,5 +634,6 @@ void vgpu_init_fifo_ops(struct gpu_ops *gops) | |||
605 | gops->fifo.preempt_channel = vgpu_fifo_preempt_channel; | 634 | gops->fifo.preempt_channel = vgpu_fifo_preempt_channel; |
606 | gops->fifo.update_runlist = vgpu_fifo_update_runlist; | 635 | gops->fifo.update_runlist = vgpu_fifo_update_runlist; |
607 | gops->fifo.wait_engine_idle = vgpu_fifo_wait_engine_idle; | 636 | gops->fifo.wait_engine_idle = vgpu_fifo_wait_engine_idle; |
637 | gops->fifo.channel_set_priority = vgpu_channel_set_priority; | ||
608 | } | 638 | } |
609 | 639 | ||