summaryrefslogtreecommitdiff
path: root/drivers/misc/habanalabs/gaudi/gaudi.c
diff options
context:
space:
mode:
authorTal Cohen <talcohen@habana.ai>2022-06-08 16:02:09 +0300
committerOded Gabbay <ogabbay@kernel.org>2022-07-12 09:09:22 +0300
commitbe572e67dafbf8004d46a2c9d97338c107efb60e (patch)
treee44e645f4276837d00249d721937a9620d20bfdb /drivers/misc/habanalabs/gaudi/gaudi.c
parent647469148360dc873405acc6fcf63772e9e401f4 (diff)
habanalabs/gaudi: invoke device reset from one code block
In order to prepare the driver code for device reset event notification, change the event handler function flow to call device reset from one code block. In addition, the commit fixes an issue that reset was performed w/o checking the 'hard_reset_on_fw_event' state and w/o setting the HL_DRV_RESET_DELAY flag. Signed-off-by: Tal Cohen <talcohen@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/habanalabs/gaudi/gaudi.c')
-rw-r--r--drivers/misc/habanalabs/gaudi/gaudi.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index ec9f0a93cbe2..8f37297b2c3b 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -7795,10 +7795,10 @@ static void gaudi_handle_eqe(struct hl_device *hdev,
struct gaudi_device *gaudi = hdev->asic_specific;
u64 data = le64_to_cpu(eq_entry->data[0]), event_mask = 0;
u32 ctl = le32_to_cpu(eq_entry->hdr.ctl);
- u32 fw_fatal_err_flag = 0;
+ u32 fw_fatal_err_flag = 0, flags = 0;
u16 event_type = ((ctl & EQ_CTL_EVENT_TYPE_MASK)
>> EQ_CTL_EVENT_TYPE_SHIFT);
- bool reset_required;
+ bool reset_required, reset_direct = false;
u8 cause;
int rc;
@@ -7886,7 +7886,8 @@ static void gaudi_handle_eqe(struct hl_device *hdev,
dev_err(hdev->dev, "reset required due to %s\n",
gaudi_irq_map_table[event_type].name);
- hl_device_reset(hdev, 0);
+ reset_direct = true;
+ goto reset_device;
} else {
hl_fw_unmask_irq(hdev, event_type);
}
@@ -7908,7 +7909,8 @@ static void gaudi_handle_eqe(struct hl_device *hdev,
dev_err(hdev->dev, "reset required due to %s\n",
gaudi_irq_map_table[event_type].name);
- hl_device_reset(hdev, 0);
+ reset_direct = true;
+ goto reset_device;
} else {
hl_fw_unmask_irq(hdev, event_type);
}
@@ -8050,12 +8052,17 @@ static void gaudi_handle_eqe(struct hl_device *hdev,
return;
reset_device:
- if (hdev->asic_prop.fw_security_enabled)
- hl_device_reset(hdev, HL_DRV_RESET_HARD
- | HL_DRV_RESET_BYPASS_REQ_TO_FW
- | fw_fatal_err_flag);
+ reset_required = true;
+
+ if (hdev->asic_prop.fw_security_enabled && !reset_direct)
+ flags = HL_DRV_RESET_HARD | HL_DRV_RESET_BYPASS_REQ_TO_FW | fw_fatal_err_flag;
else if (hdev->hard_reset_on_fw_events)
- hl_device_reset(hdev, HL_DRV_RESET_HARD | HL_DRV_RESET_DELAY | fw_fatal_err_flag);
+ flags = HL_DRV_RESET_HARD | HL_DRV_RESET_DELAY | fw_fatal_err_flag;
+ else
+ reset_required = false;
+
+ if (reset_required)
+ hl_device_reset(hdev, flags);
else
hl_fw_unmask_irq(hdev, event_type);
}