summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index 37a326d2..5cd43329 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2015, 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,
@@ -126,6 +126,34 @@ int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid)
126 return 0; 126 return 0;
127} 127}
128 128
129static int gk20a_tsg_set_priority(struct gk20a *g, struct tsg_gk20a *tsg,
130 u32 priority)
131{
132 int timeslice_period;
133
134 switch (priority) {
135 case NVGPU_PRIORITY_LOW:
136 timeslice_period = g->timeslice_low_priority_us;
137 break;
138 case NVGPU_PRIORITY_MEDIUM:
139 timeslice_period = g->timeslice_medium_priority_us;
140 break;
141 case NVGPU_PRIORITY_HIGH:
142 timeslice_period = g->timeslice_high_priority_us;
143 break;
144 default:
145 pr_err("Unsupported priority");
146 return -EINVAL;
147 }
148
149 gk20a_channel_get_timescale_from_timeslice(g, timeslice_period,
150 &tsg->timeslice_timeout, &tsg->timeslice_scale);
151
152 g->ops.fifo.update_runlist(g, 0, ~0, true, true);
153
154 return 0;
155}
156
129static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) 157static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg)
130{ 158{
131 mutex_lock(&f->tsg_inuse_mutex); 159 mutex_lock(&f->tsg_inuse_mutex);
@@ -320,6 +348,13 @@ long gk20a_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
320 break; 348 break;
321 } 349 }
322 350
351 case NVGPU_IOCTL_TSG_SET_PRIORITY:
352 {
353 err = gk20a_tsg_set_priority(g, tsg,
354 ((struct nvgpu_set_priority_args *)buf)->priority);
355 break;
356 }
357
323 default: 358 default:
324 gk20a_err(dev_from_gk20a(g), 359 gk20a_err(dev_from_gk20a(g),
325 "unrecognized tsg gpu ioctl cmd: 0x%x", 360 "unrecognized tsg gpu ioctl cmd: 0x%x",