diff options
author | Oded Gabbay | 2019-03-17 08:12:29 +0100 |
---|---|---|
committer | Oded Gabbay | 2019-03-17 08:12:29 +0100 |
commit | 0878a42086e0a6228f804655bb544147a531bb57 (patch) | |
tree | 2ba6cbab552724e9dec2f3f7b25fac1da312861b /drivers/misc/habanalabs | |
parent | habanalabs: keep track of the device's dma mask (diff) | |
download | kernel-qcow2-linux-0878a42086e0a6228f804655bb544147a531bb57.tar.gz kernel-qcow2-linux-0878a42086e0a6228f804655bb544147a531bb57.tar.xz kernel-qcow2-linux-0878a42086e0a6228f804655bb544147a531bb57.zip |
habanalabs: never fail hard reset of device
Hard-reset of our device should never fail, due to dangers of permanent
damage to the H/W.
This patch removes the last place in the reset path where the driver might
exit before doing the actual reset.
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/misc/habanalabs')
-rw-r--r-- | drivers/misc/habanalabs/device.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c index 77d51be66c7e..c51d1062d0bc 100644 --- a/drivers/misc/habanalabs/device.c +++ b/drivers/misc/habanalabs/device.c @@ -663,17 +663,9 @@ again: /* Go over all the queues, release all CS and their jobs */ hl_cs_rollback_all(hdev); - if (hard_reset) { - /* Release kernel context */ - if (hl_ctx_put(hdev->kernel_ctx) != 1) { - dev_err(hdev->dev, - "kernel ctx is alive during hard reset\n"); - rc = -EBUSY; - goto out_err; - } - + /* Release kernel context */ + if ((hard_reset) && (hl_ctx_put(hdev->kernel_ctx) == 1)) hdev->kernel_ctx = NULL; - } /* Reset the H/W. It will be in idle state after this returns */ hdev->asic_funcs->hw_fini(hdev, hard_reset); @@ -699,6 +691,13 @@ again: if (hard_reset) { hdev->device_cpu_disabled = false; + if (hdev->kernel_ctx) { + dev_crit(hdev->dev, + "kernel ctx was alive during hard reset, something is terribly wrong\n"); + rc = -EBUSY; + goto out_err; + } + /* Allocate the kernel context */ hdev->kernel_ctx = kzalloc(sizeof(*hdev->kernel_ctx), GFP_KERNEL); |