From c8429c5de9f7da036fe91c1da18214f4c8b8e73e Mon Sep 17 00:00:00 2001 From: rmylavarapu Date: Thu, 13 Oct 2022 16:41:42 +0000 Subject: [PATCH] gpu: nvgpu: gsp sched: get device id from runlist pri base Get the device id from runlist pri base instead of reading from runlist structure which could be failing if the device node not present inside the runlist struct. This Change will call the get device id hal to get it from rlend_id and runlist pri base. NVGPU-8531 Change-Id: Ia81189a6c2281ed09ee52eb461f0cd87164c5fc4 Signed-off-by: rmylavarapu Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2791605 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/runlist.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/nvgpu/common/fifo/runlist.c b/drivers/gpu/nvgpu/common/fifo/runlist.c index 5e3ffa1d6..4f41b7324 100644 --- a/drivers/gpu/nvgpu/common/fifo/runlist.c +++ b/drivers/gpu/nvgpu/common/fifo/runlist.c @@ -1376,20 +1376,16 @@ exit: s32 nvgpu_runlist_get_device_id(struct gk20a *g, struct nvgpu_runlist *rl, u32 *device_id) { - u8 dev; s32 err = 0; + u32 rleng_id = 0; - for (dev = 0; dev < (u8)(RLENG_PER_RUNLIST_SIZE); dev++) { - u32 rl_pribase =rl->rl_dev_list[dev]->rl_pri_base; - if (rl->runlist_pri_base == rl_pribase) { - *device_id = rl->rl_dev_list[dev]->engine_id; - goto exit; - } + if (g->ops.runlist.get_engine_id_from_rleng_id != NULL) { + *device_id = g->ops.runlist.get_engine_id_from_rleng_id(g, rleng_id, rl->runlist_pri_base); + } else { + err = (s32)(-EINVAL); + nvgpu_err(g, "Get device ID failed:"); } - err = (s32)(-EINVAL); - nvgpu_err(g, "Get device ID failed:"); -exit: return err; }