Skip to contentSkip to conversation

drm/amdgpu: fix ring0 failed on firepro card

PATCH In review Chunming Zhou 4 participants 7 messages May 5, 2017 4 messages not in the archive

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

PATCH 1/2 drm/amdgpu: fix ring0 failed on firepro card

the root cause is vram content is lost completely after pci reset.

Change-Id I012cea984702894410b0f05149fd017bb62b624c
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 57 ++++++++++++++++++++++++++----
 1 file changed, 50 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +50 -7
index 8a75327..b44ecdb 100644
@@ -1787,13 +1787,40 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
 	return 0;
 }
 
-static int amdgpu_resume(struct amdgpu_device *adev)
+static int amdgpu_resume_phase1(struct amdgpu_device *adev)
 {
 	int i, r;
 
 	for (i = 0; i < adev->num_ip_blocks; i++) {
 		if (!adev->ip_blocks[i].status.valid)
 			continue;
+		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
+				adev->ip_blocks[i].version->type ==
+				AMD_IP_BLOCK_TYPE_IH) {
+			r = adev->ip_blocks[i].version->funcs->resume(adev);
+			if (r) {
+				DRM_ERROR("resume of IP block <%s> failed %d\n",
+					  adev->ip_blocks[i].version->funcs->name, r);
+				return r;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int amdgpu_resume_phase2(struct amdgpu_device *adev)
+{
+	int i, r;
+
+	for (i = 0; i < adev->num_ip_blocks; i++) {
+		if (!adev->ip_blocks[i].status.valid)
+			continue;
+		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH )
+			continue;
 		r = adev->ip_blocks[i].version->funcs->resume(adev);
 		if (r) {
 			DRM_ERROR("resume of IP block <%s> failed %d\n",
@@ -1805,6 +1832,18 @@ static int amdgpu_resume(struct amdgpu_device *adev)
 	return 0;
 }
 
+static int amdgpu_resume(struct amdgpu_device *adev)
+{
+	int r;
+
+	r = amdgpu_resume_phase1(adev);
+	if (r)
+		return r;
+	r = amdgpu_resume_phase2(adev);
+
+	return r;
+}
+
 static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev)
 {
 	if (adev->is_atom_fw) {
@@ -2730,16 +2769,20 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 
 		if (!r) {
 			dev_info(adev->dev, "GPU reset succeeded, trying to resume\n");
-			r = amdgpu_resume(adev);
+			r = amdgpu_resume_phase1(adev);
+			if (r)
+				goto out;
+			r = amdgpu_ttm_recover_gart(adev);
+			if (r)
+				goto out;
+			r = amdgpu_resume_phase2(adev);
+			if (r)
+				goto out;
 		}
 	}
+out:
 	if (!r) {
 		amdgpu_irq_gpu_reset_resume_helper(adev);
-		if (need_full_reset && amdgpu_need_backup(adev)) {
-			r = amdgpu_ttm_recover_gart(adev);
-			if (r)
-				DRM_ERROR("gart recovery failed!!!\n");
-		}
 		r = amdgpu_ib_ring_tests(adev);
 		if (r) {
 			dev_err(adev->dev, "ib ring test failed (%d).\n", r);
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): 1493966737-14621-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu: print when gpu reset successed

Change-Id I98d96b566b1fd21d90a0bb037f5b8ba8f1857c98
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -2
index b44ecdb..e254364 100644
@@ -2847,10 +2847,11 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 		drm_helper_resume_force_mode(adev->ddev);
 
 	ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, resched);
-	if (r) {
+	if (r)
 		/* bad news, how to tell it to userspace ? */
 		dev_info(adev->dev, "GPU reset failed\n");
-	}
+	else
+		dev_info(adev->dev, "GPU reset successed!\n");
 
 	return r;
 }
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): 1493966737-14621-2-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org

Reviewed-by Roger.He
#4 lore raw

RE: [PATCH 2/2] drm/amdgpu: print when gpu reset successed

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Chunming Zhou
Sent: Friday, May 05, 2017 2:46 PM
To: [email protected]
Cc: Zhou, David(ChunMing)
Subject: [PATCH 2/2] drm/amdgpu: print when gpu reset successed

Change-Id I98d96b566b1fd21d90a0bb037f5b8ba8f1857c98
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -2
index b44ecdb..e254364 100644
@@ -2847,10 +2847,11 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 		drm_helper_resume_force_mode(adev->ddev);
 
 	ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, resched);
-	if (r) {
+	if (r)
 		/* bad news, how to tell it to userspace ? */
 		dev_info(adev->dev, "GPU reset failed\n");
-	}
+	else
+		dev_info(adev->dev, "GPU reset successed!\n");
 
 	return r;
 }
Signature · 10 lines
1.9.1

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): MWHPR1201MB01273631383B29DA4DA2783CFDEB0-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

