From 877e20838cf99c00a809496aa69409136f0b1711 Mon Sep 17 00:00:00 2001 From: Abdul Salam Date: Fri, 26 Jun 2020 23:13:46 +0530 Subject: [PATCH] gpu: nvgpu: Add fix for DVCO Min Currently DVCO Min is set to 0 in VBIOS. This is causing few boards in GVS to fail when it tries to program min gpcclk freq for dgpu using post divider. This patch makes 405MHz is the lowest gpcclk freq instead of 0. Once VBIOS is updated with 405MHz min freq this fix can be reverted. Bug 3032643 Change-Id: I880c4d2b835cfee87d117010be12a91c64e9cd23 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2367461 Signed-off-by: Prateek sethi (cherry picked from commit d3061891ee031059ce791b34f5e40f969db0d89e) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2370512 Tested-by: mobile promotions Reviewed-by: Vaibhav Kachore Reviewed-by: automaticguardword Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.c | 11 ++++++++++- drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.h | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.c b/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.c index 2534f52b6..6ef8e6973 100644 --- a/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.c +++ b/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.c @@ -91,7 +91,16 @@ int gv100_get_arbiter_clk_range(struct gk20a *g, u32 api_domain, gpcclk_cap_mhz = p0_info->max_mhz; max_min_freq_mhz = nvgpu_pmu_clk_fll_get_min_max_freq(g); - /* WAR for DVCO min */ + /* + * When DVCO min is 0 in vbios update it to DVCO_MIN_DEFAULT_MHZ. + */ + if (max_min_freq_mhz == 0U) { + max_min_freq_mhz = DVCO_MIN_DEFAULT_MHZ; + } + + /* + * Needed for DVCO min. + */ if (api_domain == CTRL_CLK_DOMAIN_GPCCLK) { if ((max_min_freq_mhz != 0U) && (max_min_freq_mhz >= limit_min_mhz)) { diff --git a/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.h b/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.h index f8e1112ff..386e3cc9f 100644 --- a/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.h +++ b/drivers/gpu/nvgpu/common/clk_arb/clk_arb_gv100.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2020, 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"), @@ -25,6 +25,8 @@ struct nvgpu_clk_session; struct nvgpu_clk_arb; +#define DVCO_MIN_DEFAULT_MHZ 405 + bool gv100_check_clk_arb_support(struct gk20a *g); u32 gv100_get_arbiter_clk_domains(struct gk20a *g); int gv100_get_arbiter_f_points(struct gk20a *g,u32 api_domain,