summaryrefslogtreecommitdiff
path: root/drivers/misc/habanalabs/common/habanalabs.h
diff options
context:
space:
mode:
authorOfir Bitton <obitton@habana.ai>2021-11-23 16:15:22 +0300
committerOded Gabbay <ogabbay@kernel.org>2021-12-26 15:42:11 +0300
commit42eb2872e0867679c996bb19ee9063e6141fa974 (patch)
tree54f11b2c2a27fa3e0060daf984d7a18a739a93a5 /drivers/misc/habanalabs/common/habanalabs.h
parenteb135291912f7554e2a2472befc44818098baa8d (diff)
downloadlinux-42eb2872e0867679c996bb19ee9063e6141fa974.tar.xz
habanalabs: add a lock to protect multiple reset variables
Atomic operations during reset are replaced by a spinlock in order to have the ability to protect more than a single variable. Signed-off-by: Ofir Bitton <obitton@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/habanalabs/common/habanalabs.h')
-rw-r--r--drivers/misc/habanalabs/common/habanalabs.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/misc/habanalabs/common/habanalabs.h b/drivers/misc/habanalabs/common/habanalabs.h
index 47eaeff9e924..37a3a469b42f 100644
--- a/drivers/misc/habanalabs/common/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -2457,9 +2457,10 @@ struct last_error_session_info {
/**
* struct hl_reset_info - holds current device reset information.
- * @in_reset: is device in reset flow.
+ * @lock: lock to protect critical reset flows.
* @soft_reset_cnt: number of soft reset since the driver was loaded.
* @hard_reset_cnt: number of hard reset since the driver was loaded.
+ * @in_reset: is device in reset flow.
* @is_in_soft_reset: Device is currently in soft reset process.
* @needs_reset: true if reset_on_lockup is false and device should be reset
* due to lockup.
@@ -2474,9 +2475,10 @@ struct last_error_session_info {
* complete instead.
*/
struct hl_reset_info {
- atomic_t in_reset;
+ spinlock_t lock;
u32 soft_reset_cnt;
u32 hard_reset_cnt;
+ u8 in_reset;
u8 is_in_soft_reset;
u8 needs_reset;
u8 hard_reset_pending;