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 <le.ma@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Le Ma
2023-09-07 15:50:14 +08:00
committed by Alex Deucher
parent d07f1c20dd
commit 21e43386ae
3 changed files with 116 additions and 0 deletions

View File

@@ -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;