From e2a29dbb96ff592374da5c8ccebd5684f587677e Mon Sep 17 00:00:00 2001 From: Abdul Salam Date: Tue, 29 Jan 2019 11:05:17 +0530 Subject: [PATCH] gpu: nvgpu: Align the nvrm freq to match latest VF point In the below scenario 1. nvrm app requests & gets all VF points from nvgpu. 2. nvrm stores all the VF points and starts setting each point. 3. During step 2, VF gets updated in nvgpu due to some events. 4. There is a mismatch b/w points in nvrm and VF table in nvgpu. 5. If nvrm freq is less than nvgpu freq , PMU cant program. Makesure highest between nvrm and VF table goes to PMU Bug 200454682 Change-Id: I9c58f129ff1c0dfb3f4759242469b3622fe11bb2 Signed-off-by: Abdul Salam Reviewed-on: https://git-master.nvidia.com/r/2000238 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/pmu/clk/clk_vf_point.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/pmu/clk/clk_vf_point.c b/drivers/gpu/nvgpu/common/pmu/clk/clk_vf_point.c index 9a8f81dba..27b504888 100644 --- a/drivers/gpu/nvgpu/common/pmu/clk/clk_vf_point.c +++ b/drivers/gpu/nvgpu/common/pmu/clk/clk_vf_point.c @@ -702,7 +702,13 @@ int nvgpu_clk_set_req_fll_clk_ps35(struct gk20a *g, struct nvgpu_clk_slave_freq break; } } - vf_point->gpc_mhz = gpc2clk_target < vf_point->gpc_mhz ? gpc2clk_target : vf_point->gpc_mhz; + /* + * If the requested freq is lower than available + * one in VF table, use the VF table freq + */ + if (gpc2clk_target > vf_point->gpc_mhz) { + vf_point->gpc_mhz = gpc2clk_target; + } } while ((table == NULL) || (NV_ACCESS_ONCE(arb->current_vf_table) != table));