summaryrefslogtreecommitdiff
path: root/drivers/misc/habanalabs/command_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/habanalabs/command_buffer.c')
-rw-r--r--drivers/misc/habanalabs/command_buffer.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/misc/habanalabs/command_buffer.c b/drivers/misc/habanalabs/command_buffer.c
index e659ca3035e4..1e90025204c0 100644
--- a/drivers/misc/habanalabs/command_buffer.c
+++ b/drivers/misc/habanalabs/command_buffer.c
@@ -91,9 +91,14 @@ int hl_cb_create(struct hl_device *hdev, struct hl_cb_mgr *mgr,
bool alloc_new_cb = true;
int rc;
- if (hdev->disabled) {
+ /*
+ * Can't use generic function to check this because of special case
+ * where we create a CB as part of the reset process
+ */
+ if ((hdev->disabled) || ((atomic_read(&hdev->in_reset)) &&
+ (ctx_id != HL_KERNEL_ASID_ID))) {
dev_warn_ratelimited(hdev->dev,
- "Device is disabled. Can't create new CBs\n");
+ "Device is disabled or in reset. Can't create new CBs\n");
rc = -EBUSY;
goto out_err;
}