diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2020-11-25 11:21:31 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-01-13 23:47:58 -0500 |
commit | b913ec628ce2e701ba5a7d5f060f4d62d7a2ce06 (patch) | |
tree | 1a61185489afa5558543a5b57463e6661703df08 /drivers/gpu/drm/amd/amdgpu/nv.c | |
parent | 1608635534fb8cc42e94d19d52789d9448f02536 (diff) |
drm/amdgpu: fix mode2 reset sequence for vangogh
We need to save and restore PCI config space.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/nv.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/nv.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c index 1cd0741f14eb..b9722282d1b8 100644 --- a/drivers/gpu/drm/amd/amdgpu/nv.c +++ b/drivers/gpu/drm/amd/amdgpu/nv.c @@ -335,6 +335,38 @@ static int nv_asic_mode1_reset(struct amdgpu_device *adev) return ret; } +static int nv_asic_mode2_reset(struct amdgpu_device *adev) +{ + u32 i; + int ret = 0; + + amdgpu_atombios_scratch_regs_engine_hung(adev, true); + + /* disable BM */ + pci_clear_master(adev->pdev); + + amdgpu_device_cache_pci_state(adev->pdev); + + ret = amdgpu_dpm_mode2_reset(adev); + if (ret) + dev_err(adev->dev, "GPU mode2 reset failed\n"); + + amdgpu_device_load_pci_state(adev->pdev); + + /* wait for asic to come out of reset */ + for (i = 0; i < adev->usec_timeout; i++) { + u32 memsize = adev->nbio.funcs->get_memsize(adev); + + if (memsize != 0xffffffff) + break; + udelay(1); + } + + amdgpu_atombios_scratch_regs_engine_hung(adev, false); + + return ret; +} + static bool nv_asic_supports_baco(struct amdgpu_device *adev) { struct smu_context *smu = &adev->smu; @@ -392,7 +424,7 @@ static int nv_asic_reset(struct amdgpu_device *adev) break; case AMD_RESET_METHOD_MODE2: dev_info(adev->dev, "MODE2 reset\n"); - ret = amdgpu_dpm_mode2_reset(adev); + ret = nv_asic_mode2_reset(adev); break; default: dev_info(adev->dev, "MODE1 reset\n"); |