aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOded Gabbay <ogabbay@kernel.org>2022-01-19 00:09:29 +0200
committerOded Gabbay <ogabbay@kernel.org>2022-02-28 14:22:03 +0200
commit54faa5607b549ef7ef735e7d0c4523cc74bd20f4 (patch)
treedf2e78a0a353ef3fc3722de1267b0319a7805a1a
parent9a79e3e4a3637c07352d9723b825490a1b04391f (diff)
downloadiio-54faa5607b549ef7ef735e7d0c4523cc74bd20f4.tar.gz
habanalabs: fix user interrupt wait when timeout is 0
When timeout is 0, we need to return the busy status in case the target value wasn't reached upon entry to the ioctl. Also return the correct timestamp. Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
-rw-r--r--drivers/misc/habanalabs/common/command_submission.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
index 29e0549ff31d8f..8dd2f399d1c498 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -2858,8 +2858,7 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
struct hl_cb_mgr *cb_mgr, u64 timeout_us,
u64 cq_counters_handle, u64 cq_counters_offset,
u64 target_value, struct hl_user_interrupt *interrupt,
- u32 *status,
- u64 *timestamp)
+ u32 *status, u64 *timestamp)
{
struct hl_user_pending_interrupt *pend;
unsigned long timeout, flags;
@@ -2900,10 +2899,13 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
*status = HL_WAIT_CS_STATUS_COMPLETED;
/* There was no interrupt, we assume the completion is now. */
pend->fence.timestamp = ktime_get();
- }
+ goto set_timestamp;
- if (!timeout_us || (*status == HL_WAIT_CS_STATUS_COMPLETED))
+ } else if (!timeout_us) {
+ *status = HL_WAIT_CS_STATUS_BUSY;
+ pend->fence.timestamp = ktime_get();
goto set_timestamp;
+ }
/* Add pending user interrupt to relevant list for the interrupt
* handler to monitor