diff options
author | Le Ma <[email protected]> | 2023-09-07 15:50:14 +0800 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2023-09-26 17:00:23 -0400 |
commit | 21e43386aec839faf00b71b4684cc72eb649a0f5 (patch) | |
tree | 7eb5541b8d310b428716541bbb59b55389153923 /drivers/gpu/drm/amd/pm/amdgpu_dpm.c | |
parent | d07f1c20dd7c5d94cb7eceb822a060c108e49d23 (diff) |
drm/amd/pm: add xgmi_plpd_policy sysfs node for user to change plpd policy
Add xgmi_plpd_policy sysfs node for users to check and select xgmi
per-link power down policy:
- arg 0: disallow plpd
- arg 1: default policy
- arg 2: optimized policy
v2: split from smu v13.0.6 code and miscellaneous updates
v3: add usage comments around set/get functions
Signed-off-by: Le Ma <[email protected]>
Reviewed-by: Asad Kamal <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/amdgpu_dpm.c')
-rw-r--r-- | drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c index 078aaaa53162..9a157fe4cbc7 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c @@ -365,6 +365,49 @@ int amdgpu_dpm_allow_xgmi_power_down(struct amdgpu_device *adev, bool en) return ret; } +int amdgpu_dpm_get_xgmi_plpd_mode(struct amdgpu_device *adev, char **mode_desc) +{ + struct smu_context *smu = adev->powerplay.pp_handle; + int mode = XGMI_PLPD_NONE; + + if (is_support_sw_smu(adev)) { + mode = smu->plpd_mode; + if (mode_desc == NULL) + return mode; + switch (smu->plpd_mode) { + case XGMI_PLPD_DISALLOW: + *mode_desc = "disallow"; + break; + case XGMI_PLPD_DEFAULT: + *mode_desc = "default"; + break; + case XGMI_PLPD_OPTIMIZED: + *mode_desc = "optimized"; + break; + case XGMI_PLPD_NONE: + default: + *mode_desc = "none"; + break; + } + } + + return mode; +} + +int amdgpu_dpm_set_xgmi_plpd_mode(struct amdgpu_device *adev, int mode) +{ + struct smu_context *smu = adev->powerplay.pp_handle; + int ret = -EOPNOTSUPP; + + if (is_support_sw_smu(adev)) { + mutex_lock(&adev->pm.mutex); + ret = smu_set_xgmi_plpd_mode(smu, mode); + mutex_unlock(&adev->pm.mutex); + } + + return ret; +} + int amdgpu_dpm_enable_mgpu_fan_boost(struct amdgpu_device *adev) { void *pp_handle = adev->powerplay.pp_handle; |