Commit 5d8b936d authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu/smu: properly handle runpm/suspend/reset

We need some special handling when using baco vs. other
things.
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f0f7ddfc
...@@ -1454,11 +1454,15 @@ int smu_reset(struct smu_context *smu) ...@@ -1454,11 +1454,15 @@ int smu_reset(struct smu_context *smu)
return ret; return ret;
} }
static int smu_disabled_dpms(struct smu_context *smu) static int smu_disable_dpm(struct smu_context *smu)
{ {
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
uint32_t smu_version; uint32_t smu_version;
int ret = 0; int ret = 0;
bool use_baco = !smu->is_apu &&
((adev->in_gpu_reset &&
(amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) ||
(adev->in_runpm && amdgpu_asic_supports_baco(adev)));
ret = smu_get_smc_version(smu, NULL, &smu_version); ret = smu_get_smc_version(smu, NULL, &smu_version);
if (ret) { if (ret) {
...@@ -1467,13 +1471,13 @@ static int smu_disabled_dpms(struct smu_context *smu) ...@@ -1467,13 +1471,13 @@ static int smu_disabled_dpms(struct smu_context *smu)
} }
/* /*
* For baco reset on Arcturus, this operation * For baco on Arcturus, this operation
* (disable all smu feature) will be handled by SMU FW. * (disable all smu feature) will be handled by SMU FW.
*/ */
if (adev->in_gpu_reset && if (adev->asic_type == CHIP_ARCTURUS) {
(amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) && if (use_baco && (smu_version > 0x360e00))
(adev->asic_type == CHIP_ARCTURUS && smu_version > 0x360e00)) return 0;
return 0; }
/* Disable all enabled SMU features */ /* Disable all enabled SMU features */
ret = smu_system_features_control(smu, false); ret = smu_system_features_control(smu, false);
...@@ -1482,15 +1486,14 @@ static int smu_disabled_dpms(struct smu_context *smu) ...@@ -1482,15 +1486,14 @@ static int smu_disabled_dpms(struct smu_context *smu)
return ret; return ret;
} }
/* For baco reset, need to leave BACO feature enabled */ /* For baco, need to leave BACO feature enabled */
if (adev->in_gpu_reset && if (use_baco) {
(amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) && if (smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) {
!smu->is_apu && ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true);
smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) { if (ret) {
ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true); pr_warn("set BACO feature enabled failed, return %d\n", ret);
if (ret) { return ret;
pr_warn("set BACO feature enabled failed, return %d\n", ret); }
return ret;
} }
} }
...@@ -1510,7 +1513,7 @@ static int smu_suspend(void *handle) ...@@ -1510,7 +1513,7 @@ static int smu_suspend(void *handle)
return 0; return 0;
if(!amdgpu_sriov_vf(adev)) { if(!amdgpu_sriov_vf(adev)) {
ret = smu_disabled_dpms(smu); ret = smu_disable_dpm(smu);
if (ret) if (ret)
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment