summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index fd249bc9..7062a8a0 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -3211,6 +3211,34 @@ end:
3211 return ret; 3211 return ret;
3212} 3212}
3213 3213
3214/* trigger host to expire current timeslice and reschedule runlist from front */
3215int gk20a_fifo_reschedule_runlist(struct gk20a *g, u32 runlist_id)
3216{
3217 struct fifo_runlist_info_gk20a *runlist;
3218 u32 token = PMU_INVALID_MUTEX_OWNER_ID;
3219 u32 mutex_ret;
3220 int ret = 0;
3221
3222 runlist = &g->fifo.runlist_info[runlist_id];
3223 if (nvgpu_mutex_tryacquire(&runlist->mutex)) {
3224 mutex_ret = nvgpu_pmu_mutex_acquire(
3225 &g->pmu, PMU_MUTEX_ID_FIFO, &token);
3226
3227 gk20a_writel(g, fifo_runlist_r(),
3228 gk20a_readl(g, fifo_runlist_r()));
3229 gk20a_fifo_runlist_wait_pending(g, runlist_id);
3230
3231 if (!mutex_ret)
3232 nvgpu_pmu_mutex_release(
3233 &g->pmu, PMU_MUTEX_ID_FIFO, &token);
3234 nvgpu_mutex_release(&runlist->mutex);
3235 } else {
3236 /* someone else is writing fifo_runlist_r so not needed here */
3237 ret = -EBUSY;
3238 }
3239 return ret;
3240}
3241
3214/* add/remove a channel from runlist 3242/* add/remove a channel from runlist
3215 special cases below: runlist->active_channels will NOT be changed. 3243 special cases below: runlist->active_channels will NOT be changed.
3216 (chid == ~0 && !add) means remove all active channels from runlist. 3244 (chid == ~0 && !add) means remove all active channels from runlist.