Skip to contentSkip to conversation

drm/amdgpu: atombios stuck executing during S3 stress test

PATCH In review jimqu 2 participants 3 messages Oct 19, 2016 – Oct 20, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

jimqu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: atombios stuck executing during S3 stress test

Sometimes, atombios may be stucked when resume back. Duo to PCIE has set to D3cold, the ACC of GFX adapter is power-down. it should re-init the scratch registers. with the change, test is pass more than 80 cycles on Fiji.

Change-Id I9cf40c475c4a5a31216949d50cc5e30b74dc21c4
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index e82c487..bfe9a5c 100644
@@ -2098,6 +2098,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 				console_unlock();
 			return r;
 		}
+		amdgpu_atombios_scratch_regs_init(adev);
 	}
 
 	/* post card */
Signature · 6 lines
1.9.1

_______________________________________________
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): 1476865529-8924-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 7 lines · jimqu

Sometimes, atombios may be stucked when resume back. Duo to PCIE has set to D3cold, the ACC of GFX adapter is power-down. it should re-init the scratch registers. with the change, test is pass more than 80 cycles on Fiji.

Change-Id I9cf40c475c4a5a31216949d50cc5e30b74dc21c4

I think we probably want to save/restore these, although this shouldn't hurt. How about this patch?

Alex

Quoted 19 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index e82c487..bfe9a5c 100644
@@ -2098,6 +2098,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
                                console_unlock();
                        return r;
                }
+               amdgpu_atombios_scratch_regs_init(adev);
        }
 
        /* post card */
--

1.9.1

Quoted 4 lines

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

From bf70713edda60da5713e4acd8f1615144e02abe2 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Wed, 19 Oct 2016 14:40:58 -0400
Subject: [PATCH] drm/amdgpu: move atom scratch register save/restore to common
code

We need this for more than just DCE. Move it out of the DCE modules and into the device code. This way we can be sure the scratch registers are initialized properly before we run asic_init which happens before DCE IPs are restored.

Fixes atombios hangs in asic_init.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c     | 6 ------
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c     | 6 ------
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c      | 6 ------
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c      | 6 ------
 5 files changed, 4 insertions(+), 25 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -1
index eb1b9e39..b7b6542 100644
@@ -2004,6 +2004,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
 	 */
 	amdgpu_bo_evict_vram(adev);
 
+	amdgpu_atombios_scratch_regs_save(adev);
 	pci_save_state(dev->pdev);
 	if (suspend) {
 		/* Shut down the device */
@@ -2055,6 +2056,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 			return r;
 		}
 	}
+	amdgpu_atombios_scratch_regs_restore(adev);
 
 	/* post card */
 	if (!amdgpu_card_posted(adev) || !resume) {
@@ -2322,8 +2324,9 @@ retry:
 			amdgpu_display_stop_mc_access(adev, &save);
 			amdgpu_wait_for_idle(adev, AMD_IP_BLOCK_TYPE_GMC);
 		}
-
+		amdgpu_atombios_scratch_regs_save(adev);
 		r = amdgpu_asic_reset(adev);
+		amdgpu_atombios_scratch_regs_restore(adev);
 		/* post card */
 		amdgpu_atom_asic_init(adev->mode_info.atom_context);
 
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +0 -6
index e5d0edf..0c01852 100644
@@ -3067,10 +3067,6 @@ static int dce_v10_0_hw_fini(void *handle)
 
 static int dce_v10_0_suspend(void *handle)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	amdgpu_atombios_scratch_regs_save(adev);
-
 	return dce_v10_0_hw_fini(handle);
 }
 
@@ -3081,8 +3077,6 @@ static int dce_v10_0_resume(void *handle)
 
 	ret = dce_v10_0_hw_init(handle);
 
-	amdgpu_atombios_scratch_regs_restore(adev);
-
 	/* turn on the BL */
 	if (adev->mode_info.bl_encoder) {
 		u8 bl_level = amdgpu_display_backlight_get_level(adev,
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +0 -6
index 9719b2b..2946674 100644
@@ -3131,10 +3131,6 @@ static int dce_v11_0_hw_fini(void *handle)
 
 static int dce_v11_0_suspend(void *handle)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	amdgpu_atombios_scratch_regs_save(adev);
-
 	return dce_v11_0_hw_fini(handle);
 }
 
@@ -3145,8 +3141,6 @@ static int dce_v11_0_resume(void *handle)
 
 	ret = dce_v11_0_hw_init(handle);
 
-	amdgpu_atombios_scratch_regs_restore(adev);
-
 	/* turn on the BL */
 	if (adev->mode_info.bl_encoder) {
 		u8 bl_level = amdgpu_display_backlight_get_level(adev,
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +0 -6
index 44547f9..5742333 100644
@@ -2403,10 +2403,6 @@ static int dce_v6_0_hw_fini(void *handle)
 
 static int dce_v6_0_suspend(void *handle)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	amdgpu_atombios_scratch_regs_save(adev);
-
 	return dce_v6_0_hw_fini(handle);
 }
 
@@ -2417,8 +2413,6 @@ static int dce_v6_0_resume(void *handle)
 
 	ret = dce_v6_0_hw_init(handle);
 
-	amdgpu_atombios_scratch_regs_restore(adev);
-
 	/* turn on the BL */
 	if (adev->mode_info.bl_encoder) {
 		u8 bl_level = amdgpu_display_backlight_get_level(adev,
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +0 -6
index 16a2f1f..3a2d695 100644
@@ -2912,10 +2912,6 @@ static int dce_v8_0_hw_fini(void *handle)
 
 static int dce_v8_0_suspend(void *handle)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	amdgpu_atombios_scratch_regs_save(adev);
-
 	return dce_v8_0_hw_fini(handle);
 }
 
@@ -2926,8 +2922,6 @@ static int dce_v8_0_resume(void *handle)
 
 	ret = dce_v8_0_hw_init(handle);
 
-	amdgpu_atombios_scratch_regs_restore(adev);
-
 	/* turn on the BL */
 	if (adev->mode_info.bl_encoder) {
 		u8 bl_level = amdgpu_display_backlight_get_level(adev,
Signature · 1 line
2.5.5

_______________________________________________
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): CADnq5_MOypPU09YUtH1xanHCTyd7gODV4UUWerHzaX13iwCq2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#4 lore raw

Hi Alex:

Yes, feel free to add my RB, Reviewed-by: JimQu <[email protected]>

Thanks
JimQu

________________________________________
发件人: Alex Deucher <[email protected]>
发送时间: 2016年10月20日 2:46
收件人: Qu, Jim
抄送: amd-gfx list
主题: Re: [PATCH] drm/amdgpu: atombios stuck executing during S3 stress test

Quoted 7 lines · jimqu

Sometimes, atombios may be stucked when resume back. Duo to PCIE has set to D3cold, the ACC of GFX adapter is power-down. it should re-init the scratch registers. with the change, test is pass more than 80 cycles on Fiji.

Change-Id I9cf40c475c4a5a31216949d50cc5e30b74dc21c4

I think we probably want to save/restore these, although this shouldn't hurt. How about this patch?

Alex

Quoted 19 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index e82c487..bfe9a5c 100644
@@ -2098,6 +2098,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
                                console_unlock();
                        return r;
                }
+               amdgpu_atombios_scratch_regs_init(adev);
        }
 
        /* post card */
--

1.9.1

Quoted 4 lines

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

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