diff options
author | farah kassabri <fkassabri@habana.ai> | 2021-05-26 10:43:36 +0300 |
---|---|---|
committer | Oded Gabbay <ogabbay@kernel.org> | 2021-08-29 09:47:48 +0300 |
commit | e4cdccd2ec0d178219dce0707aa2a63746119e3f (patch) | |
tree | d20e660a0cd524e0e5cd1ce04aaa4bfcf177b492 /drivers/misc/habanalabs/common/context.c | |
parent | dadf17abb7245d9556591d8cc78bf57462e3b20a (diff) | |
download | lwn-e4cdccd2ec0d178219dce0707aa2a63746119e3f.tar.gz lwn-e4cdccd2ec0d178219dce0707aa2a63746119e3f.zip |
habanalabs: add support for encapsulated signals submission
This commit is the second part of the encapsulated signals feature.
It contains the driver support for submission of cs with encapsulated
signals and the wait for them.
Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/habanalabs/common/context.c')
-rw-r--r-- | drivers/misc/habanalabs/common/context.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/misc/habanalabs/common/context.c b/drivers/misc/habanalabs/common/context.c index abbba4194d3b..007f3a48601c 100644 --- a/drivers/misc/habanalabs/common/context.c +++ b/drivers/misc/habanalabs/common/context.c @@ -16,7 +16,10 @@ void hl_encaps_handle_do_release(struct kref *ref) struct hl_ctx *ctx = handle->hdev->compute_ctx; struct hl_encaps_signals_mgr *mgr = &ctx->sig_mgr; + spin_lock(&mgr->lock); idr_remove(&mgr->handles, handle->id); + spin_unlock(&mgr->lock); + kfree(handle); } @@ -33,7 +36,10 @@ static void hl_encaps_handle_do_release_sob(struct kref *ref) */ hw_sob_put(handle->hw_sob); + spin_lock(&mgr->lock); idr_remove(&mgr->handles, handle->id); + spin_unlock(&mgr->lock); + kfree(handle); } @@ -67,11 +73,6 @@ static void hl_ctx_fini(struct hl_ctx *ctx) struct hl_device *hdev = ctx->hdev; int i; - /* Release all allocated pending cb's, those cb's were never - * scheduled so it is safe to release them here - */ - hl_pending_cb_list_flush(ctx); - /* Release all allocated HW block mapped list entries and destroy * the mutex. */ @@ -198,11 +199,8 @@ int hl_ctx_init(struct hl_device *hdev, struct hl_ctx *ctx, bool is_kernel_ctx) kref_init(&ctx->refcount); ctx->cs_sequence = 1; - INIT_LIST_HEAD(&ctx->pending_cb_list); - spin_lock_init(&ctx->pending_cb_lock); spin_lock_init(&ctx->cs_lock); atomic_set(&ctx->thread_ctx_switch_token, 1); - atomic_set(&ctx->thread_pending_cb_token, 1); ctx->thread_ctx_switch_wait_token = 0; ctx->cs_pending = kcalloc(hdev->asic_prop.max_pending_cs, sizeof(struct hl_fence *), |