Skip to content

Commit 7f991dd

Browse files
committed
drm/amdgpu/pm: add workload profile pause helper
To be used for display idle optimizations when we want to pause non-default profiles. Reviewed-by: Kenneth Feng <kenneth.feng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 6dafb5d)
1 parent f5e7fab commit 7f991dd

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

drivers/gpu/drm/amd/include/kgd_pp_interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ struct amd_pm_funcs {
429429
int (*set_pp_table)(void *handle, const char *buf, size_t size);
430430
void (*debugfs_print_current_performance_level)(void *handle, struct seq_file *m);
431431
int (*switch_power_profile)(void *handle, enum PP_SMC_POWER_PROFILE type, bool en);
432+
int (*pause_power_profile)(void *handle, bool pause);
432433
/* export to amdgpu */
433434
struct amd_vce_state *(*get_vce_clock_state)(void *handle, u32 idx);
434435
int (*dispatch_tasks)(void *handle, enum amd_pp_task task_id,

drivers/gpu/drm/amd/pm/amdgpu_dpm.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,25 @@ int amdgpu_dpm_switch_power_profile(struct amdgpu_device *adev,
349349
return ret;
350350
}
351351

352+
int amdgpu_dpm_pause_power_profile(struct amdgpu_device *adev,
353+
bool pause)
354+
{
355+
const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
356+
int ret = 0;
357+
358+
if (amdgpu_sriov_vf(adev))
359+
return 0;
360+
361+
if (pp_funcs && pp_funcs->pause_power_profile) {
362+
mutex_lock(&adev->pm.mutex);
363+
ret = pp_funcs->pause_power_profile(
364+
adev->powerplay.pp_handle, pause);
365+
mutex_unlock(&adev->pm.mutex);
366+
}
367+
368+
return ret;
369+
}
370+
352371
int amdgpu_dpm_set_xgmi_pstate(struct amdgpu_device *adev,
353372
uint32_t pstate)
354373
{

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ int amdgpu_dpm_set_xgmi_pstate(struct amdgpu_device *adev,
410410
int amdgpu_dpm_switch_power_profile(struct amdgpu_device *adev,
411411
enum PP_SMC_POWER_PROFILE type,
412412
bool en);
413+
int amdgpu_dpm_pause_power_profile(struct amdgpu_device *adev,
414+
bool pause);
413415

414416
int amdgpu_dpm_baco_reset(struct amdgpu_device *adev);
415417

0 commit comments

Comments
 (0)