habanalabs: expose a single cs seq in staged submissions
authorOfir Bitton <obitton@habana.ai>
Sun, 12 Sep 2021 12:49:00 +0000 (15:49 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 14 Sep 2021 12:00:04 +0000 (15:00 +0300)
Staged submission consists of multiple command submissions.
In order to be explicit, driver should return a single cs sequence
for every cs in the submission, or else user may try to wait on
an internal CS rather than waiting for the whole submission.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/command_submission.c

index a4ed91ed991d5ddb36ad7004111adb1c117245c5..91b57544f7c6657750c4f0175b36e23fe2959eec 100644 (file)
@@ -1295,6 +1295,12 @@ static int cs_ioctl_default(struct hl_fpriv *hpriv, void __user *chunks,
        if (rc)
                goto free_cs_object;
 
+       /* If this is a staged submission we must return the staged sequence
+        * rather than the internal CS sequence
+        */
+       if (cs->staged_cs)
+               *cs_seq = cs->staged_sequence;
+
        /* Validate ALL the CS chunks before submitting the CS */
        for (i = 0 ; i < num_chunks ; i++) {
                struct hl_cs_chunk *chunk = &cs_chunk_array[i];