accel/habanalabs: Allow single timestamp registration request at a time
authorfarah kassabri <fkassabri@habana.ai>
Mon, 12 Jun 2023 10:47:49 +0000 (13:47 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 9 Oct 2023 09:37:18 +0000 (12:37 +0300)
commiteaa43a06b765542ee36f38bdd92b04bdc8645964
tree922e9c201c3ba77e248730bac16b6d1455147bf7
parent964b1f675dac62763feaa6cec188be9f92aa9e57
accel/habanalabs: Allow single timestamp registration request at a time

Protect against concurrency of user requesting to register a timestamp
offset (where the driver fills the timestamp when the command submission
has finished executing) to a specific user interrupt ID. The
protection is basically to allow only one timestamp registration
request to be handled at a time.

This is needed because the user can decide to re-use a timestamp
offset (register an already registered offset, to a different
interrupt ID). This means the request will cause the timestamp node to
move from one interrupt list to another interrupt list. In such
scenario, without proper protection, we could end up adding the same
node twice to the interrupts wait lists.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/accel/habanalabs/common/command_submission.c
drivers/accel/habanalabs/common/context.c
drivers/accel/habanalabs/common/habanalabs.h
drivers/accel/habanalabs/common/irq.c