Commit 681a22f5 authored by Oded Gabbay's avatar Oded Gabbay

habanalabs: allow to wait on CS without sleep

The user sometimes wants to check if a CS has completed to clean resources.
In that case, the user doesn't want to sleep but just to check if the CS
has finished and continue with his code.

Add a new definition to the API of the wait on CS. The new definition says
that if the timeout is 0, the driver won't sleep at all but return
immediately after checking if the CS has finished.
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent 230b9b7d
...@@ -1180,8 +1180,11 @@ static long _hl_cs_wait_ioctl(struct hl_device *hdev, ...@@ -1180,8 +1180,11 @@ static long _hl_cs_wait_ioctl(struct hl_device *hdev,
"Can't wait on CS %llu because current CS is at seq %llu\n", "Can't wait on CS %llu because current CS is at seq %llu\n",
seq, ctx->cs_sequence); seq, ctx->cs_sequence);
} else if (fence) { } else if (fence) {
rc = wait_for_completion_interruptible_timeout( if (!timeout_us)
&fence->completion, timeout); rc = completion_done(&fence->completion);
else
rc = wait_for_completion_interruptible_timeout(
&fence->completion, timeout);
if (fence->error == -ETIMEDOUT) if (fence->error == -ETIMEDOUT)
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
......
...@@ -914,6 +914,9 @@ struct hl_debug_args { ...@@ -914,6 +914,9 @@ struct hl_debug_args {
* inside the kernel until the CS has finished or until the user-requested * inside the kernel until the CS has finished or until the user-requested
* timeout has expired. * timeout has expired.
* *
* If the timeout value is 0, the driver won't sleep at all. It will check
* the status of the CS and return immediately
*
* The return value of the IOCTL is a standard Linux error code. The possible * The return value of the IOCTL is a standard Linux error code. The possible
* values are: * values are:
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment