Skip to contentSkip to conversation

drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume

PATCH In review Prike Liang 3 participants 4 messages Oct 21, 2022 – Oct 25, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume

In the S2idle suspend/resume phase the gfxoff is keeping functional so some IP blocks will be likely to reinitialize at gfxoff entry and that will result in failing to program GC registers.Therefore, let disallow gfxoff until AMDGPU IPs reinitialized completely.

---
-v2: Move the operation of exiting gfxoff from smu to higer layer in amdgpu_device.c.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10 -0
index 5b8362727226..36c44625932e 100644
@@ -3210,6 +3210,12 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
 			return r;
 		}
 		adev->ip_blocks[i].status.hw = true;
+
+		if (adev->in_s0ix && adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
+			amdgpu_gfx_off_ctrl(adev, false);
+			DRM_DEBUG("will disable gfxoff for re-initializing other blocks\n");
+		}
+
 	}
 
 	return 0;
@@ -4185,6 +4191,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
 	/* Make sure IB tests flushed */
 	flush_delayed_work(&adev->delayed_init_work);
 
+	if (adev->in_s0ix) {
+		amdgpu_gfx_off_ctrl(adev, true);
+		DRM_DEBUG("will enable gfxoff for the mission mode\n");
+	}
 	if (fbcon)
 		drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, false);
 
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#1 lore raw
Quoted 18 lines · Prike Liang

In the S2idle suspend/resume phase the gfxoff is keeping functional so some IP blocks will be likely to reinitialize at gfxoff entry and that will result in failing to program GC registers.Therefore, let disallow gfxoff until AMDGPU IPs reinitialized completely.

---

(quoted diff) +0 -1
-v2: Move the operation of exiting gfxoff from smu to higer layer in amdgpu_device.c.
 
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 5b8362727226..36c44625932e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev) · line 3214

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
@@ -3210,6 +3210,12 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
                        return r;
                }
                adev->ip_blocks[i].status.hw = true;
+
+               if (adev->in_s0ix && adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {

Add a comment here something like:
/* disable gfxoff for IP resume. gfxoff is re-enabled in amdgpu_device_resume() after IP resume */

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 4194

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
+                       amdgpu_gfx_off_ctrl(adev, false);
+                       DRM_DEBUG("will disable gfxoff for re-initializing other blocks\n");
+               }
+
        }
 
        return 0;
@@ -4185,6 +4191,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
        /* Make sure IB tests flushed */
        flush_delayed_work(&adev->delayed_init_work);
 
+       if (adev->in_s0ix) {

Add a comment here something like:
/* re-enable gfxoff after IP resume. This re-enables gfxoff after it was disabled for IP resume in amdgpu_device_ip_resume_phase2() */

This those comments added, the patch is:

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -1
+               amdgpu_gfx_off_ctrl(adev, true);
+               DRM_DEBUG("will enable gfxoff for the mission mode\n");
+       }
        if (fbcon)
                drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, false);
 
--

2.25.1

#2 lore raw
In reply to Prike Liang

[AMD Official Use Only - General]

Quoted 10 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Prike Liang
Sent: Friday, October 21, 2022 10:47 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2] drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume

Quoted 4 lines

In the S2idle suspend/resume phase the gfxoff is keeping functional so some IP blocks will be likely to reinitialize at gfxoff entry and that will result in failing to program GC registers.Therefore, let disallow gfxoff until AMDGPU IPs reinitialized completely.

[Quan, Evan] It seems the issue described here has nothing related with suspend. Instead it happened during resuming only. Right? If so, I would suggest to drop the confusing "suspend" from the description part.
Other than that, the patch is reviewed-by: Evan Quan <[email protected]>

Evan

Quoted 46 lines

---
-v2: Move the operation of exiting gfxoff from smu to higer layer in amdgpu_device.c.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
index 5b8362727226..36c44625932e 100644
@@ -3210,6 +3210,12 @@ static int
 amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
 			return r;
 		}
 		adev->ip_blocks[i].status.hw = true;
+
+		if (adev->in_s0ix && adev->ip_blocks[i].version->type ==
 AMD_IP_BLOCK_TYPE_SMC) {
+			amdgpu_gfx_off_ctrl(adev, false);
+			DRM_DEBUG("will disable gfxoff for re-initializing
 other blocks\n");
+		}
+
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
 	}
 
 	return 0;
@@ -4185,6 +4191,10 @@ int amdgpu_device_resume(struct drm_device
 *dev, bool fbcon)
 	/* Make sure IB tests flushed */
 	flush_delayed_work(&adev->delayed_init_work);
 
+	if (adev->in_s0ix) {
+		amdgpu_gfx_off_ctrl(adev, true);
+		DRM_DEBUG("will enable gfxoff for the mission mode\n");
+	}
 	if (fbcon)
 

drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)-

Quoted 1 line

fb_helper, false);

--
2.25.1

#3 lore raw

[Public]

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Monday, October 24, 2022 2:31 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: RE: [PATCH v2] drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume

[AMD Official Use Only - General]

Quoted 10 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Prike Liang
Sent: Friday, October 21, 2022 10:47 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2] drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume

Quoted 4 lines

In the S2idle suspend/resume phase the gfxoff is keeping functional so some IP blocks will be likely to reinitialize at gfxoff entry and that will result in failing to program GC registers.Therefore, let disallow gfxoff until AMDGPU IPs reinitialized completely.

[Quan, Evan] It seems the issue described here has nothing related with suspend. Instead it happened during resuming only. Right? If so, I would suggest to drop the confusing "suspend" from the description part.
Other than that, the patch is reviewed-by: Evan Quan <[email protected]>

Evan

[Prike] Yes this problem only observed on the s2idle resume period, but that's true the s2idle suspend and resume keep the gfxoff being functional.

Quoted 46 lines

---
-v2: Move the operation of exiting gfxoff from smu to higer layer in amdgpu_device.c.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
index 5b8362727226..36c44625932e 100644
@@ -3210,6 +3210,12 @@ static int
 amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
                      return r;
              }
              adev->ip_blocks[i].status.hw = true;
+
+             if (adev->in_s0ix && adev->ip_blocks[i].version->type ==
 AMD_IP_BLOCK_TYPE_SMC) {
+                     amdgpu_gfx_off_ctrl(adev, false);
+                     DRM_DEBUG("will disable gfxoff for re-initializing
 other blocks\n");
+             }
+
      }

      return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
@@ -4185,6 +4191,10 @@ int amdgpu_device_resume(struct drm_device
 *dev, bool fbcon)
      /* Make sure IB tests flushed */
      flush_delayed_work(&adev->delayed_init_work);
 
+     if (adev->in_s0ix) {
+             amdgpu_gfx_off_ctrl(adev, true);
+             DRM_DEBUG("will enable gfxoff for the mission mode\n");
+     }
      if (fbcon)
 

drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)-

Quoted 1 line

fb_helper, false);

--
2.25.1