gpu: nvgpu: track gr_ctx init state

On successful obj_ctx allocation, set ctx_initialized member in gr_ctx
to true and when it is true then only invoke free_gr_ctx.

With this we can get rid of tsg->vm check while calling free_gr_ctx.
tsg->vm will go away with multiple address spaces support in TSG.

Bug 3677982

Change-Id: I4a64842411ce4ab157010808e4e8e4d5cd254a7f
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2746803
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2022-07-16 11:24:11 +05:30
committed by mobile promotions
parent b1802085f2
commit 3fb2a2e209
6 changed files with 42 additions and 3 deletions

View File

@@ -530,6 +530,28 @@ void nvgpu_gr_ctx_set_tsgid(struct nvgpu_gr_ctx *gr_ctx, u32 tsgid);
*/
u32 nvgpu_gr_ctx_get_tsgid(struct nvgpu_gr_ctx *gr_ctx);
/**
* @brief Mark graphics context initialized.
*
* @param gr_ctx [in] Pointer to graphics context struct.
*
* This function will mark obj_ctx initialized for the gr_ctx by
* setting ctx_initialized to true.
*/
void nvgpu_gr_ctx_mark_ctx_initialized(struct nvgpu_gr_ctx *gr_ctx);
/**
* @brief Get ctx_initialized stored in graphics context structure.
*
* @param gr_ctx [in] Pointer to graphics context struct.
*
* This function will return ctx_initialized stored in #nvgpu_gr_ctx
* structure.
*
* @return ctx initialization status.
*/
bool nvgpu_gr_ctx_get_ctx_initialized(struct nvgpu_gr_ctx *gr_ctx);
#ifdef CONFIG_NVGPU_CILP
bool nvgpu_gr_ctx_get_cilp_preempt_pending(struct nvgpu_gr_ctx *gr_ctx);