diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2016-09-13 17:23:45 -0400 |
---|---|---|
committer | Deepak Nibade <dnibade@nvidia.com> | 2016-12-27 04:56:51 -0500 |
commit | 3d9c33c5953e383527c7e4af594adfe0c82b5788 (patch) | |
tree | 6de4ae86667c763ed0deef3add9336b570ca15ff /drivers/gpu/nvgpu/gp106 | |
parent | c320ccfa952a2796db27d97111791bcbeff9f5c7 (diff) |
gpu: nvgpu: clk arbiter skeleton
Add clock arbiter skeleton with support of clock sessions,
notifications on clock changes, request numbering, and asynchronous
handling of clock requests. Provides minimum behaviour to allow
unit tests implementation. Actual arbitration and clock settings
will be done separately. For now, dummy arbiter keeps last
requested target mhz. Actual arbiter may move to a lockless
implementation.
Jira DNVGPU-125
Change-Id: I6a8e443fb0d15dc5f1993e7260256d71acddd106
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: http://git-master/r/1223476
(cherry picked from commit cb130825d84e4124d273bd443e2b62d493377461)
Reviewed-on: http://git-master/r/1243105
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106')
-rw-r--r-- | drivers/gpu/nvgpu/gp106/clk_arb_gp106.c | 95 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/clk_arb_gp106.h | 21 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/clk_gp106.c | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/hal_gp106.c | 2 |
4 files changed, 119 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c new file mode 100644 index 00000000..d1cbb32b --- /dev/null +++ b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | |||
14 | #include "gk20a/gk20a.h" | ||
15 | |||
16 | #include "clk/clk_arb.h" | ||
17 | #include "clk_arb_gp106.h" | ||
18 | |||
19 | static u32 gp106_get_arbiter_clk_domains(struct gk20a *g) | ||
20 | { | ||
21 | (void)g; | ||
22 | return (CTRL_CLK_DOMAIN_MCLK|CTRL_CLK_DOMAIN_GPC2CLK); | ||
23 | } | ||
24 | |||
25 | static int gp106_get_arbiter_clk_range(struct gk20a *g, u32 api_domain, | ||
26 | u16 *min_mhz, u16 *max_mhz) | ||
27 | { | ||
28 | enum nv_pmu_clk_clkwhich clkwhich; | ||
29 | struct clk_set_info *p0_info; | ||
30 | struct clk_set_info *p5_info; | ||
31 | |||
32 | switch (api_domain) { | ||
33 | case CTRL_CLK_DOMAIN_MCLK: | ||
34 | clkwhich = clkwhich_mclk; | ||
35 | break; | ||
36 | |||
37 | case CTRL_CLK_DOMAIN_GPC2CLK: | ||
38 | clkwhich = clkwhich_gpc2clk; | ||
39 | break; | ||
40 | |||
41 | default: | ||
42 | return -EINVAL; | ||
43 | } | ||
44 | |||
45 | p5_info = pstate_get_clk_set_info(g, | ||
46 | CTRL_PERF_PSTATE_P5, clkwhich); | ||
47 | if (!p5_info) | ||
48 | return -EINVAL; | ||
49 | |||
50 | p0_info = pstate_get_clk_set_info(g, | ||
51 | CTRL_PERF_PSTATE_P0, clkwhich); | ||
52 | if (!p0_info) | ||
53 | return -EINVAL; | ||
54 | |||
55 | *min_mhz = p5_info->min_mhz; | ||
56 | *max_mhz = p0_info->max_mhz; | ||
57 | |||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static int gp106_get_arbiter_clk_default(struct gk20a *g, u32 api_domain, | ||
62 | u16 *default_mhz) | ||
63 | { | ||
64 | enum nv_pmu_clk_clkwhich clkwhich; | ||
65 | struct clk_set_info *p0_info; | ||
66 | |||
67 | switch (api_domain) { | ||
68 | case CTRL_CLK_DOMAIN_MCLK: | ||
69 | clkwhich = clkwhich_mclk; | ||
70 | break; | ||
71 | |||
72 | case CTRL_CLK_DOMAIN_GPC2CLK: | ||
73 | clkwhich = clkwhich_gpc2clk; | ||
74 | break; | ||
75 | |||
76 | default: | ||
77 | return -EINVAL; | ||
78 | } | ||
79 | |||
80 | p0_info = pstate_get_clk_set_info(g, | ||
81 | CTRL_PERF_PSTATE_P0, clkwhich); | ||
82 | if (!p0_info) | ||
83 | return -EINVAL; | ||
84 | |||
85 | *default_mhz = p0_info->max_mhz; | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | void gp106_init_clk_arb_ops(struct gpu_ops *gops) | ||
91 | { | ||
92 | gops->clk_arb.get_arbiter_clk_domains = gp106_get_arbiter_clk_domains; | ||
93 | gops->clk_arb.get_arbiter_clk_range = gp106_get_arbiter_clk_range; | ||
94 | gops->clk_arb.get_arbiter_clk_default = gp106_get_arbiter_clk_default; | ||
95 | } | ||
diff --git a/drivers/gpu/nvgpu/gp106/clk_arb_gp106.h b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.h new file mode 100644 index 00000000..a9877199 --- /dev/null +++ b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #ifndef CLK_ARB_GP106_H | ||
17 | #define CLK_ARB_GP106_H | ||
18 | |||
19 | void gp106_init_clk_arb_ops(struct gpu_ops *gops); | ||
20 | |||
21 | #endif /* CLK_ARB_GP106_H */ | ||
diff --git a/drivers/gpu/nvgpu/gp106/clk_gp106.c b/drivers/gpu/nvgpu/gp106/clk_gp106.c index 39c308a3..85dde69f 100644 --- a/drivers/gpu/nvgpu/gp106/clk_gp106.c +++ b/drivers/gpu/nvgpu/gp106/clk_gp106.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "gk20a/gk20a.h" | 27 | #include "gk20a/gk20a.h" |
28 | #include "hw_trim_gp106.h" | 28 | #include "hw_trim_gp106.h" |
29 | #include "clk_gp106.h" | 29 | #include "clk_gp106.h" |
30 | #include "clk/clk_arb.h" | ||
30 | 31 | ||
31 | #define gk20a_dbg_clk(fmt, arg...) \ | 32 | #define gk20a_dbg_clk(fmt, arg...) \ |
32 | gk20a_dbg(gpu_dbg_clk, fmt, ##arg) | 33 | gk20a_dbg(gpu_dbg_clk, fmt, ##arg) |
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index 0f926be8..dc27cdae 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "gm20b/fifo_gm20b.h" | 37 | #include "gm20b/fifo_gm20b.h" |
38 | #include "gm20b/pmu_gm20b.h" | 38 | #include "gm20b/pmu_gm20b.h" |
39 | #include "gp106/clk_gp106.h" | 39 | #include "gp106/clk_gp106.h" |
40 | #include "gp106/clk_arb_gp106.h" | ||
40 | 41 | ||
41 | #include "gp106/mm_gp106.h" | 42 | #include "gp106/mm_gp106.h" |
42 | #include "gp106/pmu_gp106.h" | 43 | #include "gp106/pmu_gp106.h" |
@@ -210,6 +211,7 @@ int gp106_init_hal(struct gk20a *g) | |||
210 | gk20a_init_debug_ops(gops); | 211 | gk20a_init_debug_ops(gops); |
211 | gk20a_init_dbg_session_ops(gops); | 212 | gk20a_init_dbg_session_ops(gops); |
212 | gp106_init_clk_ops(gops); | 213 | gp106_init_clk_ops(gops); |
214 | gp106_init_clk_arb_ops(gops); | ||
213 | gp106_init_regops(gops); | 215 | gp106_init_regops(gops); |
214 | gp10b_init_cde_ops(gops); | 216 | gp10b_init_cde_ops(gops); |
215 | gk20a_init_tsg_ops(gops); | 217 | gk20a_init_tsg_ops(gops); |