summaryrefslogtreecommitdiffstats
path: root/drivers/misc/habanalabs/command_submission.c
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2019-03-03 15:13:15 +0200
committerOded Gabbay <oded.gabbay@gmail.com>2019-03-03 15:13:15 +0200
commitcbaa99ed1b697072f089693a7fe2d649d08bf317 (patch)
tree0af62e0d486c1aae0539c7d44cc3ddc3bbf26107 /drivers/misc/habanalabs/command_submission.c
parentd12a5e2458d49aad2b7d25766794eec95ae8f6f1 (diff)
downloadlinux-cbaa99ed1b697072f089693a7fe2d649d08bf317.tar.bz2
habanalabs: perform accounting for active CS
This patch adds accounting for active CS. Active means that the CS was submitted to the H/W queues and was not completed yet. This is necessary to support suspend operation. Because the device will be reset upon suspend, we can only suspend after all active CS have been completed. Hence, we need to perform accounting on their number. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/misc/habanalabs/command_submission.c')
-rw-r--r--drivers/misc/habanalabs/command_submission.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/command_submission.c b/drivers/misc/habanalabs/command_submission.c
index 3525236ed8d9..19c84214a7ea 100644
--- a/drivers/misc/habanalabs/command_submission.c
+++ b/drivers/misc/habanalabs/command_submission.c
@@ -179,6 +179,12 @@ static void cs_do_release(struct kref *ref)
/* We also need to update CI for internal queues */
if (cs->submitted) {
+ int cs_cnt = atomic_dec_return(&hdev->cs_active_cnt);
+
+ WARN_ONCE((cs_cnt < 0),
+ "hl%d: error in CS active cnt %d\n",
+ hdev->id, cs_cnt);
+
hl_int_hw_queue_update_ci(cs);
spin_lock(&hdev->hw_queues_mirror_lock);