From 2373a870481009f1fd143c6c36a14a541b87c1da Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 9 Feb 2022 10:45:15 +0000 Subject: [PATCH] gpu: nvgpu: set compute regs only for compute class In safety build, gops.gr.init.set_default_compute_regs() is invoked in nvgpu_gr_obj_ctx_alloc() for all classes. Before enabling graphics classes in safety this was executed only for compute class. But since graphics classes are supported in safety now this call should be made only for compute classes. Add gops.gpu_class.is_valid_compute() check before calling this function. Bug 3482988 Change-Id: If3722be36e779195122f54925ad122871cf13317 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2667324 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: svc-mobile-misra Reviewed-by: Sagar Kamble GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/gr/obj_ctx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/gr/obj_ctx.c b/drivers/gpu/nvgpu/common/gr/obj_ctx.c index 32e90be59..6c5801e1d 100644 --- a/drivers/gpu/nvgpu/common/gr/obj_ctx.c +++ b/drivers/gpu/nvgpu/common/gr/obj_ctx.c @@ -891,7 +891,8 @@ int nvgpu_gr_obj_ctx_alloc(struct gk20a *g, subctx); #ifndef CONFIG_NVGPU_NON_FUSA - if (g->ops.gr.init.set_default_compute_regs != NULL) { + if (g->ops.gpu_class.is_valid_compute(class_num) && + g->ops.gr.init.set_default_compute_regs != NULL) { g->ops.gr.init.set_default_compute_regs(g, gr_ctx); } #endif