Skip to content

Commit 4557cc8

Browse files
kwachowsjlawryno
authored andcommitted
accel/ivpu: Reorder Doorbell Unregister and Command Queue Destruction
Refactor ivpu_cmdq_unregister() to ensure the doorbell is unregistered before destroying the command queue. The NPU firmware requires doorbells to be unregistered prior to command queue destruction. If doorbell remains registered when command queue destroy command is sent firmware will automatically unregister the doorbell, making subsequent unregister attempts no-operations (NOPs). Ensure compliance with firmware expectations by moving the doorbell unregister call ahead of the command queue destruction logic, thus preventing unnecessary NOP operation. Fixes: 465a391 ("accel/ivpu: Add API for command queue create/destroy/submit") Signed-off-by: Karol Wachowski <[email protected]> Reviewed-by: Jeff Hugo <[email protected]> Signed-off-by: Jacek Lawrynowicz <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1c2c0e2 commit 4557cc8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/accel/ivpu/ivpu_job.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,17 @@ static int ivpu_cmdq_unregister(struct ivpu_file_priv *file_priv, struct ivpu_cm
247247
if (!cmdq->db_id)
248248
return 0;
249249

250+
ret = ivpu_jsm_unregister_db(vdev, cmdq->db_id);
251+
if (!ret)
252+
ivpu_dbg(vdev, JOB, "DB %d unregistered\n", cmdq->db_id);
253+
250254
if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW) {
251255
ret = ivpu_jsm_hws_destroy_cmdq(vdev, file_priv->ctx.id, cmdq->id);
252256
if (!ret)
253257
ivpu_dbg(vdev, JOB, "Command queue %d destroyed, ctx %d\n",
254258
cmdq->id, file_priv->ctx.id);
255259
}
256260

257-
ret = ivpu_jsm_unregister_db(vdev, cmdq->db_id);
258-
if (!ret)
259-
ivpu_dbg(vdev, JOB, "DB %d unregistered\n", cmdq->db_id);
260-
261261
xa_erase(&file_priv->vdev->db_xa, cmdq->db_id);
262262
cmdq->db_id = 0;
263263

0 commit comments

Comments
 (0)