habanalabs: add validity check for signal cs
authorfarah kassabri <fkassabri@habana.ai>
Tue, 1 Jun 2021 13:44:28 +0000 (16:44 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 21 Jun 2021 07:16:52 +0000 (10:16 +0300)
commit3817b352aad3b43f897c3034b16886cdb949b720
tree4fdf37b7518d924b4f357a95450da1eeee2e039c
parent69dbbbadad4f579048d441c5472482601a306935
habanalabs: add validity check for signal cs

In preparation for a new feature that allows the user to reserve
signals ahead of submissions, we need to change a current assumption
in the code.

Currently, the driver uses 2 SOBs to support signal CS. When the first
SOB reaches max value, the driver switches to the other one and assumes
that when it will need to switch back to the first one, all of the
signals have already been handled.

This assumption won't hold when the new feature will be added, because
using signal reservation, the driver can reach the max SOB value very
fast.

The change is to add a validity check when submitting a signal CS, to
make sure the previous SOB is available (all the signals attached to
it indeed finished).

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