Skip to contentSkip to conversation

accel/ivpu: Reorder doorbell unregister and command queue destruction

PATCH In review Maciej Falkowski 2 participants 3 messages Jun 4, 2025 – Jun 5, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accel/ivpu: Reorder doorbell unregister and command queue destruction

From: Karol Wachowski <[email protected]>

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 2a18ceff9482 ("accel/ivpu: Implement support for hardware scheduler")
Cc <[email protected]> # v6.11+
---
 drivers/accel/ivpu/ivpu_job.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/accel/ivpu/ivpu_job.c +4 -4
index bd351dd46d6b..060f1fc031d3 100644
@@ -271,6 +271,10 @@ static int ivpu_cmdq_unregister(struct ivpu_file_priv *file_priv, struct ivpu_cm
 	if (!cmdq->db_id)
 		return 0;
 
+	ret = ivpu_jsm_unregister_db(vdev, cmdq->db_id);
+	if (!ret)
+		ivpu_dbg(vdev, JOB, "DB %d unregistered\n", cmdq->db_id);
+
 	if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW) {
 		ret = ivpu_jsm_hws_destroy_cmdq(vdev, file_priv->ctx.id, cmdq->id);
 		if (!ret)
@@ -278,10 +282,6 @@ static int ivpu_cmdq_unregister(struct ivpu_file_priv *file_priv, struct ivpu_cm
 				 cmdq->id, file_priv->ctx.id);
 	}
 
-	ret = ivpu_jsm_unregister_db(vdev, cmdq->db_id);
-	if (!ret)
-		ivpu_dbg(vdev, JOB, "DB %d unregistered\n", cmdq->db_id);
-
 	xa_erase(&file_priv->vdev->db_xa, cmdq->db_id);
 	cmdq->db_id = 0;
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Maciej Falkowski

From: Karol Wachowski <[email protected]>

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).

Quoted 8 lines

Ensure compliance with firmware expectations by moving the doorbell unregister call ahead of the command queue destruction logic, thus preventing unnecessary NOP operation.

Fixes 2a18ceff9482 ("accel/ivpu: Implement support for hardware scheduler")
Cc <[email protected]> # v6.11+

Huh? This was posted to the list on May 15th, and Jacek applied it to drm-misc-fixes on May 28th.

-Jeff

#2 lore raw
Quoted 15 lines · Jeff Hugo
Quoted 14 lines · Maciej Falkowski

From: Karol Wachowski <[email protected]>

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.

Quoted 6 lines
Quoted 4 lines
Fixes 2a18ceff9482 ("accel/ivpu: Implement support for hardware scheduler")
Cc <[email protected]> # v6.11+

Huh?  This was posted to the list on May 15th, and Jacek applied it to drm-misc-fixes on May 28th.

My apologies, you are right. I accidentally included it while checking latest changes.

Best regards,
Maciej

Quoted 2 lines

-Jeff