Commit fcb1fe9c authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/powerplay: pre-check the SMU state before issuing message

Abort the message issuing if the SMU was not in the right state.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarKenneth Feng <kenneth.feng@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ebcef76b
...@@ -80,15 +80,13 @@ static int smu_v11_0_wait_for_response(struct smu_context *smu) ...@@ -80,15 +80,13 @@ static int smu_v11_0_wait_for_response(struct smu_context *smu)
for (i = 0; i < timeout; i++) { for (i = 0; i < timeout; i++) {
cur_value = RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90); cur_value = RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90);
if ((cur_value & MP1_C2PMSG_90__CONTENT_MASK) != 0) if ((cur_value & MP1_C2PMSG_90__CONTENT_MASK) != 0)
break; return cur_value == 0x1 ? 0 : -EIO;
udelay(1); udelay(1);
} }
/* timeout means wrong logic */ /* timeout means wrong logic */
if (i == timeout) return -ETIME;
return -ETIME;
return RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90) == 0x1 ? 0 : -EIO;
} }
int int
...@@ -104,9 +102,11 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu, ...@@ -104,9 +102,11 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu,
return index; return index;
ret = smu_v11_0_wait_for_response(smu); ret = smu_v11_0_wait_for_response(smu);
if (ret) if (ret) {
pr_err("failed send message: %10s (%d) \tparam: 0x%08x response %#x\n", pr_err("Msg issuing pre-check failed and "
smu_get_message_name(smu, msg), index, param, ret); "SMU may be not in the right state!\n");
return ret;
}
WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0); WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
......
...@@ -66,15 +66,13 @@ int smu_v12_0_wait_for_response(struct smu_context *smu) ...@@ -66,15 +66,13 @@ int smu_v12_0_wait_for_response(struct smu_context *smu)
for (i = 0; i < adev->usec_timeout; i++) { for (i = 0; i < adev->usec_timeout; i++) {
cur_value = RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90); cur_value = RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90);
if ((cur_value & MP1_C2PMSG_90__CONTENT_MASK) != 0) if ((cur_value & MP1_C2PMSG_90__CONTENT_MASK) != 0)
break; return cur_value == 0x1 ? 0 : -EIO;
udelay(1); udelay(1);
} }
/* timeout means wrong logic */ /* timeout means wrong logic */
if (i == adev->usec_timeout) return -ETIME;
return -ETIME;
return RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90) == 0x1 ? 0 : -EIO;
} }
int int
...@@ -90,9 +88,11 @@ smu_v12_0_send_msg_with_param(struct smu_context *smu, ...@@ -90,9 +88,11 @@ smu_v12_0_send_msg_with_param(struct smu_context *smu,
return index; return index;
ret = smu_v12_0_wait_for_response(smu); ret = smu_v12_0_wait_for_response(smu);
if (ret) if (ret) {
pr_err("Failed to send message 0x%x, response 0x%x, param 0x%x\n", pr_err("Msg issuing pre-check failed and "
index, ret, param); "SMU may be not in the right state!\n");
return ret;
}
WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0); WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
......
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