summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
authorPeng Liu <pengliu@nvidia.com>2019-03-13 13:30:54 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2019-05-10 09:43:12 -0400
commit27625718c4b2e400650885f8c892860c6c7434fd (patch)
treef82dfe6e8ce494b5330e39270f829ccd05f0447d /drivers/gpu/nvgpu
parentaf95d14bb08850ed449eebae227faca800747108 (diff)
Revert "gpu: nvgpu: cache gpu clk rate"
This reverts commit e9a6d179a42e ("gpu: nvgpu: cache gpu clk rate") - Real clock rate doesn't always equal clock rate requested by caller - call of clk_set_rate() and update of cached_rate are not atomic - Real root cause for Bug 2051688 is in bpmp and gboost design Bug 2538692 Change-Id: I9248e0c69e2271ed2d0070587db59afa6f8160f2 Signed-off-by: Peng Liu <pengliu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2109708 (cherry picked from commit cc70f89bb4efd106b81c2da5ecd6cbeb69c990d8) Reviewed-on: https://git-master.nvidia.com/r/2113647 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Aaron Tian <atian@nvidia.com> Tested-by: Aaron Tian <atian@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/clk_gk20a.h5
-rw-r--r--drivers/gpu/nvgpu/os/linux/clk.c19
-rw-r--r--drivers/gpu/nvgpu/os/linux/platform_gk20a.h5
-rw-r--r--drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c4
-rw-r--r--drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c4
5 files changed, 9 insertions, 28 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/clk_gk20a.h b/drivers/gpu/nvgpu/gk20a/clk_gk20a.h
index d84e5969..03aa6ab7 100644
--- a/drivers/gpu/nvgpu/gk20a/clk_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/clk_gk20a.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011 - 2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2011 - 2019, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -96,9 +96,6 @@ struct clk_gk20a {
96#if defined(CONFIG_COMMON_CLK) 96#if defined(CONFIG_COMMON_CLK)
97 struct clk *tegra_clk; 97 struct clk *tegra_clk;
98 struct clk_hw hw; 98 struct clk_hw hw;
99
100 /* scaling rate */
101 unsigned long cached_rate;
102#endif 99#endif
103 struct pll gpc_pll; 100 struct pll gpc_pll;
104 struct pll gpc_pll_last; 101 struct pll gpc_pll_last;
diff --git a/drivers/gpu/nvgpu/os/linux/clk.c b/drivers/gpu/nvgpu/os/linux/clk.c
index 36c13577..6575a037 100644
--- a/drivers/gpu/nvgpu/os/linux/clk.c
+++ b/drivers/gpu/nvgpu/os/linux/clk.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Linux clock support 2 * Linux clock support
3 * 3 *
4 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -38,13 +38,9 @@ static unsigned long nvgpu_linux_clk_get_rate(struct gk20a *g, u32 api_domain)
38 switch (api_domain) { 38 switch (api_domain) {
39 case CTRL_CLK_DOMAIN_GPCCLK: 39 case CTRL_CLK_DOMAIN_GPCCLK:
40 if (g->clk.tegra_clk) 40 if (g->clk.tegra_clk)
41 ret = g->clk.cached_rate ? 41 ret = clk_get_rate(g->clk.tegra_clk);
42 g->clk.cached_rate :
43 clk_get_rate(g->clk.tegra_clk);
44 else 42 else
45 ret = platform->cached_rate ? 43 ret = clk_get_rate(platform->clk[0]);
46 platform->cached_rate :
47 clk_get_rate(platform->clk[0]);
48 break; 44 break;
49 case CTRL_CLK_DOMAIN_PWRCLK: 45 case CTRL_CLK_DOMAIN_PWRCLK:
50 ret = clk_get_rate(platform->clk[1]); 46 ret = clk_get_rate(platform->clk[1]);
@@ -66,15 +62,10 @@ static int nvgpu_linux_clk_set_rate(struct gk20a *g,
66 62
67 switch (api_domain) { 63 switch (api_domain) {
68 case CTRL_CLK_DOMAIN_GPCCLK: 64 case CTRL_CLK_DOMAIN_GPCCLK:
69 if (g->clk.tegra_clk) { 65 if (g->clk.tegra_clk)
70 ret = clk_set_rate(g->clk.tegra_clk, rate); 66 ret = clk_set_rate(g->clk.tegra_clk, rate);
71 if (!ret) 67 else
72 g->clk.cached_rate = rate;
73 } else {
74 ret = clk_set_rate(platform->clk[0], rate); 68 ret = clk_set_rate(platform->clk[0], rate);
75 if (!ret)
76 platform->cached_rate = rate;
77 }
78 break; 69 break;
79 case CTRL_CLK_DOMAIN_PWRCLK: 70 case CTRL_CLK_DOMAIN_PWRCLK:
80 ret = clk_set_rate(platform->clk[1], rate); 71 ret = clk_set_rate(platform->clk[1], rate);
diff --git a/drivers/gpu/nvgpu/os/linux/platform_gk20a.h b/drivers/gpu/nvgpu/os/linux/platform_gk20a.h
index a19d0a7c..1331c941 100644
--- a/drivers/gpu/nvgpu/os/linux/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/os/linux/platform_gk20a.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GK20A Platform (SoC) Interface 2 * GK20A Platform (SoC) Interface
3 * 3 *
4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -271,9 +271,6 @@ struct gk20a_platform {
271 /* stream id to use */ 271 /* stream id to use */
272 u32 ltc_streamid; 272 u32 ltc_streamid;
273 273
274 /* scaling rate */
275 unsigned long cached_rate;
276
277 /* synchronized access to platform->clk_get_freqs */ 274 /* synchronized access to platform->clk_get_freqs */
278 struct nvgpu_mutex clk_get_freq_lock; 275 struct nvgpu_mutex clk_get_freq_lock;
279}; 276};
diff --git a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c
index 408e546f..6a453096 100644
--- a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GK20A Tegra Platform Interface 2 * GK20A Tegra Platform Interface
3 * 3 *
4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -497,8 +497,6 @@ static int gk20a_tegra_get_clocks(struct device *dev)
497 rate = clk_round_rate(c, rate); 497 rate = clk_round_rate(c, rate);
498 clk_set_rate(c, rate); 498 clk_set_rate(c, rate);
499 platform->clk[i] = c; 499 platform->clk[i] = c;
500 if (i == 0)
501 platform->cached_rate = rate;
502 } 500 }
503 platform->num_clks = i; 501 platform->num_clks = i;
504 502
diff --git a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c
index a8308496..c5527f2d 100644
--- a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP10B Tegra Platform Interface 2 * GP10B Tegra Platform Interface
3 * 3 *
4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -95,8 +95,6 @@ int gp10b_tegra_get_clocks(struct device *dev)
95 } else { 95 } else {
96 clk_set_rate(c, rate); 96 clk_set_rate(c, rate);
97 platform->clk[i] = c; 97 platform->clk[i] = c;
98 if (i == 0)
99 platform->cached_rate = rate;
100 } 98 }
101 } 99 }
102 platform->num_clks = i; 100 platform->num_clks = i;