Reviewed-by
#6 lore raw

Re: [PATCH 2/2] drm/amdgpu: print when gpu reset successed

Am 05.05.2017 um 09:47 schrieb He, Hongbo:

Quoted 23 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Chunming Zhou
Sent: Friday, May 05, 2017 2:46 PM
To: [email protected]
Cc: Zhou, David(ChunMing)
Subject: [PATCH 2/2] drm/amdgpu: print when gpu reset successed

Change-Id I98d96b566b1fd21d90a0bb037f5b8ba8f1857c98
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index b44ecdb..e254364 100644
@@ -2847,10 +2847,11 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
  		drm_helper_resume_force_mode(adev->ddev);
 
  	ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, resched);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_gpu_reset(struct amdgpu_device *adev) · line 2857

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -2
-	if (r) {
+	if (r)
  		/* bad news, how to tell it to userspace ? */
  		dev_info(adev->dev, "GPU reset failed\n");
-	}
+	else
+		dev_info(adev->dev, "GPU reset successed!\n");
 
  	return r;
  }

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

#7 lore raw
In reply to a message not in the archive

Looks fine to me, Reviewed-by: Roger.He <[email protected]>

BTW, I have noticed SRIOV has more IP resume in first phase, maybe also needed for bare metal for other ASIC.

Thanks
Roger(Hongbo.He)
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Chunming Zhou
Sent: Friday, May 05, 2017 2:46 PM
To: [email protected]
Cc: Zhou, David(ChunMing)
Subject: [PATCH 1/2] drm/amdgpu: fix ring0 failed on firepro card

the root cause is vram content is lost completely after pci reset.

Change-Id I012cea984702894410b0f05149fd017bb62b624c
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 57 ++++++++++++++++++++++++++----
 1 file changed, 50 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +27 -1
index 8a75327..b44ecdb 100644
@@ -1787,13 +1787,40 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
 	return 0;
 }
 
