From 469ad373b4deb6c71b5ed021e6cb7614ac2ee013 Mon Sep 17 00:00:00 2001 From: Rajesh Devaraj Date: Wed, 23 Nov 2022 15:37:56 +0000 Subject: [PATCH] gpu: nvgpu: update clk arbiter init Initialize clk arbiter only when NVGPU_CLK_ARB_ENABLED flag is set. JIRA NVGPU-9283 Change-Id: I69dcfab349af7293ce3b3edb588a30a101a36e94 Signed-off-by: Rajesh Devaraj Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2814780 Reviewed-by: svcacv Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Seema Khowala GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/clk_arb/clk_arb.c | 5 +++-- drivers/gpu/nvgpu/common/clk_arb/clk_arb_gp10b.c | 3 ++- drivers/gpu/nvgpu/common/init/nvgpu_init.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nvgpu/common/clk_arb/clk_arb.c b/drivers/gpu/nvgpu/common/clk_arb/clk_arb.c index 9ae96a289..7e50140a1 100644 --- a/drivers/gpu/nvgpu/common/clk_arb/clk_arb.c +++ b/drivers/gpu/nvgpu/common/clk_arb/clk_arb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -441,7 +441,8 @@ int nvgpu_clk_arb_init_arbiter(struct gk20a *g) { int err = 0; - if (g->ops.clk_arb.check_clk_arb_support != NULL) { + if ((nvgpu_is_enabled(g, NVGPU_CLK_ARB_ENABLED)) && + (g->ops.clk_arb.check_clk_arb_support != NULL)) { if (!g->ops.clk_arb.check_clk_arb_support(g)) { return 0; } diff --git a/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gp10b.c b/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gp10b.c index 54e43fd32..cd6466612 100644 --- a/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gp10b.c +++ b/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gp10b.c @@ -28,7 +28,8 @@ bool gp10b_check_clk_arb_support(struct gk20a *g) { - if (g->ops.clk_arb.get_arbiter_clk_domains != NULL) { + if ((nvgpu_is_enabled(g, NVGPU_CLK_ARB_ENABLED)) && + g->ops.clk_arb.get_arbiter_clk_domains != NULL) { return true; } else { diff --git a/drivers/gpu/nvgpu/common/init/nvgpu_init.c b/drivers/gpu/nvgpu/common/init/nvgpu_init.c index 15460c070..b04096ca0 100644 --- a/drivers/gpu/nvgpu/common/init/nvgpu_init.c +++ b/drivers/gpu/nvgpu/common/init/nvgpu_init.c @@ -1114,8 +1114,8 @@ int nvgpu_init_gpu_characteristics(struct gk20a *g) nvgpu_set_enabled(g, NVGPU_SUPPORT_TSG, true); #ifdef CONFIG_NVGPU_CLK_ARB - if ((g->ops.clk_arb.check_clk_arb_support != NULL) && - (nvgpu_is_enabled(g, NVGPU_CLK_ARB_ENABLED))){ + if ((nvgpu_is_enabled(g, NVGPU_CLK_ARB_ENABLED)) && + (g->ops.clk_arb.check_clk_arb_support != NULL)) { if (g->ops.clk_arb.check_clk_arb_support(g)) { nvgpu_set_enabled(g, NVGPU_SUPPORT_CLOCK_CONTROLS, true);