summaryrefslogtreecommitdiff
path: root/drivers/misc/habanalabs/common/context.c
diff options
context:
space:
mode:
authorOfir Bitton <obitton@habana.ai>2020-07-13 13:36:55 +0300
committerOded Gabbay <oded.gabbay@gmail.com>2020-07-24 20:31:37 +0300
commita04b7cd97eef13a489ca44c979cf91e24cfa7b55 (patch)
tree5e887df646106fcb7d155cec600b76b8dc5f5903 /drivers/misc/habanalabs/common/context.c
parenteb8b293e794bbbafa9d615ea939982a19bf92867 (diff)
downloadlwn-a04b7cd97eef13a489ca44c979cf91e24cfa7b55.tar.gz
lwn-a04b7cd97eef13a489ca44c979cf91e24cfa7b55.zip
habanalabs: create internal CB pool
Create a device MMU-mapped internal command buffer pool, in order to allow the driver to allocate CBs for the signal/wait operations that are fetched by the queues when they are configured with the user's address space ID. We must pre-map this internal pool due to performance issues. This pool is needed for future ASIC support and it is currently unused in GOYA and GAUDI. Signed-off-by: Ofir Bitton <obitton@habana.ai> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/misc/habanalabs/common/context.c')
-rw-r--r--drivers/misc/habanalabs/common/context.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/common/context.c b/drivers/misc/habanalabs/common/context.c
index 1e3e5b19ecd9..b75a20364fad 100644
--- a/drivers/misc/habanalabs/common/context.c
+++ b/drivers/misc/habanalabs/common/context.c
@@ -153,10 +153,18 @@ int hl_ctx_init(struct hl_device *hdev, struct hl_ctx *ctx, bool is_kernel_ctx)
rc = -ENOMEM;
goto mem_ctx_err;
}
+
+ rc = hdev->asic_funcs->ctx_init(ctx);
+ if (rc) {
+ dev_err(hdev->dev, "ctx_init failed\n");
+ goto ctx_init_err;
+ }
}
return 0;
+ctx_init_err:
+ hl_vm_ctx_fini(ctx);
mem_ctx_err:
if (ctx->asid != HL_KERNEL_ASID_ID)
hl_asid_free(hdev, ctx->asid);