aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomer Tayar <[email protected]>2021-07-09 17:34:45 +0300
committerOded Gabbay <[email protected]>2021-08-29 09:47:46 +0300
commita9623a8b3ae67d04187b7a4478d4e4155720eebc (patch)
treec0d3d8fcb0522d13a6ffba519707b7275c43a81e
parent89aad770d692e4d2d9a604c1674e9dfa69421430 (diff)
habanalabs: mark linux image as not loaded after hw_fini
If hard reset fails after the call to hw_fini and before loading the linux image to the device, a subsequent call to hw_fini should communicate via COMMS (or MSG_TO_CPU regs for old FW versions). However, the driver still tries in this case to communicate via the GIC, and thus no hard reset is actually done. To avoid that, the patch clears the linux_loaded flag after every call to hw_fini. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
-rw-r--r--drivers/misc/habanalabs/common/device.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index 28fe15a28361..4fcd24e5a609 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -1075,9 +1075,12 @@ kill_processes:
hdev->asic_funcs->hw_fini(hdev, hard_reset);
if (hard_reset) {
+ hdev->fw_loader.linux_loaded = false;
+
/* Release kernel context */
if (hdev->kernel_ctx && hl_ctx_put(hdev->kernel_ctx) == 1)
hdev->kernel_ctx = NULL;
+
hl_vm_fini(hdev);
hl_mmu_fini(hdev);
hl_eq_reset(hdev, &hdev->event_queue);
@@ -1611,6 +1614,8 @@ void hl_device_fini(struct hl_device *hdev)
/* Reset the H/W. It will be in idle state after this returns */
hdev->asic_funcs->hw_fini(hdev, true);
+ hdev->fw_loader.linux_loaded = false;
+
/* Release kernel context */
if ((hdev->kernel_ctx) && (hl_ctx_put(hdev->kernel_ctx) != 1))
dev_err(hdev->dev, "kernel ctx is still alive\n");