All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: always reset asic when going into suspend
@ 2019-10-15  6:50 Daniel Drake
       [not found] ` <20191015065002.18701-1-drake-6IF/jdPJHihWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 22+ messages in thread
From: Daniel Drake @ 2019-10-15  6:50 UTC (permalink / raw)
  To: alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Asus UX434DA (Ryzen7 3700U), upon resume from s2idle, the screen
turns on again and shows the pre-suspend image, but the display remains
frozen from that point onwards.

The kernel logs show errors:

 [drm] psp command failed and response status is (0x7)
 [drm] Fence fallback timer expired on ring sdma0
 [drm] Fence fallback timer expired on ring gfx
 amdgpu 0000:03:00.0: [drm:amdgpu_ib_ring_tests] *ERROR* IB test failed on gfx (-22).
 [drm:process_one_work] *ERROR* ib ring test failed (-22).

This can also be reproduced with pm_test:
 # echo devices > /sys/power/pm_test
 # echo freeze > /sys/power/mem

The same reproducer causes the same problem on Asus X512DK (Ryzen5 3500U)
even though that model is normally able to suspend and resume OK via S3.

Experimenting, I observed that this error condition can be invoked on
any amdgpu product by executing in succession:

  amdgpu_device_suspend(drm_dev, true, true);
  amdgpu_device_resume(drm_dev, true, true);

i.e. it appears that the resume routine is unable to get the device out
of suspended state, except for the S3 suspend case where it presumably has
a bit of extra help from the firmware or hardware.

However, I also observed that the runtime suspend/resume routines work
OK when tested like this, which lead me to the key difference in these
two cases: the ASIC reset, which only happens in the runtime suspend path.

Since it takes less than 1ms, we should do the ASIC reset in all
suspend paths, fixing resume from s2idle on these products.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=111811
Signed-off-by: Daniel Drake <drake@endlessm.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 5a1939dbd4e3..7f4870e974fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3082,15 +3082,16 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
 	 */
 	amdgpu_bo_evict_vram(adev);
 
+	amdgpu_asic_reset(adev);
+	r = amdgpu_asic_reset(adev);
+	if (r)
+		DRM_ERROR("amdgpu asic reset failed\n");
+
 	pci_save_state(dev->pdev);
 	if (suspend) {
 		/* Shut down the device */
 		pci_disable_device(dev->pdev);
 		pci_set_power_state(dev->pdev, PCI_D3hot);
-	} else {
-		r = amdgpu_asic_reset(adev);
-		if (r)
-			DRM_ERROR("amdgpu asic reset failed\n");
 	}
 
 	return 0;
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-10-23 15:05 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15  6:50 [PATCH] drm/amdgpu: always reset asic when going into suspend Daniel Drake
     [not found] ` <20191015065002.18701-1-drake-6IF/jdPJHihWk0Htik3J/w@public.gmane.org>
2019-10-15 18:42   ` Alex Deucher
2019-10-16  7:23     ` Daniel Drake
2019-10-16  7:23       ` Daniel Drake
2019-11-22 15:31       ` Alex Deucher
2019-11-22 15:31         ` Alex Deucher
2019-11-22 15:31         ` Alex Deucher
2019-11-25  5:17         ` Daniel Drake
2019-11-25  5:17           ` Daniel Drake
2019-11-25  5:17           ` Daniel Drake
2019-12-16  9:00           ` Daniel Drake
2019-12-16  9:00             ` Daniel Drake
2019-12-19 14:08             ` Alex Deucher
2019-12-19 14:08               ` Alex Deucher
2020-01-15  7:44               ` Daniel Drake
2020-01-15  7:44                 ` Daniel Drake
2020-01-16 15:14                 ` Alex Deucher
2020-01-16 15:14                   ` Alex Deucher
2020-02-07  4:52                   ` Daniel Drake
2020-02-07  4:52                     ` Daniel Drake
2020-10-23 15:04                   ` Alex Deucher
2020-10-23 15:04                     ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.