summaryrefslogtreecommitdiff
path: root/drivers/misc/habanalabs/context.c
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2019-05-04 17:36:06 +0300
committerOded Gabbay <oded.gabbay@gmail.com>2019-05-04 17:36:06 +0300
commit19734970c98b075e0159bf494d4287820522cc80 (patch)
treeee22af5b4a7e997c6577769c82f172c76ab62ed6 /drivers/misc/habanalabs/context.c
parentd1287493abe27a055b739ded3d812952b61e99ab (diff)
habanalabs: force user to set device debug mode
This patch adds the implementation of the HL_DEBUG_OP_SET_MODE opcode in the DEBUG IOCTL. It forces the user who wants to debug the device to set the device into debug mode before he can configure the debug engines. The patch also makes sure to disable debug mode upon user releasing FD, in case the user forgot to disable debug mode. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/misc/habanalabs/context.c')
-rw-r--r--drivers/misc/habanalabs/context.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/misc/habanalabs/context.c b/drivers/misc/habanalabs/context.c
index f4c92f110a72..280f4625e313 100644
--- a/drivers/misc/habanalabs/context.c
+++ b/drivers/misc/habanalabs/context.c
@@ -31,7 +31,9 @@ static void hl_ctx_fini(struct hl_ctx *ctx)
* Coresight might be still working by accessing addresses
* related to the stopped engines. Hence stop it explicitly.
*/
- hdev->asic_funcs->halt_coresight(hdev);
+ if (hdev->in_debug)
+ hl_device_set_debug_mode(hdev, false);
+
hl_vm_ctx_fini(ctx);
hl_asid_free(hdev, ctx->asid);
}