aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2017-01-06 00:32:49 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-01-27 11:13:14 -0500
commit570272d2296ce42b7d0b4c5afa5b668100930507 (patch)
tree127897c329a360f9d5392b3ec1b54e976237c8e6 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parent7f61bed0c45df0b58af589b0569ce3349cbc53cb (diff)
drm/amdgpu: extend profiling mode.
in profiling mode, powerplay will fix power state as stable as possible.and disable gfx cg and LBPW feature. profile_standard: as a prerequisite, ensure power and thermal sustainable, set clocks ratio as close to the highest clock ratio as possible. profile_min_sclk: fix mclk as profile_normal, set lowest sclk profile_min_mclk: fix sclk as profile_normal, set lowest mclk profile_peak: set highest sclk and mclk, power and thermal not sustainable profile_exit: exit profile mode. enable gfx cg/lbpw feature. Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 9abd8f6705c0..f35893c19531 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -142,12 +142,15 @@ static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
142 142
143 level = amdgpu_dpm_get_performance_level(adev); 143 level = amdgpu_dpm_get_performance_level(adev);
144 return snprintf(buf, PAGE_SIZE, "%s\n", 144 return snprintf(buf, PAGE_SIZE, "%s\n",
145 (level & (AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" : 145 (level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
146 (level & AMD_DPM_FORCED_LEVEL_LOW) ? "low" : 146 (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
147 (level & AMD_DPM_FORCED_LEVEL_HIGH) ? "high" : 147 (level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
148 (level & AMD_DPM_FORCED_LEVEL_MANUAL) ? "manual" : 148 (level == AMD_DPM_FORCED_LEVEL_MANUAL) ? "manual" :
149 (level & AMD_DPM_FORCED_LEVEL_PROFILING) ? "profiling" : 149 (level == AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :
150 "unknown")); 150 (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :
151 (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :
152 (level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) ? "profile_peak" :
153 "unknown");
151} 154}
152 155
153static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev, 156static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
@@ -176,9 +179,17 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
176 level = AMD_DPM_FORCED_LEVEL_AUTO; 179 level = AMD_DPM_FORCED_LEVEL_AUTO;
177 } else if (strncmp("manual", buf, strlen("manual")) == 0) { 180 } else if (strncmp("manual", buf, strlen("manual")) == 0) {
178 level = AMD_DPM_FORCED_LEVEL_MANUAL; 181 level = AMD_DPM_FORCED_LEVEL_MANUAL;
179 } else if (strncmp("profile", buf, strlen("profile")) == 0) { 182 } else if (strncmp("profile_exit", buf, strlen("profile_exit")) == 0) {
180 level = AMD_DPM_FORCED_LEVEL_PROFILING; 183 level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
181 } else { 184 } else if (strncmp("profile_standard", buf, strlen("profile_standard")) == 0) {
185 level = AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD;
186 } else if (strncmp("profile_min_sclk", buf, strlen("profile_min_sclk")) == 0) {
187 level = AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK;
188 } else if (strncmp("profile_min_mclk", buf, strlen("profile_min_mclk")) == 0) {
189 level = AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK;
190 } else if (strncmp("profile_peak", buf, strlen("profile_peak")) == 0) {
191 level = AMD_DPM_FORCED_LEVEL_PROFILE_PEAK;
192 } else {
182 count = -EINVAL; 193 count = -EINVAL;
183 goto fail; 194 goto fail;
184 } 195 }
@@ -186,14 +197,6 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
186 if (current_level == level) 197 if (current_level == level)
187 return count; 198 return count;
188 199
189 if (level == AMD_DPM_FORCED_LEVEL_PROFILING)
190 amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_GFX,
191 AMD_CG_STATE_UNGATE);
192 else if (level != AMD_DPM_FORCED_LEVEL_PROFILING &&
193 current_level == AMD_DPM_FORCED_LEVEL_PROFILING)
194 amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_GFX,
195 AMD_CG_STATE_GATE);
196
197 if (adev->pp_enabled) 200 if (adev->pp_enabled)
198 amdgpu_dpm_force_performance_level(adev, level); 201 amdgpu_dpm_force_performance_level(adev, level);
199 else { 202 else {
@@ -210,6 +213,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
210 adev->pm.dpm.forced_level = level; 213 adev->pm.dpm.forced_level = level;
211 mutex_unlock(&adev->pm.mutex); 214 mutex_unlock(&adev->pm.mutex);
212 } 215 }
216
213fail: 217fail:
214 return count; 218 return count;
215} 219}