Commit 9b1a6a58 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/powerplay: skip BACO feature on DPMs disablement

Instead of disabling and reenabling it later.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6f47116e
...@@ -110,28 +110,32 @@ static int smu_feature_update_enable_state(struct smu_context *smu, ...@@ -110,28 +110,32 @@ static int smu_feature_update_enable_state(struct smu_context *smu,
bool enabled) bool enabled)
{ {
struct smu_feature *feature = &smu->smu_feature; struct smu_feature *feature = &smu->smu_feature;
uint32_t feature_low = 0, feature_high = 0;
int ret = 0; int ret = 0;
feature_low = (feature_mask >> 0 ) & 0xffffffff;
feature_high = (feature_mask >> 32) & 0xffffffff;
if (enabled) { if (enabled) {
ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesLow, ret = smu_send_smc_msg_with_param(smu,
feature_low, NULL); SMU_MSG_EnableSmuFeaturesLow,
lower_32_bits(feature_mask),
NULL);
if (ret) if (ret)
return ret; return ret;
ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesHigh, ret = smu_send_smc_msg_with_param(smu,
feature_high, NULL); SMU_MSG_EnableSmuFeaturesHigh,
upper_32_bits(feature_mask),
NULL);
if (ret) if (ret)
return ret; return ret;
} else { } else {
ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesLow, ret = smu_send_smc_msg_with_param(smu,
feature_low, NULL); SMU_MSG_DisableSmuFeaturesLow,
lower_32_bits(feature_mask),
NULL);
if (ret) if (ret)
return ret; return ret;
ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesHigh, ret = smu_send_smc_msg_with_param(smu,
feature_high, NULL); SMU_MSG_DisableSmuFeaturesHigh,
upper_32_bits(feature_mask),
NULL);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -1305,6 +1309,7 @@ static int smu_hw_init(void *handle) ...@@ -1305,6 +1309,7 @@ static int smu_hw_init(void *handle)
static int smu_disable_dpms(struct smu_context *smu) static int smu_disable_dpms(struct smu_context *smu)
{ {
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
uint64_t features_to_disable;
int ret = 0; int ret = 0;
bool use_baco = !smu->is_apu && bool use_baco = !smu->is_apu &&
((adev->in_gpu_reset && ((adev->in_gpu_reset &&
...@@ -1336,36 +1341,21 @@ static int smu_disable_dpms(struct smu_context *smu) ...@@ -1336,36 +1341,21 @@ static int smu_disable_dpms(struct smu_context *smu)
return 0; return 0;
/* /*
* Disable all enabled SMU features. * For gpu reset, runpm and hibernation through BACO,
* This should be handled in SMU FW, as a backup * BACO feature has to be kept enabled.
* driver can issue call to SMU FW until sequence
* in SMU FW is operational.
*/ */
if (use_baco && smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) {
features_to_disable = U64_MAX &
~(1ULL << smu_feature_get_index(smu, SMU_FEATURE_BACO_BIT));
ret = smu_feature_update_enable_state(smu,
features_to_disable,
0);
if (ret)
pr_err("Failed to disable smu features except BACO.\n");
} else {
ret = smu_system_features_control(smu, false); ret = smu_system_features_control(smu, false);
if (ret) { if (ret)
pr_err("Failed to disable smu features.\n"); pr_err("Failed to disable smu features.\n");
return ret;
}
/*
* For baco, need to leave BACO feature enabled
*
* Correct the way for checking whether SMU_FEATURE_BACO_BIT
* is supported.
*
* Since 'smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)' will
* always return false as the 'smu_system_features_control(smu, false)'
* was just issued above which disabled all SMU features.
*
* Thus 'smu_feature_get_index(smu, SMU_FEATURE_BACO_BIT)' is used
* now for the checking.
*/
if (use_baco && (smu_feature_get_index(smu, SMU_FEATURE_BACO_BIT) >= 0)) {
ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true);
if (ret) {
pr_warn("set BACO feature enabled failed, return %d\n", ret);
return ret;
}
} }
if (adev->asic_type >= CHIP_NAVI10 && if (adev->asic_type >= CHIP_NAVI10 &&
......
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