Skip to contentSkip to conversation

drm/amdgpu: always reset the asic in suspend

PATCH In review Alex Deucher 3 participants 4 messages Nov 12, 2021 – Nov 15, 2021

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: always reset the asic in suspend

If the platform suspend happens to fail and the power rail is not turned off, the GPU will be in an unknown state on resume, so reset the asic so that it will be in a known good state on resume even if the platform suspend failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -2
index 1db76429a673..42af3d88e0ba 100644
@@ -2165,8 +2165,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
 	adev->in_s3 = true;
 	r = amdgpu_device_suspend(drm_dev, true);
 	adev->in_s3 = false;
-
-	return r;
+	if (r)
+		return r;
+	return amdgpu_asic_reset(adev);
 }
 
 static int amdgpu_pmops_resume(struct device *dev)
Signature · 1 line
2.31.1
#1 lore raw

Actually, ignore this for now. This will likely cause problems with S0ix.

Alex

Quoted 30 lines · Alex Deucher

If the platform suspend happens to fail and the power rail is not turned off, the GPU will be in an unknown state on resume, so reset the asic so that it will be in a known good state on resume even if the platform suspend failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -3
index 1db76429a673..42af3d88e0ba 100644
@@ -2165,8 +2165,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
        adev->in_s3 = true;
        r = amdgpu_device_suspend(drm_dev, true);
        adev->in_s3 = false;
-
-       return r;
+       if (r)
+               return r;
+       return amdgpu_asic_reset(adev);
 }
 
 static int amdgpu_pmops_resume(struct device *dev)
--

2.31.1

#2 lore raw

I was just about to write up my concern as well.

IIRC we used to have that and it didn't really worked that well and we switched to resetting the GPU on driver load instead if initializing it doesn't work of hand.

Christian.

Am 12.11.21 um 17:19 schrieb Alex Deucher:

Quoted 34 lines

Actually, ignore this for now. This will likely cause problems with S0ix.

Alex

Quoted 29 lines · Alex Deucher

If the platform suspend happens to fail and the power rail is not turned off, the GPU will be in an unknown state on resume, so reset the asic so that it will be in a known good state on resume even if the platform suspend failed.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -3
index 1db76429a673..42af3d88e0ba 100644
@@ -2165,8 +2165,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
         adev->in_s3 = true;
         r = amdgpu_device_suspend(drm_dev, true);
         adev->in_s3 = false;
-
-       return r;
+       if (r)
+               return r;
+       return amdgpu_asic_reset(adev);
  }
 
  static int amdgpu_pmops_resume(struct device *dev)
--

2.31.1

author maintainer
#3 lore raw

[AMD Official Use Only]

Well, that handles the case of the GPU needing to be reset on driver (e.g., virtualization), but doesn't handle the interrupted suspend case (e.g., when suspend is unwound before the power rail was turned off). We already so something similar for hibernate to deal with the multiple freeze and thaw cycles.

Alex

________________________________
From: Christian König <[email protected]>
Sent: Monday, November 15, 2021 8:41 AM
To: Alex Deucher <[email protected]>; Deucher, Alexander <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: always reset the asic in suspend

I was just about to write up my concern as well.

IIRC we used to have that and it didn't really worked that well and we switched to resetting the GPU on driver load instead if initializing it doesn't work of hand.

Christian.

Am 12.11.21 um 17:19 schrieb Alex Deucher:

Quoted 34 lines

Actually, ignore this for now. This will likely cause problems with S0ix.

Alex

Quoted 29 lines · Alex Deucher

If the platform suspend happens to fail and the power rail is not turned off, the GPU will be in an unknown state on resume, so reset the asic so that it will be in a known good state on resume even if the platform suspend failed.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -3
index 1db76429a673..42af3d88e0ba 100644
@@ -2165,8 +2165,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
         adev->in_s3 = true;
         r = amdgpu_device_suspend(drm_dev, true);
         adev->in_s3 = false;
-
-       return r;
+       if (r)
+               return r;
+       return amdgpu_asic_reset(adev);
  }
 
  static int amdgpu_pmops_resume(struct device *dev)
--

2.31.1