Skip to contentSkip to conversation

drm/radeon: Reset ASIC if suspend is not managed by platform firmware

PATCH In review Kai-Heng Feng 2 participants 5 messages Sep 1, 2020 – Sep 2, 2020

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

PATCH 1/1 drm/radeon: Reset ASIC if suspend is not managed by platform firmware

Suspend with s2idle or by the following steps cause screen frozen:

 # echo devices > /sys/power/pm_test
 # echo freeze > /sys/power/mem
[  289.625461] [drm:uvd_v1_0_ib_test [radeon]] *ERROR* radeon: fence wait timed out.
[  289.625494] [drm:radeon_ib_ring_tests [radeon]] *ERROR* radeon: failed testing IB on ring 5 (-110).

The issue doesn't happen on traditional S3, probably because firmware or hardware provides extra power management.

Inspired by Daniel Drake's patch [1] on amdgpu, using a similar approach can fix the issue.

[1] https://patchwork.freedesktop.org/patch/335839/

---
 drivers/gpu/drm/radeon/radeon_device.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +3 -0
index 266e3cbbd09b..df823b9ad79f 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <linux/vga_switcheroo.h>
 #include <linux/vgaarb.h>
+#include <linux/suspend.h>
 
 #include <drm/drm_cache.h>
 #include <drm/drm_crtc_helper.h>
