From a80c445a5daa232650cfb9e4cd780eda22ba1190 Mon Sep 17 00:00:00 2001 From: Antony Clince Alex Date: Sat, 21 May 2022 12:47:25 +0000 Subject: [PATCH] gpu: nvgpu: ga10b: update runlist.write_state Update HAL function runlist.write_state to skip in-active runlists in fifo.runlists. It is possible for one or more engines to be floorswept in which case their associated runlist will be in-active, example, if host supports 3 runlists(0, 1, 2) each serving 3 engines(0, 1, 2), and engine-1 is floorswept, then runlist-1 becomes in-active and the entry fifo->runlists[1] will be set to NULL. Bug 3650588 Change-Id: Iaf9d75e310903c47b842e84dcfa2209d9fe7da96 Signed-off-by: Antony Clince Alex (cherry picked from commit e29a2019cf8f4796737c670f98164f7783448d49) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2717075 Reviewed-by: svcacv Reviewed-by: Seema Khowala Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/hal/fifo/runlist_fifo_ga10b_fusa.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/hal/fifo/runlist_fifo_ga10b_fusa.c b/drivers/gpu/nvgpu/hal/fifo/runlist_fifo_ga10b_fusa.c index 852a4e2f7..643582aaf 100644 --- a/drivers/gpu/nvgpu/hal/fifo/runlist_fifo_ga10b_fusa.c +++ b/drivers/gpu/nvgpu/hal/fifo/runlist_fifo_ga10b_fusa.c @@ -128,8 +128,15 @@ void ga10b_runlist_write_state(struct gk20a *g, u32 runlists_mask, while (runlists_mask != 0U && (runlist_id < g->fifo.max_runlists)) { if ((runlists_mask & BIT32(runlist_id)) != 0U) { runlist = g->fifo.runlists[runlist_id]; - nvgpu_runlist_writel(g, runlist, - runlist_sched_disable_r(), reg_val); + /* + * Its possible that some of the engines might be + * FSed, in which case the entry in fifo.runlists will + * be NULL, hence perform a NULL check first. + */ + if (runlist != NULL) { + nvgpu_runlist_writel(g, runlist, + runlist_sched_disable_r(), reg_val); + } } runlists_mask &= ~BIT32(runlist_id); runlist_id++;