Commit 74353883 authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher

drm/amdgpu: revise the mode2 reset for vangogh

PCIE MMIO bar needs to be restored firstly after the reset event
triggers. So it's unable to access the registers to wait for response
from SMU. Becasue the value of mmMP1_SMN_C2PMSG_90 is invalid at that
moment.
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Acked-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b6903089
...@@ -1562,9 +1562,29 @@ static int vangogh_post_smu_init(struct smu_context *smu) ...@@ -1562,9 +1562,29 @@ static int vangogh_post_smu_init(struct smu_context *smu)
} }
} }
static int vangogh_mode_reset(struct smu_context *smu, int type)
{
int ret = 0, index = 0;
index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
SMU_MSG_GfxDeviceDriverReset);
if (index < 0)
return index == -EACCES ? 0 : index;
mutex_lock(&smu->message_lock);
ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, type);
mutex_unlock(&smu->message_lock);
mdelay(10);
return ret;
}
static int vangogh_mode2_reset(struct smu_context *smu) static int vangogh_mode2_reset(struct smu_context *smu)
{ {
return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset, SMU_RESET_MODE_2, NULL); return vangogh_mode_reset(smu, SMU_RESET_MODE_2);
} }
static const struct pptable_funcs vangogh_ppt_funcs = { static const struct pptable_funcs vangogh_ppt_funcs = {
......
...@@ -68,14 +68,6 @@ static const char *smu_get_message_name(struct smu_context *smu, ...@@ -68,14 +68,6 @@ static const char *smu_get_message_name(struct smu_context *smu,
return __smu_message_names[type]; return __smu_message_names[type];
} }
static void smu_cmn_send_msg_without_waiting(struct smu_context *smu,
uint16_t msg)
{
struct amdgpu_device *adev = smu->adev;
WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_66, msg);
}
static void smu_cmn_read_arg(struct smu_context *smu, static void smu_cmn_read_arg(struct smu_context *smu,
uint32_t *arg) uint32_t *arg)
{ {
...@@ -104,6 +96,28 @@ static int smu_cmn_wait_for_response(struct smu_context *smu) ...@@ -104,6 +96,28 @@ static int smu_cmn_wait_for_response(struct smu_context *smu)
return RREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90); return RREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90);
} }
int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
uint16_t msg, uint32_t param)
{
struct amdgpu_device *adev = smu->adev;
int ret;
ret = smu_cmn_wait_for_response(smu);
if (ret != 0x1) {
dev_err(adev->dev, "Msg issuing pre-check failed and "
"SMU may be not in the right state!\n");
if (ret != -ETIME)
ret = -EIO;
return ret;
}
WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_82, param);
WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_66, msg);
return 0;
}
int smu_cmn_send_smc_msg_with_param(struct smu_context *smu, int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
enum smu_message_type msg, enum smu_message_type msg,
uint32_t param, uint32_t param,
...@@ -122,20 +136,9 @@ int smu_cmn_send_smc_msg_with_param(struct smu_context *smu, ...@@ -122,20 +136,9 @@ int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
return index == -EACCES ? 0 : index; return index == -EACCES ? 0 : index;
mutex_lock(&smu->message_lock); mutex_lock(&smu->message_lock);
ret = smu_cmn_wait_for_response(smu); ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, param);
if (ret != 0x1) { if (ret)
dev_err(adev->dev, "Msg issuing pre-check failed and "
"SMU may be not in the right state!\n");
if (ret != -ETIME)
ret = -EIO;
goto out; goto out;
}
WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_82, param);
smu_cmn_send_msg_without_waiting(smu, (uint16_t)index);
ret = smu_cmn_wait_for_response(smu); ret = smu_cmn_wait_for_response(smu);
if (ret != 0x1) { if (ret != 0x1) {
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include "amdgpu_smu.h" #include "amdgpu_smu.h"
#if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) || defined(SWSMU_CODE_LAYER_L4) #if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) || defined(SWSMU_CODE_LAYER_L4)
int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
uint16_t msg, uint32_t param);
int smu_cmn_send_smc_msg_with_param(struct smu_context *smu, int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
enum smu_message_type msg, enum smu_message_type msg,
uint32_t param, uint32_t param,
......
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