summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2015-10-16 18:24:50 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2015-10-22 13:47:11 -0400
commit790173dcfd505d03bd5fb1a92e28bb53c94b0876 (patch)
treead5194a9540b97237681a30cae70e5699931d882 /drivers
parent37255d42cc1eee1dc1de94bd651461a46c8afbe9 (diff)
gpu: nvgpu: Use gradual slowdown
Program clock slowdown to happen using gradual slowdown. It is significantly faster than the default slowdown. Change-Id: I9e5259889637fce2c0b083a424b54af12bb45c25 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/819698
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/hw_therm_gk20a.h122
-rw-r--r--drivers/gpu/nvgpu/gk20a/therm_gk20a.c31
-rw-r--r--drivers/gpu/nvgpu/gm20b/hw_therm_gm20b.h106
3 files changed, 257 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/hw_therm_gk20a.h b/drivers/gpu/nvgpu/gk20a/hw_therm_gk20a.h
index 42a31c5d..67f1bbc2 100644
--- a/drivers/gpu/nvgpu/gk20a/hw_therm_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/hw_therm_gk20a.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2012-2015, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -74,6 +74,18 @@ static inline u32 therm_config1_r(void)
74{ 74{
75 return 0x00020050; 75 return 0x00020050;
76} 76}
77static inline u32 therm_config2_r(void)
78{
79 return 0x00020130;
80}
81static inline u32 therm_config2_slowdown_factor_extended_f(u32 v)
82{
83 return (v & 0x1) << 24;
84}
85static inline u32 therm_config2_grad_enable_f(u32 v)
86{
87 return (v & 0x1) << 31;
88}
77static inline u32 therm_gate_ctrl_r(u32 i) 89static inline u32 therm_gate_ctrl_r(u32 i)
78{ 90{
79 return 0x00020200 + i*4; 91 return 0x00020200 + i*4;
@@ -182,4 +194,112 @@ static inline u32 therm_clk_slowdown_idle_factor_disabled_f(void)
182{ 194{
183 return 0x0; 195 return 0x0;
184} 196}
197static inline u32 therm_grad_stepping_table_r(u32 i)
198{
199 return 0x000202c8 + i*4;
200}
201static inline u32 therm_grad_stepping_table_slowdown_factor0_f(u32 v)
202{
203 return (v & 0x3f) << 0;
204}
205static inline u32 therm_grad_stepping_table_slowdown_factor0_m(void)
206{
207 return 0x3f << 0;
208}
209static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f(void)
210{
211 return 0x1;
212}
213static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f(void)
214{
215 return 0x2;
216}
217static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f(void)
218{
219 return 0x6;
220}
221static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f(void)
222{
223 return 0xe;
224}
225static inline u32 therm_grad_stepping_table_slowdown_factor1_f(u32 v)
226{
227 return (v & 0x3f) << 6;
228}
229static inline u32 therm_grad_stepping_table_slowdown_factor1_m(void)
230{
231 return 0x3f << 6;
232}
233static inline u32 therm_grad_stepping_table_slowdown_factor2_f(u32 v)
234{
235 return (v & 0x3f) << 12;
236}
237static inline u32 therm_grad_stepping_table_slowdown_factor2_m(void)
238{
239 return 0x3f << 12;
240}
241static inline u32 therm_grad_stepping_table_slowdown_factor3_f(u32 v)
242{
243 return (v & 0x3f) << 18;
244}
245static inline u32 therm_grad_stepping_table_slowdown_factor3_m(void)
246{
247 return 0x3f << 18;
248}
249static inline u32 therm_grad_stepping_table_slowdown_factor4_f(u32 v)
250{
251 return (v & 0x3f) << 24;
252}
253static inline u32 therm_grad_stepping_table_slowdown_factor4_m(void)
254{
255 return 0x3f << 24;
256}
257static inline u32 therm_grad_stepping0_r(void)
258{
259 return 0x000202c0;
260}
261static inline u32 therm_grad_stepping0_feature_s(void)
262{
263 return 1;
264}
265static inline u32 therm_grad_stepping0_feature_f(u32 v)
266{
267 return (v & 0x1) << 0;
268}
269static inline u32 therm_grad_stepping0_feature_m(void)
270{
271 return 0x1 << 0;
272}
273static inline u32 therm_grad_stepping0_feature_v(u32 r)
274{
275 return (r >> 0) & 0x1;
276}
277static inline u32 therm_grad_stepping0_feature_enable_f(void)
278{
279 return 0x1;
280}
281static inline u32 therm_grad_stepping1_r(void)
282{
283 return 0x000202c4;
284}
285static inline u32 therm_grad_stepping1_pdiv_duration_f(u32 v)
286{
287 return (v & 0x1ffff) << 0;
288}
289static inline u32 therm_clk_timing_r(u32 i)
290{
291 return 0x000203c0 + i*4;
292}
293static inline u32 therm_clk_timing_grad_slowdown_f(u32 v)
294{
295 return (v & 0x1) << 16;
296}
297static inline u32 therm_clk_timing_grad_slowdown_m(void)
298{
299 return 0x1 << 16;
300}
301static inline u32 therm_clk_timing_grad_slowdown_enabled_f(void)
302{
303 return 0x10000;
304}
185#endif 305#endif
diff --git a/drivers/gpu/nvgpu/gk20a/therm_gk20a.c b/drivers/gpu/nvgpu/gk20a/therm_gk20a.c
index b02113ad..fd4149ae 100644
--- a/drivers/gpu/nvgpu/gk20a/therm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/therm_gk20a.c
@@ -35,6 +35,8 @@ static int gk20a_init_therm_setup_sw(struct gk20a *g)
35 35
36static int gk20a_init_therm_setup_hw(struct gk20a *g) 36static int gk20a_init_therm_setup_hw(struct gk20a *g)
37{ 37{
38 u32 v;
39
38 /* program NV_THERM registers */ 40 /* program NV_THERM registers */
39 gk20a_writel(g, therm_use_a_r(), NV_THERM_USE_A_INIT); 41 gk20a_writel(g, therm_use_a_r(), NV_THERM_USE_A_INIT);
40 gk20a_writel(g, therm_evt_ext_therm_0_r(), 42 gk20a_writel(g, therm_evt_ext_therm_0_r(),
@@ -44,6 +46,35 @@ static int gk20a_init_therm_setup_hw(struct gk20a *g)
44 gk20a_writel(g, therm_evt_ext_therm_2_r(), 46 gk20a_writel(g, therm_evt_ext_therm_2_r(),
45 NV_THERM_EVT_EXT_THERM_2_INIT); 47 NV_THERM_EVT_EXT_THERM_2_INIT);
46 48
49 gk20a_writel(g, therm_grad_stepping_table_r(0),
50 therm_grad_stepping_table_slowdown_factor0_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f()) |
51 therm_grad_stepping_table_slowdown_factor1_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f()) |
52 therm_grad_stepping_table_slowdown_factor2_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f()) |
53 therm_grad_stepping_table_slowdown_factor3_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
54 therm_grad_stepping_table_slowdown_factor4_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()));
55 gk20a_writel(g, therm_grad_stepping_table_r(1),
56 therm_grad_stepping_table_slowdown_factor0_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
57 therm_grad_stepping_table_slowdown_factor1_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
58 therm_grad_stepping_table_slowdown_factor2_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
59 therm_grad_stepping_table_slowdown_factor3_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
60 therm_grad_stepping_table_slowdown_factor4_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()));
61
62 v = gk20a_readl(g, therm_clk_timing_r(0));
63 v |= therm_clk_timing_grad_slowdown_enabled_f();
64 gk20a_writel(g, therm_clk_timing_r(0), v);
65
66 v = gk20a_readl(g, therm_config2_r());
67 v |= therm_config2_grad_enable_f(1);
68 v |= therm_config2_slowdown_factor_extended_f(1);
69 gk20a_writel(g, therm_config2_r(), v);
70
71 gk20a_writel(g, therm_grad_stepping1_r(),
72 therm_grad_stepping1_pdiv_duration_f(32));
73
74 v = gk20a_readl(g, therm_grad_stepping0_r());
75 v |= therm_grad_stepping0_feature_enable_f();
76 gk20a_writel(g, therm_grad_stepping0_r(), v);
77
47 return 0; 78 return 0;
48} 79}
49 80
diff --git a/drivers/gpu/nvgpu/gm20b/hw_therm_gm20b.h b/drivers/gpu/nvgpu/gm20b/hw_therm_gm20b.h
index d928d70e..9943cf31 100644
--- a/drivers/gpu/nvgpu/gm20b/hw_therm_gm20b.h
+++ b/drivers/gpu/nvgpu/gm20b/hw_therm_gm20b.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -74,6 +74,18 @@ static inline u32 therm_config1_r(void)
74{ 74{
75 return 0x00020050; 75 return 0x00020050;
76} 76}
77static inline u32 therm_config2_r(void)
78{
79 return 0x00020130;
80}
81static inline u32 therm_config2_slowdown_factor_extended_f(u32 v)
82{
83 return (v & 0x1) << 24;
84}
85static inline u32 therm_config2_grad_enable_f(u32 v)
86{
87 return (v & 0x1) << 31;
88}
77static inline u32 therm_gate_ctrl_r(u32 i) 89static inline u32 therm_gate_ctrl_r(u32 i)
78{ 90{
79 return 0x00020200 + i*4; 91 return 0x00020200 + i*4;
@@ -182,4 +194,96 @@ static inline u32 therm_clk_slowdown_idle_factor_disabled_f(void)
182{ 194{
183 return 0x0; 195 return 0x0;
184} 196}
197static inline u32 therm_grad_stepping_table_r(u32 i)
198{
199 return 0x000202c8 + i*4;
200}
201static inline u32 therm_grad_stepping_table_slowdown_factor0_f(u32 v)
202{
203 return (v & 0x3f) << 0;
204}
205static inline u32 therm_grad_stepping_table_slowdown_factor0_m(void)
206{
207 return 0x3f << 0;
208}
209static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f(void)
210{
211 return 0x1;
212}
213static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f(void)
214{
215 return 0x2;
216}
217static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f(void)
218{
219 return 0x6;
220}
221static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f(void)
222{
223 return 0xe;
224}
225static inline u32 therm_grad_stepping_table_slowdown_factor1_f(u32 v)
226{
227 return (v & 0x3f) << 6;
228}
229static inline u32 therm_grad_stepping_table_slowdown_factor2_f(u32 v)
230{
231 return (v & 0x3f) << 12;
232}
233static inline u32 therm_grad_stepping_table_slowdown_factor3_f(u32 v)
234{
235 return (v & 0x3f) << 18;
236}
237static inline u32 therm_grad_stepping_table_slowdown_factor4_f(u32 v)
238{
239 return (v & 0x3f) << 24;
240}
241static inline u32 therm_grad_stepping0_r(void)
242{
243 return 0x000202c0;
244}
245static inline u32 therm_grad_stepping0_feature_s(void)
246{
247 return 1;
248}
249static inline u32 therm_grad_stepping0_feature_f(u32 v)
250{
251 return (v & 0x1) << 0;
252}
253static inline u32 therm_grad_stepping0_feature_m(void)
254{
255 return 0x1 << 0;
256}
257static inline u32 therm_grad_stepping0_feature_v(u32 r)
258{
259 return (r >> 0) & 0x1;
260}
261static inline u32 therm_grad_stepping0_feature_enable_f(void)
262{
263 return 0x1;
264}
265static inline u32 therm_grad_stepping1_r(void)
266{
267 return 0x000202c4;
268}
269static inline u32 therm_grad_stepping1_pdiv_duration_f(u32 v)
270{
271 return (v & 0x1ffff) << 0;
272}
273static inline u32 therm_clk_timing_r(u32 i)
274{
275 return 0x000203c0 + i*4;
276}
277static inline u32 therm_clk_timing_grad_slowdown_f(u32 v)
278{
279 return (v & 0x1) << 16;
280}
281static inline u32 therm_clk_timing_grad_slowdown_m(void)
282{
283 return 0x1 << 16;
284}
285static inline u32 therm_clk_timing_grad_slowdown_enabled_f(void)
286{
287 return 0x10000;
288}
185#endif 289#endif