Skip to contentSkip to conversation

drm/amdgpu: wait till Gfxoff allow signal completes during suspend

PATCH In review Harsh Jain 3 participants 4 messages Nov 4, 2022

Subsystems (2)
lore
Share & tools
lore

Harsh Jain

author
#0 lore raw

PATCH 1/1 drm/amdgpu: wait till Gfxoff allow signal completes during suspend

change guarantees that gfxoff is allowed before moving further in s2idle sequence to add more reliablity about gfxoff in amdgpu IP's suspend flow

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -3
index 222d3d7ea076..5b2afe348c23 100644
@@ -581,11 +581,11 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
 
 		if (adev->gfx.gfx_off_req_count == 0 &&
 		    !adev->gfx.gfx_off_state) {
-			/* If going to s2idle, no need to wait */
-			if (adev->in_s0ix)
-				delay = GFX_OFF_NO_DELAY;
 			schedule_delayed_work(&adev->gfx.gfx_off_delay_work,
 					      delay);
+			/* If going to s2idle, no need to wait */
+			if (adev->in_s0ix)
+				flush_delayed_work(&adev->gfx.gfx_off_delay_work);
 		}
 	} else {
 		if (adev->gfx.gfx_off_req_count == 0) {
Signature · 1 line
2.25.1
#1 lore raw

[AMD Official Use Only - General]

Quoted 25 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Harsh Jain
Sent: Friday, November 4, 2022 12:17 PM
To: Deucher, Alexander <[email protected]>
Cc: Jain, Harsh <[email protected]>; [email protected]
Subject: [PATCH] drm/amdgpu: wait till Gfxoff allow signal completes during suspend

change guarantees that gfxoff is allowed before moving further in s2idle sequence to add more reliablity about gfxoff in amdgpu IP's suspend flow

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 -0
index 222d3d7ea076..5b2afe348c23 100644
@@ -581,11 +581,11 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device
 *adev, bool enable)
 
 		if (adev->gfx.gfx_off_req_count == 0 &&
 		    !adev->gfx.gfx_off_state) {

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_off_ctrl(struct amdgpu_device · line 591

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -3
-			/* If going to s2idle, no need to wait */
-			if (adev->in_s0ix)
-				delay = GFX_OFF_NO_DELAY;
 			schedule_delayed_work(&adev-
 >gfx.gfx_off_delay_work,
 					      delay);
+			/* If going to s2idle, no need to wait */
+			if (adev->in_s0ix)
+				flush_delayed_work(&adev-
 >gfx.gfx_off_delay_work);

[Quan, Evan] This seems a little weird. Can you just call amdgpu_device_delay_enable_gfx_off directly for s0ix case?

Evan

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 -1
 		}
 	} else {
 		if (adev->gfx.gfx_off_req_count == 0) {
--

2.25.1

#2 lore raw

Please find my reply inline below

Quoted 30 lines
Quoted 30 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Harsh Jain
Sent: Friday, November 4, 2022 12:17 PM
To: Deucher, Alexander <[email protected]>
Cc: Jain, Harsh <[email protected]>; [email protected]
Subject: [PATCH] drm/amdgpu: wait till Gfxoff allow signal completes during suspend

change guarantees that gfxoff is allowed before moving further in s2idle sequence to add more reliablity about gfxoff in amdgpu IP's suspend flow

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 -3
index 222d3d7ea076..5b2afe348c23 100644
@@ -581,11 +581,11 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device 
 *adev, bool enable)
 
 		if (adev->gfx.gfx_off_req_count == 0 &&
 		    !adev->gfx.gfx_off_state) {
-			/* If going to s2idle, no need to wait */
-			if (adev->in_s0ix)
-				delay = GFX_OFF_NO_DELAY;
 			schedule_delayed_work(&adev-
 >gfx.gfx_off_delay_work,
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -0
 					      delay);
+			/* If going to s2idle, no need to wait */
+			if (adev->in_s0ix)
+				flush_delayed_work(&adev-
 >gfx.gfx_off_delay_work);

[Quan, Evan] This seems a little weird. Can you just call amdgpu_device_delay_enable_gfx_off directly for s0ix case?

Evan

[Harsh Jain] amdgpu_device_delay_enable_gfx_off is a static function in amdgpu_device file.
It's better to keep it static otherwise it would create a new api for gfxoff control for which current api amdgpu_gfx_off_ctrl is available.

Thanks

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 -1
 		}
 	} else {
 		if (adev->gfx.gfx_off_req_count == 0) {
--

2.25.1

#3 lore raw
In reply to Harsh Jain
Quoted 12 lines · Harsh Jain

change guarantees that gfxoff is allowed before moving further in s2idle sequence to add more reliablity about gfxoff in amdgpu IP's suspend flow

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 -0
index 222d3d7ea076..5b2afe348c23 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable) · line 586

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 -3
@@ -581,11 +581,11 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
 
                if (adev->gfx.gfx_off_req_count == 0 &&
                    !adev->gfx.gfx_off_state) {
-                       /* If going to s2idle, no need to wait */
-                       if (adev->in_s0ix)
-                               delay = GFX_OFF_NO_DELAY;

I think we can leave this hunk. The 0 delay is still fine even if if flush.

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -1
                        schedule_delayed_work(&adev->gfx.gfx_off_delay_work,
                                              delay);
+                       /* If going to s2idle, no need to wait */
+                       if (adev->in_s0ix)
+                               flush_delayed_work(&adev->gfx.gfx_off_delay_work);
                }
        } else {
                if (adev->gfx.gfx_off_req_count == 0) {
--

2.25.1