Commit 8f2ccaaa authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher

drm/amdgpu: Add mode-2 reset in SMU v13.0.6

Modifications to mode-2 reset flow for SMU v13.0.6 ASICs.
Signed-off-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarLe Ma <le.ma@amd.com>
Reviewed-by: default avatarAsad Kamal <asad.kamal@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7214c08c
...@@ -556,6 +556,15 @@ soc15_asic_reset_method(struct amdgpu_device *adev) ...@@ -556,6 +556,15 @@ soc15_asic_reset_method(struct amdgpu_device *adev)
if (connected_to_cpu) if (connected_to_cpu)
return AMD_RESET_METHOD_MODE2; return AMD_RESET_METHOD_MODE2;
break; break;
case IP_VERSION(13, 0, 6):
/* Use gpu_recovery param to target a reset method.
* Enable triggering of GPU reset only if specified
* by module parameter.
*/
if (amdgpu_gpu_recovery == 4 || amdgpu_gpu_recovery == 5)
return AMD_RESET_METHOD_MODE2;
else
return AMD_RESET_METHOD_NONE;
default: default:
break; break;
} }
......
...@@ -2024,27 +2024,27 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table ...@@ -2024,27 +2024,27 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table
static int smu_v13_0_6_mode2_reset(struct smu_context *smu) static int smu_v13_0_6_mode2_reset(struct smu_context *smu)
{ {
u32 smu_version;
int ret = 0, index; int ret = 0, index;
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
int timeout = 10; int timeout = 10;
smu_cmn_get_smc_version(smu, NULL, &smu_version);
index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG, index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
SMU_MSG_GfxDeviceDriverReset); SMU_MSG_GfxDeviceDriverReset);
mutex_lock(&smu->message_lock); mutex_lock(&smu->message_lock);
ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index,
SMU_RESET_MODE_2); SMU_RESET_MODE_2);
/* This is similar to FLR, wait till max FLR timeout */ /* This is similar to FLR, wait till max FLR timeout */
msleep(100); msleep(100);
dev_dbg(smu->adev->dev, "restore config space...\n"); dev_dbg(smu->adev->dev, "restore config space...\n");
/* Restore the config space saved during init */ /* Restore the config space saved during init */
amdgpu_device_load_pci_state(adev->pdev); amdgpu_device_load_pci_state(adev->pdev);
dev_dbg(smu->adev->dev, "wait for reset ack\n"); dev_dbg(smu->adev->dev, "wait for reset ack\n");
while (ret == -ETIME && timeout) { do {
ret = smu_cmn_wait_for_response(smu); ret = smu_cmn_wait_for_response(smu);
/* Wait a bit more time for getting ACK */ /* Wait a bit more time for getting ACK */
if (ret == -ETIME) { if (ret == -ETIME) {
...@@ -2053,16 +2053,14 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu) ...@@ -2053,16 +2053,14 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu)
continue; continue;
} }
if (ret != 1) { if (ret) {
dev_err(adev->dev, dev_err(adev->dev,
"failed to send mode2 message \tparam: 0x%08x response %#x\n", "failed to send mode2 message \tparam: 0x%08x error code %d\n",
SMU_RESET_MODE_2, ret); SMU_RESET_MODE_2, ret);
goto out; goto out;
} }
} } while (ret == -ETIME && timeout);
if (ret == 1)
ret = 0;
out: out:
mutex_unlock(&smu->message_lock); mutex_unlock(&smu->message_lock);
......
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