habanalabs: refactor fence handling in hl_cs_poll_fences
authorDani Liberman <dliberman@habana.ai>
Tue, 12 Oct 2021 10:30:27 +0000 (13:30 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 18 Oct 2021 09:05:48 +0000 (12:05 +0300)
commitb2faac3887df87a6e4bc3356280ea35dc7459c0b
tree26feb29bd95d743c3ce874057fb2ed4809b91931
parentfae132632c55fdab81a81e0fd3d578d38ce43f78
habanalabs: refactor fence handling in hl_cs_poll_fences

To avoid checking if fence exists multipled times, changed fence
handling to depend only on the fence status field:

Busy, which means CS still did not completed :
Add its QID so multi CS wait on its completion.
Finished, which means CS completed and fence exists:
Raise its completion bit if it finished mcs handling and
update if necessary the earliest timestamp.
Gone, which means CS already completed and fence deleted:
Update multi CS data to ignore timestamp and raise its
completion bit.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/command_submission.c