Skip to contentSkip to conversation

drm/amdgpu: reciprocate amdgpu.._resume sequence to match amdgpu.._suspend

PATCH In review Shirish S 3 participants 3 messages Jul 18, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 drm/amdgpu: reciprocate amdgpu.._resume sequence to match amdgpu.._suspend

[Why]
1. To ensure that resume path reciprocates the sequence followed during suspend.
2. While the console_lock is held, console output will be buffered, till its unlocked it wont be emitted, hence its ideal to unlock sooner to enable debugging/detecting/fixing of any issue in the remaining sequence of events in resume path.

[How]
This patch restructures the console_lock, console_unlock around amdgpu_fbdev_set_suspend() and moves this new block to the very beginning of the resume sequence.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -8
index 709e4a3..fc4c517 100644
@@ -2720,8 +2720,11 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
-	if (fbcon)
+	if (fbcon) {
 		console_lock();
+		amdgpu_fbdev_set_suspend(adev, 0);
+		console_unlock();
+	}
 
 	if (resume) {
 		pci_set_power_state(dev->pdev, PCI_D0);
@@ -2746,7 +2749,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 
 	amdgpu_fence_driver_resume(adev);
 
-
 	r = amdgpu_device_ip_late_init(adev);
 	if (r)
 		goto unlock;
@@ -2808,13 +2810,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 	dev->dev->power.disable_depth--;
 #endif
 
-	if (fbcon)
-		amdgpu_fbdev_set_suspend(adev, 0);
-
 unlock:
-	if (fbcon)
-		console_unlock();
-
 	return r;
 }
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1531906808-9314-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 25 lines · Shirish S

[Why]
1. To ensure that resume path reciprocates the sequence followed during suspend.
2. While the console_lock is held, console output will be buffered, till its unlocked it wont be emitted, hence its ideal to unlock sooner to enable debugging/detecting/fixing of any issue in the remaining sequence of events in resume path.

[How]
This patch restructures the console_lock, console_unlock around amdgpu_fbdev_set_suspend() and moves this new block to the very beginning of the resume sequence.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 709e4a3..fc4c517 100644
@@ -2720,8 +2720,11 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -1
 
-	if (fbcon)
+	if (fbcon) {
 		console_lock();
+		amdgpu_fbdev_set_suspend(adev, 0);
+		console_unlock();
+	}
 
 	if (resume) {
 		pci_set_power_state(dev->pdev, PCI_D0);

I don't think the amdgpu_fbdev_set_suspend call can be moved before the pci_set_power_state call, because fbcon may presumably try writing to the device's VRAM at any point after amdgpu_fbdev_set_suspend.

There might be other things that need to happen before amdgpu_fbdev_set_suspend.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): ef073794-af83-fe37-758f-afd910915083-otUistvHUpPR7s880joybQ@public.gmane.org

#4 lore raw
Quoted 34 lines · Michel Dänzer
Quoted 33 lines · Shirish S

[Why]
1. To ensure that resume path reciprocates the sequence followed during suspend.
2. While the console_lock is held, console output will be buffered, till its unlocked it wont be emitted, hence its ideal to unlock sooner to enable debugging/detecting/fixing of any issue in the remaining sequence of events in resume path.

[How]
This patch restructures the console_lock, console_unlock around amdgpu_fbdev_set_suspend() and moves this new block to the very beginning of the resume sequence.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++--------
  1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -1
index 709e4a3..fc4c517 100644
@@ -2720,8 +2720,11 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
  	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
  		return 0;
 
-	if (fbcon)
+	if (fbcon) {
  		console_lock();
+		amdgpu_fbdev_set_suspend(adev, 0);
+		console_unlock();
+	}
 
Quoted 8 lines

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

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
  	if (resume) {
  		pci_set_power_state(dev->pdev, PCI_D0);

I don't think the amdgpu_fbdev_set_suspend call can be moved before the pci_set_power_state call, because fbcon may presumably try writing to the device's VRAM at any point after amdgpu_fbdev_set_suspend.

There might be other things that need to happen before amdgpu_fbdev_set_suspend.

Ok, in the next patch-set i have not moved amdgpu_fbdev_set_suspend()

Regards,
Shirish S

Signature · 7 lines
Regards,
Shirish S

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx