From 821699d3a364e8aa86140dd14f29d59830ae365e Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Wed, 29 Mar 2023 12:42:04 +0530 Subject: [PATCH] gpu: nvgpu: unset async subctx VM with correct index On deleting the subcontext, tsg->subctx_vms[] entries are set to NULL as per the subcontext id. For async subcontexts the index logic was used from that of tsg->async_veids bitmask. However subctx_vms is an array shared by all subcontexts hence index should be subcontext id aka veid. Also update the description of function nvgpu_tsg_validate_ch_subctx_vm as some of the functionality is now moved to another function nvgpu_tsg_create_sync_subcontext_internal. Bug 3979886 Change-Id: Ic290fb175b34988c6ffabe9c9dc4ec124d2c70af Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2879025 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/tsg.c | 2 +- drivers/gpu/nvgpu/include/nvgpu/tsg.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c index d0df5f00a..d426bf051 100644 --- a/drivers/gpu/nvgpu/common/fifo/tsg.c +++ b/drivers/gpu/nvgpu/common/fifo/tsg.c @@ -338,7 +338,7 @@ void nvgpu_tsg_delete_subcontext(struct gk20a *g, struct nvgpu_tsg *tsg, return; } nvgpu_clear_bit(veid - MAX_SYNC_SUBCONTEXTS, tsg->async_veids); - tsg->subctx_vms[veid - MAX_SYNC_SUBCONTEXTS] = NULL; + tsg->subctx_vms[veid] = NULL; } nvgpu_mutex_release(&tsg->veid_alloc_lock); diff --git a/drivers/gpu/nvgpu/include/nvgpu/tsg.h b/drivers/gpu/nvgpu/include/nvgpu/tsg.h index d310e5976..ebfb09363 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/tsg.h +++ b/drivers/gpu/nvgpu/include/nvgpu/tsg.h @@ -403,9 +403,6 @@ int nvgpu_tsg_create_sync_subcontext_internal(struct gk20a *g, * @param tsg [in] Pointer to TSG struct. * @param ch [in] Pointer to Channel struct. * - * - If this is first channel created without creating subcontext, - * then this channel is using subcontext with VEID 0 by default. - * Set subctx_vms and reserve the VEID0. * - If channel VM does not match subcontext VM return -EINVAL. * * @return 0 in case of success, < 0 in case of failure.