@@ -1643,6 +1644,8 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,
 		rdev->asic->asic_reset(rdev, true);
 		pci_restore_state(dev->pdev);
 	} else if (suspend) {
+		if (pm_suspend_no_platform())
+			rdev->asic->asic_reset(rdev, true);
 		/* Shut down the device */
 		pci_disable_device(dev->pdev);
 		pci_set_power_state(dev->pdev, PCI_D3hot);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 5 lines · Kai-Heng Feng

Suspend with s2idle or by the following steps cause screen frozen:

 # echo devices > /sys/power/pm_test
 # echo freeze > /sys/power/mem
Quoted 8 lines
[  289.625461] [drm:uvd_v1_0_ib_test [radeon]] *ERROR* radeon: fence wait timed out.
[  289.625494] [drm:radeon_ib_ring_tests [radeon]] *ERROR* radeon: failed testing IB on ring 5 (-110).

The issue doesn't happen on traditional S3, probably because firmware or hardware provides extra power management.

Inspired by Daniel Drake's patch [1] on amdgpu, using a similar approach can fix the issue.

It doesn't actually fix the issue. The device is never powered down so you are using more power than you would if you did not suspend in the first place. The reset just works around the fact that the device is never powered down.

Alex

Quoted 32 lines

[1] https://patchwork.freedesktop.org/patch/335839/

---
 drivers/gpu/drm/radeon/radeon_device.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +3 -1
index 266e3cbbd09b..df823b9ad79f 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <linux/vga_switcheroo.h>
 #include <linux/vgaarb.h>
+#include <linux/suspend.h>
 
 #include <drm/drm_cache.h>
 #include <drm/drm_crtc_helper.h>
@@ -1643,6 +1644,8 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,
                rdev->asic->asic_reset(rdev, true);
                pci_restore_state(dev->pdev);
        } else if (suspend) {
+               if (pm_suspend_no_platform())
+                       rdev->asic->asic_reset(rdev, true);
                /* Shut down the device */
                pci_disable_device(dev->pdev);
                pci_set_power_state(dev->pdev, PCI_D3hot);
--

2.17.1

Quoted 4 lines

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

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

#2 lore raw
Quoted 17 lines · Alex Deucher
Quoted 11 lines · Kai-Heng Feng

Suspend with s2idle or by the following steps cause screen frozen:

# echo devices > /sys/power/pm_test
# echo freeze > /sys/power/mem
[  289.625461] [drm:uvd_v1_0_ib_test [radeon]] *ERROR* radeon: fence wait timed out.
[  289.625494] [drm:radeon_ib_ring_tests [radeon]] *ERROR* radeon: failed testing IB on ring 5 (-110).

The issue doesn't happen on traditional S3, probably because firmware or hardware provides extra power management.

Quoted 7 lines
Quoted 2 lines

Inspired by Daniel Drake's patch [1] on amdgpu, using a similar approach can fix the issue.

It doesn't actually fix the issue. The device is never powered down so you are using more power than you would if you did not suspend in the first place. The reset just works around the fact that the device is never powered down.

So how do we properly suspend/resume the device without help from platform firmware?

Kai-Heng

Quoted 39 lines

Alex

Quoted 36 lines

[1] https://patchwork.freedesktop.org/patch/335839/

---
drivers/gpu/drm/radeon/radeon_device.c | 3 +++

1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +3 -1
index 266e3cbbd09b..df823b9ad79f 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <linux/vga_switcheroo.h>
 #include <linux/vgaarb.h>
+#include <linux/suspend.h>
 
 #include <drm/drm_cache.h>
 #include <drm/drm_crtc_helper.h>
@@ -1643,6 +1644,8 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,
               rdev->asic->asic_reset(rdev, true);
               pci_restore_state(dev->pdev);
       } else if (suspend) {
+               if (pm_suspend_no_platform())
+                       rdev->asic->asic_reset(rdev, true);
               /* Shut down the device */
               pci_disable_device(dev->pdev);
               pci_set_power_state(dev->pdev, PCI_D3hot);
--

2.17.1

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

#3 lore raw
Quoted 21 lines · Kai-Heng Feng
Quoted 21 lines · Alex Deucher
Quoted 13 lines · Kai-Heng Feng

Suspend with s2idle or by the following steps cause screen frozen:

# echo devices > /sys/power/pm_test
# echo freeze > /sys/power/mem
[  289.625461] [drm:uvd_v1_0_ib_test [radeon]] *ERROR* radeon: fence wait timed out.
[  289.625494] [drm:radeon_ib_ring_tests [radeon]] *ERROR* radeon: failed testing IB on ring 5 (-110).

The issue doesn't happen on traditional S3, probably because firmware or hardware provides extra power management.

Inspired by Daniel Drake's patch [1] on amdgpu, using a similar approach can fix the issue.

Quoted 6 lines
Quoted 4 lines

It doesn't actually fix the issue. The device is never powered down so you are using more power than you would if you did not suspend in the first place. The reset just works around the fact that the device is never powered down.

So how do we properly suspend/resume the device without help from platform firmware?

I guess you don't?

Alex

Quoted 38 lines

Kai-Heng

Quoted 35 lines

Alex

Quoted 32 lines

[1] https://patchwork.freedesktop.org/patch/335839/

---
drivers/gpu/drm/radeon/radeon_device.c | 3 +++

1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +3 -1
index 266e3cbbd09b..df823b9ad79f 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <linux/vga_switcheroo.h>
 #include <linux/vgaarb.h>
+#include <linux/suspend.h>
 
 #include <drm/drm_cache.h>
 #include <drm/drm_crtc_helper.h>
@@ -1643,6 +1644,8 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,
               rdev->asic->asic_reset(rdev, true);
               pci_restore_state(dev->pdev);
       } else if (suspend) {
+               if (pm_suspend_no_platform())
+                       rdev->asic->asic_reset(rdev, true);
               /* Shut down the device */
               pci_disable_device(dev->pdev);
               pci_set_power_state(dev->pdev, PCI_D3hot);
--

2.17.1

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

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

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

#4 lore raw
Quoted 27 lines · Alex Deucher
Quoted 21 lines · Kai-Heng Feng
Quoted 21 lines · Alex Deucher
Quoted 13 lines · Kai-Heng Feng

Suspend with s2idle or by the following steps cause screen frozen:

# echo devices > /sys/power/pm_test
# echo freeze > /sys/power/mem
[  289.625461] [drm:uvd_v1_0_ib_test [radeon]] *ERROR* radeon: fence wait timed out.
[  289.625494] [drm:radeon_ib_ring_tests [radeon]] *ERROR* radeon: failed testing IB on ring 5 (-110).

The issue doesn't happen on traditional S3, probably because firmware or hardware provides extra power management.

Inspired by Daniel Drake's patch [1] on amdgpu, using a similar approach can fix the issue.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

It doesn't actually fix the issue. The device is never powered down so you are using more power than you would if you did not suspend in the first place. The reset just works around the fact that the device is never powered down.

So how do we properly suspend/resume the device without help from platform firmware?

I guess you don't?

Unfortunate but I guess we need to accept reality and use the default suspend method.

Kai-Heng

Quoted 47 lines

Alex

Quoted 43 lines

Kai-Heng

Quoted 39 lines

Alex

Quoted 36 lines

[1] https://patchwork.freedesktop.org/patch/335839/

---
drivers/gpu/drm/radeon/radeon_device.c | 3 +++

1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +3 -1
index 266e3cbbd09b..df823b9ad79f 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <linux/vga_switcheroo.h>
 #include <linux/vgaarb.h>
+#include <linux/suspend.h>
 
 #include <drm/drm_cache.h>
 #include <drm/drm_crtc_helper.h>
@@ -1643,6 +1644,8 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,
              rdev->asic->asic_reset(rdev, true);
              pci_restore_state(dev->pdev);
      } else if (suspend) {
+               if (pm_suspend_no_platform())
+                       rdev->asic->asic_reset(rdev, true);
              /* Shut down the device */
              pci_disable_device(dev->pdev);
              pci_set_power_state(dev->pdev, PCI_D3hot);
--

2.17.1

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