-static int amdgpu_resume(struct amdgpu_device *adev)
+static int amdgpu_resume_phase1(struct amdgpu_device *adev)
 {
 	int i, r;
 
 	for (i = 0; i < adev->num_ip_blocks; i++) {
 		if (!adev->ip_blocks[i].status.valid)
 			continue;
+		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
+				adev->ip_blocks[i].version->type ==
+				AMD_IP_BLOCK_TYPE_IH) {
+			r = adev->ip_blocks[i].version->funcs->resume(adev);
+			if (r) {
+				DRM_ERROR("resume of IP block <%s> failed %d\n",
+					  adev->ip_blocks[i].version->funcs->name, r);
+				return r;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int amdgpu_resume_phase2(struct amdgpu_device *adev) {
+	int i, r;
+
+	for (i = 0; i < adev->num_ip_blocks; i++) {
+		if (!adev->ip_blocks[i].status.valid)
+			continue;
+		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH )
+			continue;
 		r = adev->ip_blocks[i].version->funcs->resume(adev);
 		if (r) {
 			DRM_ERROR("resume of IP block <%s> failed %d\n", @@ -1805,6 +1832,18 @@ static int amdgpu_resume(struct amdgpu_device *adev)

return 0;
}

+static int amdgpu_resume(struct amdgpu_device *adev) {
+ int r;
+
+ r = amdgpu_resume_phase1(adev);
+ if (r)
+ return r;
+ r = amdgpu_resume_phase2(adev);
+
+ return r;
+}
+
static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev) {
if (adev->is_atom_fw) {
@@ -2730,16 +2769,20 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)

if (!r) {
dev_info(adev->dev, "GPU reset succeeded, trying to resume\n");
- r = amdgpu_resume(adev);
+ r = amdgpu_resume_phase1(adev);
+ if (r)
+ goto out;
+ r = amdgpu_ttm_recover_gart(adev);
+ if (r)
+ goto out;
+ r = amdgpu_resume_phase2(adev);
+ if (r)
+ goto out;
}
}
+out:
if (!r) {
amdgpu_irq_gpu_reset_resume_helper(adev);
- if (need_full_reset && amdgpu_need_backup(adev)) {
- r = amdgpu_ttm_recover_gart(adev);
- if (r)
- DRM_ERROR("gart recovery failed!!!\n");
- }
r = amdgpu_ib_ring_tests(adev);
if (r) {
dev_err(adev->dev, "ib ring test failed (%d).\n", r);
--
1.9.1

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): MWHPR1201MB0127C917F4B4A02CF4B4318BFDEB0-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#9 lore raw

We should really improve the order in which blocks are handled.

Having all this special order handling in amdgpu_device.c and for SRIOV is really not a good idea.

Anyway, patch is Acked-by: Christian König <[email protected]> for now.

Regards,
Christian.

Am 05.05.2017 um 09:46 schrieb He, Hongbo:

Quoted 112 lines

Looks fine to me, Reviewed-by: Roger.He <[email protected]>

BTW, I have noticed SRIOV has more IP resume in first phase, maybe also needed for bare metal for other ASIC.

Thanks
Roger(Hongbo.He)
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Chunming Zhou
Sent: Friday, May 05, 2017 2:46 PM
To: [email protected]
Cc: Zhou, David(ChunMing)
Subject: [PATCH 1/2] drm/amdgpu: fix ring0 failed on firepro card

the root cause is vram content is lost completely after pci reset.

Change-Id I012cea984702894410b0f05149fd017bb62b624c
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 57 ++++++++++++++++++++++++++----
  1 file changed, 50 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +48 -8
index 8a75327..b44ecdb 100644
@@ -1787,13 +1787,40 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
  	return 0;
  }
 
-static int amdgpu_resume(struct amdgpu_device *adev)
+static int amdgpu_resume_phase1(struct amdgpu_device *adev)
  {
  	int i, r;
 
  	for (i = 0; i < adev->num_ip_blocks; i++) {
  		if (!adev->ip_blocks[i].status.valid)
  			continue;
+		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
+				adev->ip_blocks[i].version->type ==
+				AMD_IP_BLOCK_TYPE_IH) {
+			r = adev->ip_blocks[i].version->funcs->resume(adev);
+			if (r) {
+				DRM_ERROR("resume of IP block <%s> failed %d\n",
+					  adev->ip_blocks[i].version->funcs->name, r);
+				return r;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int amdgpu_resume_phase2(struct amdgpu_device *adev) {
+	int i, r;
+
+	for (i = 0; i < adev->num_ip_blocks; i++) {
+		if (!adev->ip_blocks[i].status.valid)
+			continue;
+		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
+				adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH )
+			continue;
  		r = adev->ip_blocks[i].version->funcs->resume(adev);
  		if (r) {
  			DRM_ERROR("resume of IP block <%s> failed %d\n", @@ -1805,6 +1832,18 @@ static int amdgpu_resume(struct amdgpu_device *adev)
  	return 0;
  }
 
+static int amdgpu_resume(struct amdgpu_device *adev) {
+	int r;
+
+	r = amdgpu_resume_phase1(adev);
+	if (r)
+		return r;
+	r = amdgpu_resume_phase2(adev);
+
+	return r;
+}
+
  static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev)  {
  	if (adev->is_atom_fw) {
@@ -2730,16 +2769,20 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 
  		if (!r) {
  			dev_info(adev->dev, "GPU reset succeeded, trying to resume\n");
-			r = amdgpu_resume(adev);
+			r = amdgpu_resume_phase1(adev);
+			if (r)
+				goto out;
+			r = amdgpu_ttm_recover_gart(adev);
+			if (r)
+				goto out;
+			r = amdgpu_resume_phase2(adev);
+			if (r)
+				goto out;
  		}
  	}
+out:
  	if (!r) {
  		amdgpu_irq_gpu_reset_resume_helper(adev);
-		if (need_full_reset && amdgpu_need_backup(adev)) {
-			r = amdgpu_ttm_recover_gart(adev);
-			if (r)
-				DRM_ERROR("gart recovery failed!!!\n");
-		}
  		r = amdgpu_ib_ring_tests(adev);
  		if (r) {
  			dev_err(adev->dev, "ib ring test failed (%d).\n", r);
--

1.9.1

Quoted 8 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

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

Acked-by
#10 lore raw
In reply to a message not in the archive
Quoted 4 lines · Chunming Zhou

the root cause is vram content is lost completely after pci reset.

Change-Id I012cea984702894410b0f05149fd017bb62b624c

Let's see if it makes sense to change the order globally so we can avoid things like this and unify the sr-iov code as well. series is:

Quoted 99 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 57 ++++++++++++++++++++++++++----
 1 file changed, 50 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +50 -8
index 8a75327..b44ecdb 100644
@@ -1787,13 +1787,40 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
        return 0;
 }
 
-static int amdgpu_resume(struct amdgpu_device *adev)
+static int amdgpu_resume_phase1(struct amdgpu_device *adev)
 {
        int i, r;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (!adev->ip_blocks[i].status.valid)
                        continue;
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
+                               adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
+                               adev->ip_blocks[i].version->type ==
+                               AMD_IP_BLOCK_TYPE_IH) {
+                       r = adev->ip_blocks[i].version->funcs->resume(adev);
+                       if (r) {
+                               DRM_ERROR("resume of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                               return r;
+                       }
+               }
+       }
+
+       return 0;
+}
+
+static int amdgpu_resume_phase2(struct amdgpu_device *adev)
+{
+       int i, r;
+
+       for (i = 0; i < adev->num_ip_blocks; i++) {
+               if (!adev->ip_blocks[i].status.valid)
+                       continue;
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
+                               adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
+                               adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH )
+                       continue;
                r = adev->ip_blocks[i].version->funcs->resume(adev);
                if (r) {
                        DRM_ERROR("resume of IP block <%s> failed %d\n",
@@ -1805,6 +1832,18 @@ static int amdgpu_resume(struct amdgpu_device *adev)
        return 0;
 }
 
+static int amdgpu_resume(struct amdgpu_device *adev)
+{
+       int r;
+
+       r = amdgpu_resume_phase1(adev);
+       if (r)
+               return r;
+       r = amdgpu_resume_phase2(adev);
+
+       return r;
+}
+
 static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev)
 {
        if (adev->is_atom_fw) {
@@ -2730,16 +2769,20 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 
                if (!r) {
                        dev_info(adev->dev, "GPU reset succeeded, trying to resume\n");
-                       r = amdgpu_resume(adev);
+                       r = amdgpu_resume_phase1(adev);
+                       if (r)
+                               goto out;
+                       r = amdgpu_ttm_recover_gart(adev);
+                       if (r)
+                               goto out;
+                       r = amdgpu_resume_phase2(adev);
+                       if (r)
+                               goto out;
                }
        }
+out:
        if (!r) {
                amdgpu_irq_gpu_reset_resume_helper(adev);
-               if (need_full_reset && amdgpu_need_backup(adev)) {
-                       r = amdgpu_ttm_recover_gart(adev);
-                       if (r)
-                               DRM_ERROR("gart recovery failed!!!\n");
-               }
                r = amdgpu_ib_ring_tests(adev);
                if (r) {
                        dev_err(adev->dev, "ib ring test failed (%d).\n", r);
--

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