Skip to content

Commit 570a66b

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Fix wait after reset sequence in S3
For a mode-1 reset done at the end of S3 on PSPv11 dGPUs, only check if TOS is unloaded. Fixes: 32f7374 ("drm/amdgpu: Wait for bootloader after PSPv11 reset") Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4649 Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 1ad25fd)
1 parent b09cb29 commit 570a66b

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,9 +2632,14 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev)
26322632
{
26332633
struct drm_device *drm_dev = dev_get_drvdata(dev);
26342634
struct amdgpu_device *adev = drm_to_adev(drm_dev);
2635+
int r;
26352636

2636-
if (amdgpu_acpi_should_gpu_reset(adev))
2637-
return amdgpu_asic_reset(adev);
2637+
if (amdgpu_acpi_should_gpu_reset(adev)) {
2638+
amdgpu_device_lock_reset_domain(adev->reset_domain);
2639+
r = amdgpu_asic_reset(adev);
2640+
amdgpu_device_unlock_reset_domain(adev->reset_domain);
2641+
return r;
2642+
}
26382643

26392644
return 0;
26402645
}

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,37 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
142142
return err;
143143
}
144144

145-
static int psp_v11_0_wait_for_bootloader(struct psp_context *psp)
145+
static int psp_v11_wait_for_tos_unload(struct psp_context *psp)
146146
{
147147
struct amdgpu_device *adev = psp->adev;
148+
uint32_t sol_reg1, sol_reg2;
149+
int retry_loop;
148150

151+
/* Wait for the TOS to be unloaded */
152+
for (retry_loop = 0; retry_loop < 20; retry_loop++) {
153+
sol_reg1 = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);
154+
usleep_range(1000, 2000);
155+
sol_reg2 = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);
156+
if (sol_reg1 == sol_reg2)
157+
return 0;
158+
}
159+
dev_err(adev->dev, "TOS unload failed, C2PMSG_33: %x C2PMSG_81: %x",
160+
RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_33),
161+
RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81));
162+
163+
return -ETIME;
164+
}
165+
166+
static int psp_v11_0_wait_for_bootloader(struct psp_context *psp)
167+
{
168+
struct amdgpu_device *adev = psp->adev;
149169
int ret;
150170
int retry_loop;
151171

172+
/* For a reset done at the end of S3, only wait for TOS to be unloaded */
173+
if (adev->in_s3 && !(adev->flags & AMD_IS_APU) && amdgpu_in_reset(adev))
174+
return psp_v11_wait_for_tos_unload(psp);
175+
152176
for (retry_loop = 0; retry_loop < 20; retry_loop++) {
153177
/* Wait for bootloader to signify that is
154178
ready having bit 31 of C2PMSG_35 set to 1 */

0 commit comments

Comments
 (0)