From a199baede7e59fd0b303c50d4a25fc0ee7c290d9 Mon Sep 17 00:00:00 2001 From: David Li Date: Thu, 10 Aug 2017 21:44:28 -0700 Subject: gpu: nvgpu: add NVGPU_SUBMIT_GPFIFO_FLAGS_RESCHEDULE_RUNLIST NVGPU_SUBMIT_GPFIFO_FLAGS_RESCHEDULE_RUNLIST causes host to expire current timeslice and reschedule from front of runlist. This can be used with NVGPU_RUNLIST_INTERLEAVE_LEVEL_HIGH to make a channel start sooner after submit rather than waiting for natural timeslice expiration or block/finish of currently running channel. Bug 1968813 Change-Id: I632e87c5f583a09ec8bf521dc73f595150abebb0 Signed-off-by: David Li Reviewed-on: http://git-master/r/#/c/1537198 Reviewed-on: https://git-master.nvidia.com/r/1537198 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c') 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: return ret; } +/* trigger host to expire current timeslice and reschedule runlist from front */ +int gk20a_fifo_reschedule_runlist(struct gk20a *g, u32 runlist_id) +{ + struct fifo_runlist_info_gk20a *runlist; + u32 token = PMU_INVALID_MUTEX_OWNER_ID; + u32 mutex_ret; + int ret = 0; + + runlist = &g->fifo.runlist_info[runlist_id]; + if (nvgpu_mutex_tryacquire(&runlist->mutex)) { + mutex_ret = nvgpu_pmu_mutex_acquire( + &g->pmu, PMU_MUTEX_ID_FIFO, &token); + + gk20a_writel(g, fifo_runlist_r(), + gk20a_readl(g, fifo_runlist_r())); + gk20a_fifo_runlist_wait_pending(g, runlist_id); + + if (!mutex_ret) + nvgpu_pmu_mutex_release( + &g->pmu, PMU_MUTEX_ID_FIFO, &token); + nvgpu_mutex_release(&runlist->mutex); + } else { + /* someone else is writing fifo_runlist_r so not needed here */ + ret = -EBUSY; + } + return ret; +} + /* add/remove a channel from runlist special cases below: runlist->active_channels will NOT be changed. (chid == ~0 && !add) means remove all active channels from runlist. -- cgit v1.2.2