summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c55
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.h1
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_tsg.c4
3 files changed, 47 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index 9a867bcb..781a803e 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -914,6 +914,48 @@ clean_up:
914 return ret; 914 return ret;
915} 915}
916 916
917/*
918 * Convert linux specific runlist level of the form NVGPU_RUNLIST_INTERLEAVE_LEVEL_*
919 * to common runlist level of the form NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_*
920 */
921u32 nvgpu_get_common_runlist_level(u32 level)
922{
923 switch (level) {
924 case NVGPU_RUNLIST_INTERLEAVE_LEVEL_LOW:
925 return NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_LOW;
926 case NVGPU_RUNLIST_INTERLEAVE_LEVEL_MEDIUM:
927 return NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_MEDIUM;
928 case NVGPU_RUNLIST_INTERLEAVE_LEVEL_HIGH:
929 return NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_HIGH;
930 default:
931 pr_err("%s: incorrect runlist level\n", __func__);
932 }
933
934 return level;
935}
936
937static int gk20a_ioctl_channel_set_runlist_interleave(struct channel_gk20a *ch,
938 u32 level)
939{
940 int err = 0;
941
942 err = gk20a_busy(ch->g);
943 if (err) {
944 nvgpu_err(ch->g, "failed to power on, %d", err);
945 goto fail;
946 }
947
948 level = nvgpu_get_common_runlist_level(level);
949 err = gk20a_channel_set_runlist_interleave(ch, level);
950
951 gk20a_idle(ch->g);
952 gk20a_channel_trace_sched_param(
953 trace_gk20a_channel_set_runlist_interleave, ch);
954
955fail:
956 return err;
957}
958
917long gk20a_channel_ioctl(struct file *filp, 959long gk20a_channel_ioctl(struct file *filp,
918 unsigned int cmd, unsigned long arg) 960 unsigned int cmd, unsigned long arg)
919{ 961{
@@ -1202,19 +1244,8 @@ long gk20a_channel_ioctl(struct file *filp,
1202 (struct nvgpu_channel_wdt_args *)buf); 1244 (struct nvgpu_channel_wdt_args *)buf);
1203 break; 1245 break;
1204 case NVGPU_IOCTL_CHANNEL_SET_RUNLIST_INTERLEAVE: 1246 case NVGPU_IOCTL_CHANNEL_SET_RUNLIST_INTERLEAVE:
1205 err = gk20a_busy(ch->g); 1247 err = gk20a_ioctl_channel_set_runlist_interleave(ch,
1206 if (err) {
1207 dev_err(dev,
1208 "%s: failed to host gk20a for ioctl cmd: 0x%x",
1209 __func__, cmd);
1210 break;
1211 }
1212 err = gk20a_channel_set_runlist_interleave(ch,
1213 ((struct nvgpu_runlist_interleave_args *)buf)->level); 1248 ((struct nvgpu_runlist_interleave_args *)buf)->level);
1214
1215 gk20a_idle(ch->g);
1216 gk20a_channel_trace_sched_param(
1217 trace_gk20a_channel_set_runlist_interleave, ch);
1218 break; 1249 break;
1219 case NVGPU_IOCTL_CHANNEL_SET_TIMESLICE: 1250 case NVGPU_IOCTL_CHANNEL_SET_TIMESLICE:
1220 err = gk20a_busy(ch->g); 1251 err = gk20a_busy(ch->g);
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.h b/drivers/gpu/nvgpu/common/linux/ioctl_channel.h
index c3cd11c7..48caf9df 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.h
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.h
@@ -31,4 +31,5 @@ extern const struct file_operations gk20a_event_id_ops;
31extern const struct file_operations gk20a_channel_ops; 31extern const struct file_operations gk20a_channel_ops;
32 32
33u32 nvgpu_event_id_to_ioctl_channel_event_id(u32 event_id); 33u32 nvgpu_event_id_to_ioctl_channel_event_id(u32 event_id);
34u32 nvgpu_get_common_runlist_level(u32 level);
34#endif 35#endif
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
index 681a5e66..eb223382 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
@@ -328,6 +328,7 @@ static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g,
328{ 328{
329 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); 329 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
330 struct gk20a_sched_ctrl *sched = &l->sched_ctrl; 330 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
331 u32 level = arg->level;
331 int err; 332 int err;
332 333
333 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); 334 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid);
@@ -343,7 +344,8 @@ static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g,
343 goto done; 344 goto done;
344 } 345 }
345 346
346 err = gk20a_tsg_set_runlist_interleave(tsg, arg->level); 347 level = nvgpu_get_common_runlist_level(level);
348 err = gk20a_tsg_set_runlist_interleave(tsg, level);
347 349
348 gk20a_idle(g); 350 gk20a_idle(g);
349done: 351done: