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
This commit is contained in:
Terje Bergstrom
2015-10-16 15:24:50 -07:00
parent 37255d42cc
commit 790173dcfd
3 changed files with 257 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2012-2015, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -74,6 +74,18 @@ static inline u32 therm_config1_r(void)
{
return 0x00020050;
}
static inline u32 therm_config2_r(void)
{
return 0x00020130;
}
static inline u32 therm_config2_slowdown_factor_extended_f(u32 v)
{
return (v & 0x1) << 24;
}
static inline u32 therm_config2_grad_enable_f(u32 v)
{
return (v & 0x1) << 31;
}
static inline u32 therm_gate_ctrl_r(u32 i)
{
return 0x00020200 + i*4;
@@ -182,4 +194,112 @@ static inline u32 therm_clk_slowdown_idle_factor_disabled_f(void)
{
return 0x0;
}
static inline u32 therm_grad_stepping_table_r(u32 i)
{
return 0x000202c8 + i*4;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_f(u32 v)
{
return (v & 0x3f) << 0;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_m(void)
{
return 0x3f << 0;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f(void)
{
return 0x1;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f(void)
{
return 0x2;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f(void)
{
return 0x6;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f(void)
{
return 0xe;
}
static inline u32 therm_grad_stepping_table_slowdown_factor1_f(u32 v)
{
return (v & 0x3f) << 6;
}
static inline u32 therm_grad_stepping_table_slowdown_factor1_m(void)
{
return 0x3f << 6;
}
static inline u32 therm_grad_stepping_table_slowdown_factor2_f(u32 v)
{
return (v & 0x3f) << 12;
}
static inline u32 therm_grad_stepping_table_slowdown_factor2_m(void)
{
return 0x3f << 12;
}
static inline u32 therm_grad_stepping_table_slowdown_factor3_f(u32 v)
{
return (v & 0x3f) << 18;
}
static inline u32 therm_grad_stepping_table_slowdown_factor3_m(void)
{
return 0x3f << 18;
}
static inline u32 therm_grad_stepping_table_slowdown_factor4_f(u32 v)
{
return (v & 0x3f) << 24;
}
static inline u32 therm_grad_stepping_table_slowdown_factor4_m(void)
{
return 0x3f << 24;
}
static inline u32 therm_grad_stepping0_r(void)
{
return 0x000202c0;
}
static inline u32 therm_grad_stepping0_feature_s(void)
{
return 1;
}
static inline u32 therm_grad_stepping0_feature_f(u32 v)
{
return (v & 0x1) << 0;
}
static inline u32 therm_grad_stepping0_feature_m(void)
{
return 0x1 << 0;
}
static inline u32 therm_grad_stepping0_feature_v(u32 r)
{
return (r >> 0) & 0x1;
}
static inline u32 therm_grad_stepping0_feature_enable_f(void)
{
return 0x1;
}
static inline u32 therm_grad_stepping1_r(void)
{
return 0x000202c4;
}
static inline u32 therm_grad_stepping1_pdiv_duration_f(u32 v)
{
return (v & 0x1ffff) << 0;
}
static inline u32 therm_clk_timing_r(u32 i)
{
return 0x000203c0 + i*4;
}
static inline u32 therm_clk_timing_grad_slowdown_f(u32 v)
{
return (v & 0x1) << 16;
}
static inline u32 therm_clk_timing_grad_slowdown_m(void)
{
return 0x1 << 16;
}
static inline u32 therm_clk_timing_grad_slowdown_enabled_f(void)
{
return 0x10000;
}
#endif

View File

@@ -35,6 +35,8 @@ static int gk20a_init_therm_setup_sw(struct gk20a *g)
static int gk20a_init_therm_setup_hw(struct gk20a *g)
{
u32 v;
/* program NV_THERM registers */
gk20a_writel(g, therm_use_a_r(), NV_THERM_USE_A_INIT);
gk20a_writel(g, therm_evt_ext_therm_0_r(),
@@ -44,6 +46,35 @@ static int gk20a_init_therm_setup_hw(struct gk20a *g)
gk20a_writel(g, therm_evt_ext_therm_2_r(),
NV_THERM_EVT_EXT_THERM_2_INIT);
gk20a_writel(g, therm_grad_stepping_table_r(0),
therm_grad_stepping_table_slowdown_factor0_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f()) |
therm_grad_stepping_table_slowdown_factor1_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f()) |
therm_grad_stepping_table_slowdown_factor2_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f()) |
therm_grad_stepping_table_slowdown_factor3_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
therm_grad_stepping_table_slowdown_factor4_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()));
gk20a_writel(g, therm_grad_stepping_table_r(1),
therm_grad_stepping_table_slowdown_factor0_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
therm_grad_stepping_table_slowdown_factor1_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
therm_grad_stepping_table_slowdown_factor2_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
therm_grad_stepping_table_slowdown_factor3_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
therm_grad_stepping_table_slowdown_factor4_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()));
v = gk20a_readl(g, therm_clk_timing_r(0));
v |= therm_clk_timing_grad_slowdown_enabled_f();
gk20a_writel(g, therm_clk_timing_r(0), v);
v = gk20a_readl(g, therm_config2_r());
v |= therm_config2_grad_enable_f(1);
v |= therm_config2_slowdown_factor_extended_f(1);
gk20a_writel(g, therm_config2_r(), v);
gk20a_writel(g, therm_grad_stepping1_r(),
therm_grad_stepping1_pdiv_duration_f(32));
v = gk20a_readl(g, therm_grad_stepping0_r());
v |= therm_grad_stepping0_feature_enable_f();
gk20a_writel(g, therm_grad_stepping0_r(), v);
return 0;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -74,6 +74,18 @@ static inline u32 therm_config1_r(void)
{
return 0x00020050;
}
static inline u32 therm_config2_r(void)
{
return 0x00020130;
}
static inline u32 therm_config2_slowdown_factor_extended_f(u32 v)
{
return (v & 0x1) << 24;
}
static inline u32 therm_config2_grad_enable_f(u32 v)
{
return (v & 0x1) << 31;
}
static inline u32 therm_gate_ctrl_r(u32 i)
{
return 0x00020200 + i*4;
@@ -182,4 +194,96 @@ static inline u32 therm_clk_slowdown_idle_factor_disabled_f(void)
{
return 0x0;
}
static inline u32 therm_grad_stepping_table_r(u32 i)
{
return 0x000202c8 + i*4;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_f(u32 v)
{
return (v & 0x3f) << 0;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_m(void)
{
return 0x3f << 0;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f(void)
{
return 0x1;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f(void)
{
return 0x2;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f(void)
{
return 0x6;
}
static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f(void)
{
return 0xe;
}
static inline u32 therm_grad_stepping_table_slowdown_factor1_f(u32 v)
{
return (v & 0x3f) << 6;
}
static inline u32 therm_grad_stepping_table_slowdown_factor2_f(u32 v)
{
return (v & 0x3f) << 12;
}
static inline u32 therm_grad_stepping_table_slowdown_factor3_f(u32 v)
{
return (v & 0x3f) << 18;
}
static inline u32 therm_grad_stepping_table_slowdown_factor4_f(u32 v)
{
return (v & 0x3f) << 24;
}
static inline u32 therm_grad_stepping0_r(void)
{
return 0x000202c0;
}
static inline u32 therm_grad_stepping0_feature_s(void)
{
return 1;
}
static inline u32 therm_grad_stepping0_feature_f(u32 v)
{
return (v & 0x1) << 0;
}
static inline u32 therm_grad_stepping0_feature_m(void)
{
return 0x1 << 0;
}
static inline u32 therm_grad_stepping0_feature_v(u32 r)
{
return (r >> 0) & 0x1;
}
static inline u32 therm_grad_stepping0_feature_enable_f(void)
{
return 0x1;
}
static inline u32 therm_grad_stepping1_r(void)
{
return 0x000202c4;
}
static inline u32 therm_grad_stepping1_pdiv_duration_f(u32 v)
{
return (v & 0x1ffff) << 0;
}
static inline u32 therm_clk_timing_r(u32 i)
{
return 0x000203c0 + i*4;
}
static inline u32 therm_clk_timing_grad_slowdown_f(u32 v)
{
return (v & 0x1) << 16;
}
static inline u32 therm_clk_timing_grad_slowdown_m(void)
{
return 0x1 << 16;
}
static inline u32 therm_clk_timing_grad_slowdown_enabled_f(void)
{
return 0x10000;
}
#endif