summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c19
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.h4
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c33
-rw-r--r--drivers/gpu/nvgpu/gm20b/fifo_gm20b.c3
-rw-r--r--drivers/gpu/nvgpu/vgpu/tsg_vgpu.c4
5 files changed, 40 insertions, 23 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index ccc3afca..2daeb1d0 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GK20A Graphics FIFO (gr host) 2 * GK20A Graphics FIFO (gr host)
3 * 3 *
4 * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -2870,6 +2870,22 @@ int gk20a_fifo_set_runlist_interleave(struct gk20a *g,
2870 return 0; 2870 return 0;
2871} 2871}
2872 2872
2873int gk20a_fifo_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice)
2874{
2875 struct gk20a *g = tsg->g;
2876
2877 if (timeslice < g->min_timeslice_us ||
2878 timeslice > g->max_timeslice_us)
2879 return -EINVAL;
2880
2881 gk20a_channel_get_timescale_from_timeslice(g, timeslice,
2882 &tsg->timeslice_timeout, &tsg->timeslice_scale);
2883
2884 tsg->timeslice_us = timeslice;
2885
2886 return g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true);
2887}
2888
2873static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, 2889static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id,
2874 u32 hw_chid, bool add, 2890 u32 hw_chid, bool add,
2875 bool wait_for_finish) 2891 bool wait_for_finish)
@@ -3296,6 +3312,7 @@ void gk20a_init_fifo(struct gpu_ops *gops)
3296 gops->fifo.get_num_fifos = gk20a_fifo_get_num_fifos; 3312 gops->fifo.get_num_fifos = gk20a_fifo_get_num_fifos;
3297 gops->fifo.get_pbdma_signature = gk20a_fifo_get_pbdma_signature; 3313 gops->fifo.get_pbdma_signature = gk20a_fifo_get_pbdma_signature;
3298 gops->fifo.set_runlist_interleave = gk20a_fifo_set_runlist_interleave; 3314 gops->fifo.set_runlist_interleave = gk20a_fifo_set_runlist_interleave;
3315 gops->fifo.tsg_set_timeslice = gk20a_fifo_tsg_set_timeslice;
3299 gops->fifo.force_reset_ch = gk20a_fifo_force_reset_ch; 3316 gops->fifo.force_reset_ch = gk20a_fifo_force_reset_ch;
3300 gops->fifo.engine_enum_from_type = gk20a_fifo_engine_enum_from_type; 3317 gops->fifo.engine_enum_from_type = gk20a_fifo_engine_enum_from_type;
3301 /* gk20a doesn't support device_info_data packet parsing */ 3318 /* gk20a doesn't support device_info_data packet parsing */
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
index c32142e3..20baf9de 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * GK20A graphics fifo (gr host) 4 * GK20A graphics fifo (gr host)
5 * 5 *
6 * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. 6 * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License, 9 * under the terms and conditions of the GNU General Public License,
@@ -231,6 +231,8 @@ int gk20a_fifo_set_runlist_interleave(struct gk20a *g,
231 bool is_tsg, 231 bool is_tsg,
232 u32 runlist_id, 232 u32 runlist_id,
233 u32 new_level); 233 u32 new_level);
234int gk20a_fifo_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice);
235
234 236
235void gk20a_fifo_debugfs_init(struct device *dev); 237void gk20a_fifo_debugfs_init(struct device *dev);
236 238
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index 81a4b78e..96d6873d 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -177,27 +177,24 @@ int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid)
177static int gk20a_tsg_set_priority(struct gk20a *g, struct tsg_gk20a *tsg, 177static int gk20a_tsg_set_priority(struct gk20a *g, struct tsg_gk20a *tsg,
178 u32 priority) 178 u32 priority)
179{ 179{
180 u32 timeslice_us;
181
180 switch (priority) { 182 switch (priority) {
181 case NVGPU_PRIORITY_LOW: 183 case NVGPU_PRIORITY_LOW:
182 tsg->timeslice_us = g->timeslice_low_priority_us; 184 timeslice_us = g->timeslice_low_priority_us;
183 break; 185 break;
184 case NVGPU_PRIORITY_MEDIUM: 186 case NVGPU_PRIORITY_MEDIUM:
185 tsg->timeslice_us = g->timeslice_medium_priority_us; 187 timeslice_us = g->timeslice_medium_priority_us;
186 break; 188 break;
187 case NVGPU_PRIORITY_HIGH: 189 case NVGPU_PRIORITY_HIGH:
188 tsg->timeslice_us = g->timeslice_high_priority_us; 190 timeslice_us = g->timeslice_high_priority_us;
189 break; 191 break;
190 default: 192 default:
191 pr_err("Unsupported priority"); 193 pr_err("Unsupported priority");
192 return -EINVAL; 194 return -EINVAL;
193 } 195 }
194 196
195 gk20a_channel_get_timescale_from_timeslice(g, tsg->timeslice_us, 197 return gk20a_tsg_set_timeslice(tsg, timeslice_us);
196 &tsg->timeslice_timeout, &tsg->timeslice_scale);
197
198 g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true);
199
200 return 0;
201} 198}
202 199
203static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg, 200static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg,
@@ -343,6 +340,8 @@ int gk20a_tsg_set_runlist_interleave(struct tsg_gk20a *tsg, u32 level)
343 struct gk20a *g = tsg->g; 340 struct gk20a *g = tsg->g;
344 int ret; 341 int ret;
345 342
343 gk20a_dbg(gpu_dbg_sched, "tsgid=%u interleave=%u", tsg->tsgid, level);
344
346 switch (level) { 345 switch (level) {
347 case NVGPU_RUNLIST_INTERLEAVE_LEVEL_LOW: 346 case NVGPU_RUNLIST_INTERLEAVE_LEVEL_LOW:
348 case NVGPU_RUNLIST_INTERLEAVE_LEVEL_MEDIUM: 347 case NVGPU_RUNLIST_INTERLEAVE_LEVEL_MEDIUM:
@@ -364,16 +363,9 @@ int gk20a_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice)
364{ 363{
365 struct gk20a *g = tsg->g; 364 struct gk20a *g = tsg->g;
366 365
367 if (timeslice < g->min_timeslice_us || 366 gk20a_dbg(gpu_dbg_sched, "tsgid=%u timeslice=%u us", tsg->tsgid, timeslice);
368 timeslice > g->max_timeslice_us)
369 return -EINVAL;
370
371 gk20a_channel_get_timescale_from_timeslice(g, timeslice,
372 &tsg->timeslice_timeout, &tsg->timeslice_scale);
373
374 tsg->timeslice_us = timeslice;
375 367
376 return g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true); 368 return g->ops.fifo.tsg_set_timeslice(tsg, timeslice);
377} 369}
378 370
379static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) 371static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg)
@@ -551,6 +543,8 @@ static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g,
551 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 543 struct gk20a_sched_ctrl *sched = &g->sched_ctrl;
552 int err; 544 int err;
553 545
546 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid);
547
554 mutex_lock(&sched->control_lock); 548 mutex_lock(&sched->control_lock);
555 if (sched->control_locked) { 549 if (sched->control_locked) {
556 err = -EPERM; 550 err = -EPERM;
@@ -576,6 +570,8 @@ static int gk20a_tsg_ioctl_set_timeslice(struct gk20a *g,
576 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 570 struct gk20a_sched_ctrl *sched = &g->sched_ctrl;
577 int err; 571 int err;
578 572
573 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid);
574
579 mutex_lock(&sched->control_lock); 575 mutex_lock(&sched->control_lock);
580 if (sched->control_locked) { 576 if (sched->control_locked) {
581 err = -EPERM; 577 err = -EPERM;
@@ -728,5 +724,4 @@ void gk20a_init_tsg_ops(struct gpu_ops *gops)
728{ 724{
729 gops->fifo.tsg_bind_channel = gk20a_tsg_bind_channel; 725 gops->fifo.tsg_bind_channel = gk20a_tsg_bind_channel;
730 gops->fifo.tsg_unbind_channel = gk20a_tsg_unbind_channel; 726 gops->fifo.tsg_unbind_channel = gk20a_tsg_unbind_channel;
731 gops->fifo.tsg_set_timeslice = gk20a_tsg_set_timeslice;
732} 727}
diff --git a/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c b/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c
index 3ffc7103..6be6be04 100644
--- a/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GM20B Fifo 2 * GM20B Fifo
3 * 3 *
4 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -158,6 +158,7 @@ void gm20b_init_fifo(struct gpu_ops *gops)
158 gops->fifo.get_num_fifos = gm20b_fifo_get_num_fifos; 158 gops->fifo.get_num_fifos = gm20b_fifo_get_num_fifos;
159 gops->fifo.get_pbdma_signature = gk20a_fifo_get_pbdma_signature; 159 gops->fifo.get_pbdma_signature = gk20a_fifo_get_pbdma_signature;
160 gops->fifo.set_runlist_interleave = gk20a_fifo_set_runlist_interleave; 160 gops->fifo.set_runlist_interleave = gk20a_fifo_set_runlist_interleave;
161 gops->fifo.tsg_set_timeslice = gk20a_fifo_tsg_set_timeslice;
161 gops->fifo.force_reset_ch = gk20a_fifo_force_reset_ch; 162 gops->fifo.force_reset_ch = gk20a_fifo_force_reset_ch;
162 gops->fifo.engine_enum_from_type = gk20a_fifo_engine_enum_from_type; 163 gops->fifo.engine_enum_from_type = gk20a_fifo_engine_enum_from_type;
163 gops->fifo.device_info_data_parse = gm20b_device_info_data_parse; 164 gops->fifo.device_info_data_parse = gm20b_device_info_data_parse;
diff --git a/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c b/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
index 9daf9e6d..e668d1ed 100644
--- a/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2017, 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,
@@ -114,6 +114,8 @@ static int vgpu_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice)
114 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); 114 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
115 err = err ? err : msg.ret; 115 err = err ? err : msg.ret;
116 WARN_ON(err); 116 WARN_ON(err);
117 if (!err)
118 tsg->timeslice_us = timeslice;
117 119
118 return err; 120 return err;
119} 121}