Skip to contentSkip to conversation

drm/amdgpu:fix cannot receive rcv/ack irq bug

PATCH In review Monk Liu 4 participants 22 messages May 3, 2017 10 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/6 drm/amdgpu:fix cannot receive rcv/ack irq bug

Change-Id Ie8672e0c9358d9542810ce05c822d9367249bbd7
---
 drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +2 -2
index 1493301..712f36e 100644
@@ -296,11 +296,11 @@ int xgpu_ai_mailbox_add_irq_id(struct amdgpu_device *adev)
 {
 	int r;
 
-	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 135, &adev->virt.rcv_irq);
+	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_BIF, 135, &adev->virt.rcv_irq);
 	if (r)
 		return r;
 
-	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 138, &adev->virt.ack_irq);
+	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_BIF, 138, &adev->virt.ack_irq);
 	if (r) {
 		amdgpu_irq_put(adev, &adev->virt.rcv_irq, 0);
 		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): 1493783292-2661-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/6 drm/amdgpu:need som change on vega10 mailbox

if sriov gpu reset is invoked by job timeout, it is run in a global work-queue which is very slow and better not call msleep ortherwise it takes long time to get back CPU.

so make below changes:

1: Change msleep 1 to mdelay 5
2: Ignore the ack fail from pf after time out,
because VF FLR will clear ack, sometime VF FLR is done prior to the beginning of poll_ack so we can ignore this ack

TODO:
Put job_timedout (and the following gpu reset) in a driver thread, instead of the global work_struct.

Change-Id I4608c67b55c67c88597e03eee35a126d7e850839
---
 drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 18 ++++++++++--------
 drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 10 +++++-----
 2 files changed, 15 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +10 -8
index 712f36e..e967a7b 100644
@@ -124,8 +124,8 @@ static int xgpu_ai_poll_ack(struct amdgpu_device *adev)
 			r = -ETIME;
 			break;
 		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
 		reg = RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0,
 						     mmBIF_BX_PF0_MAILBOX_CONTROL));
@@ -141,12 +141,12 @@ static int xgpu_ai_poll_msg(struct amdgpu_device *adev, enum idh_event event)
 	r = xgpu_ai_mailbox_rcv_msg(adev, event);
 	while (r) {
 		if (timeout <= 0) {
-			pr_err("Doesn't get ack from pf.\n");
+			pr_err("Doesn't get msg:%d from pf.\n", event);
 			r = -ETIME;
 			break;
 		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
 		r = xgpu_ai_mailbox_rcv_msg(adev, event);
 	}
@@ -165,7 +165,7 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev,
 	/* start to poll ack */
 	r = xgpu_ai_poll_ack(adev);
 	if (r)
-		return r;
+		pr_err("Doesn't get ack from pf, continue\n");
 
 	xgpu_ai_mailbox_set_valid(adev, false);
 
@@ -174,8 +174,10 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev,
 		req == IDH_REQ_GPU_FINI_ACCESS ||
 		req == IDH_REQ_GPU_RESET_ACCESS) {
 		r = xgpu_ai_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
-		if (r)
+		if (r) {
+			pr_err("Doesn't get READY_TO_ACCESS_GPU from pf, give up\n");
 			return r;
+		}
 	}
 
 	return 0;
@@ -211,7 +213,7 @@ static int xgpu_ai_mailbox_ack_irq(struct amdgpu_device *adev,
 					struct amdgpu_irq_src *source,
 					struct amdgpu_iv_entry *entry)
 {
-	DRM_DEBUG("get ack intr and do nothing.\n");
+	printk("get ack intr and do nothing.\n");
 	return 0;
 }
 
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +5 -5
index 7bdc51b..f0d64f1 100644
@@ -398,8 +398,8 @@ static int xgpu_vi_poll_ack(struct amdgpu_device *adev)
 			r = -ETIME;
 			break;
 		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
 		reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
 	}
@@ -418,8 +418,8 @@ static int xgpu_vi_poll_msg(struct amdgpu_device *adev, enum idh_event event)
 			r = -ETIME;
 			break;
 		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
 		r = xgpu_vi_mailbox_rcv_msg(adev, event);
 	}
@@ -447,7 +447,7 @@ static int xgpu_vi_send_access_requests(struct amdgpu_device *adev,
 		request == IDH_REQ_GPU_RESET_ACCESS) {
 		r = xgpu_vi_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
 		if (r)
-			return r;
+			pr_err("Doesn't get ack from pf, continue\n");
 	}
 
 	return 0;
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): 1493783292-2661-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Xiangliang Yu
#4 lore raw

RE: [PATCH 2/6] drm/amdgpu:need som change on vega10 mailbox

Thanks!
Xiangliang Yu

Quoted 140 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Wednesday, May 03, 2017 11:48 AM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 2/6] drm/amdgpu:need som change on vega10 mailbox

if sriov gpu reset is invoked by job timeout, it is run in a global work-queue which is very slow and better not call msleep ortherwise it takes long time to get back CPU.

so make below changes:

1: Change msleep 1 to mdelay 5
2: Ignore the ack fail from pf after time out,
because VF FLR will clear ack, sometime VF FLR is done prior to the beginning of poll_ack so we can ignore this ack

TODO:
Put job_timedout (and the following gpu reset) in a driver thread, instead of the global work_struct.

Change-Id I4608c67b55c67c88597e03eee35a126d7e850839
---
 drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 18 ++++++++++--------
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 10 +++++-----
 2 files changed, 15 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +2 -2
index 712f36e..e967a7b 100644
@@ -124,8 +124,8 @@ static int xgpu_ai_poll_ack(struct amdgpu_device
 *adev)
 			r = -ETIME;
 			break;
 		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
 		reg = RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0,

mmBIF_BX_PF0_MAILBOX_CONTROL)); @@ -141,12 +141,12 @@ static int xgpu_ai_poll_msg(struct amdgpu_device *adev, enum idh_event event)

drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +7 -5
 	r = xgpu_ai_mailbox_rcv_msg(adev, event);
 	while (r) {
 		if (timeout <= 0) {
-			pr_err("Doesn't get ack from pf.\n");
+			pr_err("Doesn't get msg:%d from pf.\n", event);
 			r = -ETIME;
 			break;
 		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
 		r = xgpu_ai_mailbox_rcv_msg(adev, event);
 	}
@@ -165,7 +165,7 @@ static int xgpu_ai_send_access_requests(struct
 amdgpu_device *adev,
 	/* start to poll ack */
 	r = xgpu_ai_poll_ack(adev);
 	if (r)
-		return r;
+		pr_err("Doesn't get ack from pf, continue\n");
 
 	xgpu_ai_mailbox_set_valid(adev, false);
@@ -174,8 +174,10 @@ static int xgpu_ai_send_access_requests(struct
 amdgpu_device *adev,
 		req == IDH_REQ_GPU_FINI_ACCESS ||
 		req == IDH_REQ_GPU_RESET_ACCESS) {
 		r = xgpu_ai_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
-		if (r)
+		if (r) {
+			pr_err("Doesn't get READY_TO_ACCESS_GPU from
 pf, give up\n");
 			return r;
+		}
 	}
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -1
 	return 0;
@@ -211,7 +213,7 @@ static int xgpu_ai_mailbox_ack_irq(struct
 amdgpu_device *adev,
 					struct amdgpu_irq_src *source,
 					struct amdgpu_iv_entry *entry)
 {
-	DRM_DEBUG("get ack intr and do nothing.\n");
+	printk("get ack intr and do nothing.\n");
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +2 -2
index 7bdc51b..f0d64f1 100644
@@ -398,8 +398,8 @@ static int xgpu_vi_poll_ack(struct amdgpu_device
 *adev)
 			r = -ETIME;
 			break;
 		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
 		reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +2 -2
 	}
@@ -418,8 +418,8 @@ static int xgpu_vi_poll_msg(struct amdgpu_device
 *adev, enum idh_event event)
 			r = -ETIME;
 			break;
 		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
 		r = xgpu_vi_mailbox_rcv_msg(adev, event);
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +1 -1
 	}
@@ -447,7 +447,7 @@ static int xgpu_vi_send_access_requests(struct
 amdgpu_device *adev,
 		request == IDH_REQ_GPU_RESET_ACCESS) {
 		r = xgpu_vi_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
 		if (r)
-			return r;
+			pr_err("Doesn't get ack from pf, continue\n");
 	}
 

return 0;
--
2.7.4

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

#5 lore raw

Re: [PATCH 2/6] drm/amdgpu:need som change on vega10 mailbox

In reply to a message not in the archive

Am 03.05.2017 um 05:48 schrieb Monk Liu:

Quoted 75 lines

if sriov gpu reset is invoked by job timeout, it is run in a global work-queue which is very slow and better not call msleep ortherwise it takes long time to get back CPU.

so make below changes:

1: Change msleep 1 to mdelay 5
2: Ignore the ack fail from pf after time out,
because VF FLR will clear ack, sometime VF FLR is done prior to the beginning of poll_ack so we can ignore this ack

TODO:
Put job_timedout (and the following gpu reset) in a driver thread, instead of the global work_struct.

Change-Id I4608c67b55c67c88597e03eee35a126d7e850839
---
  drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 18 ++++++++++--------
  drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 10 +++++-----
  2 files changed, 15 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +9 -7
index 712f36e..e967a7b 100644
@@ -124,8 +124,8 @@ static int xgpu_ai_poll_ack(struct amdgpu_device *adev)
  			r = -ETIME;
  			break;
  		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
  		reg = RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0,
  						     mmBIF_BX_PF0_MAILBOX_CONTROL));
@@ -141,12 +141,12 @@ static int xgpu_ai_poll_msg(struct amdgpu_device *adev, enum idh_event event)
  	r = xgpu_ai_mailbox_rcv_msg(adev, event);
  	while (r) {
  		if (timeout <= 0) {
-			pr_err("Doesn't get ack from pf.\n");
+			pr_err("Doesn't get msg:%d from pf.\n", event);
  			r = -ETIME;
  			break;
  		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
  		r = xgpu_ai_mailbox_rcv_msg(adev, event);
  	}
@@ -165,7 +165,7 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev,
  	/* start to poll ack */
  	r = xgpu_ai_poll_ack(adev);
  	if (r)
-		return r;
+		pr_err("Doesn't get ack from pf, continue\n");
 
  	xgpu_ai_mailbox_set_valid(adev, false);
 
@@ -174,8 +174,10 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev,
  		req == IDH_REQ_GPU_FINI_ACCESS ||
  		req == IDH_REQ_GPU_RESET_ACCESS) {
  		r = xgpu_ai_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
-		if (r)
+		if (r) {
+			pr_err("Doesn't get READY_TO_ACCESS_GPU from pf, give up\n");
  			return r;
+		}
  	}
 
  	return 0;

drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c static int xgpu_ai_mailbox_ack_irq(struct amdgpu_device *adev, · line 216

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -1
@@ -211,7 +213,7 @@ static int xgpu_ai_mailbox_ack_irq(struct amdgpu_device *adev,
  					struct amdgpu_irq_src *source,
  					struct amdgpu_iv_entry *entry)
  {
-	DRM_DEBUG("get ack intr and do nothing.\n");
+	printk("get ack intr and do nothing.\n");

Changing a DRM_DEBUG to a printk looks odd. How about using pr_warn or pr_info instead?

Apart from that patch looks good to me, but I don't deeply into that stuff.

So with the printk fixed feel free to add an Acked-by: Christian König <[email protected]> to it.

Regards,
Christian.

Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +0 -0
  	return 0;
  }
 
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +4 -4
index 7bdc51b..f0d64f1 100644
@@ -398,8 +398,8 @@ static int xgpu_vi_poll_ack(struct amdgpu_device *adev)
  			r = -ETIME;
  			break;
  		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
  		reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
  	}
@@ -418,8 +418,8 @@ static int xgpu_vi_poll_msg(struct amdgpu_device *adev, enum idh_event event)
  			r = -ETIME;
  			break;
  		}
-		msleep(1);
-		timeout -= 1;
+		mdelay(5);
+		timeout -= 5;
 
  		r = xgpu_vi_mailbox_rcv_msg(adev, event);
  	}

drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c static int xgpu_vi_send_access_requests(struct amdgpu_device *adev, · line 453

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +1 -1
@@ -447,7 +447,7 @@ static int xgpu_vi_send_access_requests(struct amdgpu_device *adev,
  		request == IDH_REQ_GPU_RESET_ACCESS) {
  		r = xgpu_vi_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
  		if (r)
-			return r;
+			pr_err("Doesn't get ack from pf, continue\n");
  	}
 
  	return 0;

_______________________________________________
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): 09b3c7b4-19f9-2ca2-301e-324b71af1479-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Acked-by
#7 lore raw

Re: [PATCH 2/6] drm/amdgpu:need som change on vega10 mailbox

Quoted 90 lines · Christian König

Am 03.05.2017 um 05:48 schrieb Monk Liu:

Quoted 78 lines

if sriov gpu reset is invoked by job timeout, it is run in a global work-queue which is very slow and better not call msleep ortherwise it takes long time to get back CPU.

so make below changes:

1: Change msleep 1 to mdelay 5
2: Ignore the ack fail from pf after time out,
because VF FLR will clear ack, sometime VF FLR is done prior to the beginning of poll_ack so we can ignore this ack

TODO:
Put job_timedout (and the following gpu reset) in a driver thread, instead of the global work_struct.

Change-Id I4608c67b55c67c88597e03eee35a126d7e850839
---
  drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 18 ++++++++++--------
  drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 10 +++++-----
  2 files changed, 15 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +2 -2
index 712f36e..e967a7b 100644
@@ -124,8 +124,8 @@ static int xgpu_ai_poll_ack(struct amdgpu_device
 *adev)
                        r = -ETIME;
                        break;
                }
-               msleep(1);
-               timeout -= 1;
+               mdelay(5);
+               timeout -= 5;
                reg = RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0,
 

mmBIF_BX_PF0_MAILBOX_CONTROL));

drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +4 -4
@@ -141,12 +141,12 @@ static int xgpu_ai_poll_msg(struct amdgpu_device
 *adev, enum idh_event event)
        r = xgpu_ai_mailbox_rcv_msg(adev, event);
        while (r) {
                if (timeout <= 0) {
-                       pr_err("Doesn't get ack from pf.\n");
+                       pr_err("Doesn't get msg:%d from pf.\n", event);
                        r = -ETIME;
                        break;
                }
-               msleep(1);
-               timeout -= 1;
+               mdelay(5);
+               timeout -= 5;
                r = xgpu_ai_mailbox_rcv_msg(adev, event);
        }
@@ -165,7 +165,7 @@ static int xgpu_ai_send_access_requests(struct
 amdgpu_device *adev,
        /* start to poll ack */
        r = xgpu_ai_poll_ack(adev);
        if (r)
-               return r;
+               pr_err("Doesn't get ack from pf, continue\n");
        xgpu_ai_mailbox_set_valid(adev, false);
  @@ -174,8 +174,10 @@ static int xgpu_ai_send_access_requests(struct

amdgpu_device *adev,

                req == IDH_REQ_GPU_FINI_ACCESS ||
                req == IDH_REQ_GPU_RESET_ACCESS) {
                r = xgpu_ai_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +2 -1
-               if (r)
+               if (r) {
+                       pr_err("Doesn't get READY_TO_ACCESS_GPU from pf,
give up\n");
                        return r;
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -0
+               }
        }
        return 0;

drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c static int xgpu_ai_mailbox_ack_irq(struct · line 217

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -1
@@ -211,7 +213,7 @@ static int xgpu_ai_mailbox_ack_irq(struct
 amdgpu_device *adev,
                                        struct amdgpu_irq_src *source,
                                        struct amdgpu_iv_entry *entry)
  {
-       DRM_DEBUG("get ack intr and do nothing.\n");
+       printk("get ack intr and do nothing.\n");

Changing a DRM_DEBUG to a printk looks odd. How about using pr_warn or pr_info instead?

Quoted 4 lines

Apart from that patch looks good to me, but I don't deeply into that stuff.

So with the printk fixed feel free to add an Acked-by: Christian König <[email protected]> to it.

Same here. with that fixed:

Quoted 42 lines

Regards,
Christian.

Quoted 37 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +0 -0
        return 0;
  }

diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
b/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c index 7bdc51b..f0d64f1 100644

drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +5 -5
@@ -398,8 +398,8 @@ static int xgpu_vi_poll_ack(struct amdgpu_device
 *adev)
                        r = -ETIME;
                        break;
                }
-               msleep(1);
-               timeout -= 1;
+               mdelay(5);
+               timeout -= 5;
                reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
        }
@@ -418,8 +418,8 @@ static int xgpu_vi_poll_msg(struct amdgpu_device
 *adev, enum idh_event event)
                        r = -ETIME;
                        break;
                }
-               msleep(1);
-               timeout -= 1;
+               mdelay(5);
+               timeout -= 5;
                r = xgpu_vi_mailbox_rcv_msg(adev, event);
        }
@@ -447,7 +447,7 @@ static int xgpu_vi_send_access_requests(struct
 amdgpu_device *adev,
                request == IDH_REQ_GPU_RESET_ACCESS) {
                r = xgpu_vi_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
                if (r)
-                       return r;
+                       pr_err("Doesn't get ack from pf, continue\n");
        }
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c static int xgpu_vi_send_access_requests(struct · line 453

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +0 -0
        return 0;

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

author Acked-by Alex Deucher
#9 lore raw

RE: [PATCH 2/6] drm/amdgpu:need som change on vega10 mailbox

OK, will change later by another amend patch, already submitted

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Wednesday, May 3, 2017 11:20 PM
To: Christian König <[email protected]>
Cc: Liu, Monk <[email protected]>; amd-gfx list <[email protected]>
Subject: Re: [PATCH 2/6] drm/amdgpu:need som change on vega10 mailbox

Quoted 92 lines · Christian König

Am 03.05.2017 um 05:48 schrieb Monk Liu:

Quoted 80 lines

if sriov gpu reset is invoked by job timeout, it is run in a global work-queue which is very slow and better not call msleep ortherwise it takes long time to get back CPU.

so make below changes:

1: Change msleep 1 to mdelay 5
2: Ignore the ack fail from pf after time out,
because VF FLR will clear ack, sometime VF FLR is done prior to the beginning of poll_ack so we can ignore this ack

TODO:
Put job_timedout (and the following gpu reset) in a driver thread, instead of the global work_struct.

Change-Id I4608c67b55c67c88597e03eee35a126d7e850839
---
  drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 18 ++++++++++--------
  drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 10 +++++-----
  2 files changed, 15 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +2 -2
index 712f36e..e967a7b 100644
@@ -124,8 +124,8 @@ static int xgpu_ai_poll_ack(struct amdgpu_device
 *adev)
                        r = -ETIME;
                        break;
                }
-               msleep(1);
-               timeout -= 1;
+               mdelay(5);
+               timeout -= 5;
                reg = RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0,
 

mmBIF_BX_PF0_MAILBOX_CONTROL));

drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +5 -4
@@ -141,12 +141,12 @@ static int xgpu_ai_poll_msg(struct 
 amdgpu_device *adev, enum idh_event event)
        r = xgpu_ai_mailbox_rcv_msg(adev, event);
        while (r) {
                if (timeout <= 0) {
-                       pr_err("Doesn't get ack from pf.\n");
+                       pr_err("Doesn't get msg:%d from pf.\n", 
+ event);
                        r = -ETIME;
                        break;
                }
-               msleep(1);
-               timeout -= 1;
+               mdelay(5);
+               timeout -= 5;
                r = xgpu_ai_mailbox_rcv_msg(adev, event);
        }
@@ -165,7 +165,7 @@ static int xgpu_ai_send_access_requests(struct
 amdgpu_device *adev,
        /* start to poll ack */
        r = xgpu_ai_poll_ack(adev);
        if (r)
-               return r;
+               pr_err("Doesn't get ack from pf, continue\n");
        xgpu_ai_mailbox_set_valid(adev, false);
  @@ -174,8 +174,10 @@ static int xgpu_ai_send_access_requests(struct

amdgpu_device *adev,

                req == IDH_REQ_GPU_FINI_ACCESS ||
                req == IDH_REQ_GPU_RESET_ACCESS) {
                r = xgpu_ai_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +3 -1
-               if (r)
+               if (r) {
+                       pr_err("Doesn't get READY_TO_ACCESS_GPU from 
+ pf,
give up\n");
                        return r;
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -0
+               }
        }
        return 0;

drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c static int xgpu_ai_mailbox_ack_irq(struct · line 217

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -1
@@ -211,7 +213,7 @@ static int xgpu_ai_mailbox_ack_irq(struct 
 amdgpu_device *adev,
                                        struct amdgpu_irq_src *source,
                                        struct amdgpu_iv_entry *entry)
  {
-       DRM_DEBUG("get ack intr and do nothing.\n");
+       printk("get ack intr and do nothing.\n");

Changing a DRM_DEBUG to a printk looks odd. How about using pr_warn or pr_info instead?

Quoted 4 lines

Apart from that patch looks good to me, but I don't deeply into that stuff.

So with the printk fixed feel free to add an Acked-by: Christian König <[email protected]> to it.

Same here. with that fixed:

Quoted 43 lines

Regards,
Christian.

Quoted 38 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +0 -0
        return 0;
  }

diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
b/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c index 7bdc51b..f0d64f1 100644

drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +6 -5
@@ -398,8 +398,8 @@ static int xgpu_vi_poll_ack(struct amdgpu_device
 *adev)
                        r = -ETIME;
                        break;
                }
-               msleep(1);
-               timeout -= 1;
+               mdelay(5);
+               timeout -= 5;
                reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
        }
@@ -418,8 +418,8 @@ static int xgpu_vi_poll_msg(struct amdgpu_device 
 *adev, enum idh_event event)
                        r = -ETIME;
                        break;
                }
-               msleep(1);
-               timeout -= 1;
+               mdelay(5);
+               timeout -= 5;
                r = xgpu_vi_mailbox_rcv_msg(adev, event);
        }
@@ -447,7 +447,7 @@ static int xgpu_vi_send_access_requests(struct
 amdgpu_device *adev,
                request == IDH_REQ_GPU_RESET_ACCESS) {
                r = xgpu_vi_poll_msg(adev, IDH_READY_TO_ACCESS_GPU);
                if (r)
-                       return r;
+                       pr_err("Doesn't get ack from pf, 
+ continue\n");
        }
Quoted 8 lines
Quoted 1 line
        return 0;

_______________________________________________
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

author
#10 lore raw

PATCH 3/6 drm/amdgpu:re-write sriov_reinit_early/late

In reply to a message not in the archive

1,this way we make those routines compatible with the sequence
requirment for both Tonga and Vega10
2,ignore PSP hw init when doing TDR, because for SR-IOV device the ucode won't get lost after VF FLR, so no need to invoke PSP doing the ucode reloading again.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 63 ++++++++++++++++++------------
 1 file changed, 39 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +39 -24
index 5161c20..5573792 100644
@@ -1718,19 +1718,27 @@ static int amdgpu_sriov_reinit_early(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->hw_init(adev);
+	static enum amd_ip_block_type ip_order[] = {
+		AMD_IP_BLOCK_TYPE_GMC,
+		AMD_IP_BLOCK_TYPE_COMMON,
+		AMD_IP_BLOCK_TYPE_GFXHUB,
+		AMD_IP_BLOCK_TYPE_MMHUB,
+		AMD_IP_BLOCK_TYPE_IH,
+	};
+
+	for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {
+		int j;
+		struct amdgpu_ip_block *block;
+
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];
+
+			if (block->version->type != ip_order[i] ||
+				!block->status.valid)
+				continue;
 
-		if (r) {
-			DRM_ERROR("resume of IP block <%s> failed %d\n",
-				  adev->ip_blocks[i].version->funcs->name, r);
-			return r;
+			r = block->version->funcs->hw_init(adev);
+			DRM_INFO("RE-INIT: %s %s\n", block->version->funcs->name, r?"failed":"successed");
 		}
 	}
 
@@ -1741,20 +1749,27 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
 {
 	int i, r;
 
-	for (i = 0; i < adev->num_ip_blocks; i++) {
-		if (!adev->ip_blocks[i].status.valid)
-			continue;
+	static enum amd_ip_block_type ip_order[] = {
+		AMD_IP_BLOCK_TYPE_SMC,
+		AMD_IP_BLOCK_TYPE_DCE,
+		AMD_IP_BLOCK_TYPE_GFX,
+		AMD_IP_BLOCK_TYPE_SDMA,
+		AMD_IP_BLOCK_TYPE_VCE,
+	};
 
-		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;
+	for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {
+		int j;
+		struct amdgpu_ip_block *block;
 
-		r = adev->ip_blocks[i].version->funcs->hw_init(adev);
-		if (r) {
-			DRM_ERROR("resume of IP block <%s> failed %d\n",
-				  adev->ip_blocks[i].version->funcs->name, r);
-			return r;
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];
+
+			if (block->version->type != ip_order[i] ||
+				!block->status.valid)
+				continue;
+
+			r = block->version->funcs->hw_init(adev);
+			DRM_INFO("RE-INIT: %s %s\n", block->version->funcs->name, r?"failed":"successed");
 		}
 	}
 
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): 1493783292-2661-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Xiangliang Yu
#12 lore raw

RE: [PATCH 3/6] drm/amdgpu:re-write sriov_reinit_early/late

Thanks!
Xiangliang Yu

Quoted 120 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Wednesday, May 03, 2017 11:48 AM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 3/6] drm/amdgpu:re-write sriov_reinit_early/late

1,this way we make those routines compatible with the sequence
requirment for both Tonga and Vega10
2,ignore PSP hw init when doing TDR, because for SR-IOV device the ucode won't get lost after VF FLR, so no need to invoke PSP doing the ucode reloading again.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 63
++++++++++++++++++------------
 1 file changed, 39 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -5
index 5161c20..5573792 100644
@@ -1718,19 +1718,27 @@ static int amdgpu_sriov_reinit_early(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 ||

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-				adev->ip_blocks[i].version->type ==

AMD_IP_BLOCK_TYPE_GMC ||

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-				adev->ip_blocks[i].version->type ==

AMD_IP_BLOCK_TYPE_IH)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +18 -4
-			r = adev->ip_blocks[i].version->funcs->hw_init(adev);
+	static enum amd_ip_block_type ip_order[] = {
+		AMD_IP_BLOCK_TYPE_GMC,
+		AMD_IP_BLOCK_TYPE_COMMON,
+		AMD_IP_BLOCK_TYPE_GFXHUB,
+		AMD_IP_BLOCK_TYPE_MMHUB,
+		AMD_IP_BLOCK_TYPE_IH,
+	};
+
+	for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {
+		int j;
+		struct amdgpu_ip_block *block;
+
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];
+
+			if (block->version->type != ip_order[i] ||
+				!block->status.valid)
+				continue;
 
-		if (r) {
-			DRM_ERROR("resume of IP block <%s> failed %d\n",
-				  adev->ip_blocks[i].version->funcs->name,

r);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
-			return r;
+			r = block->version->funcs->hw_init(adev);
+			DRM_INFO("RE-INIT: %s %s\n", block->version-
Quoted 1 line

funcs->name,

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -4
+r?"failed":"successed");
 		}
 	}
@@ -1741,20 +1749,27 @@ static int amdgpu_sriov_reinit_late(struct
 amdgpu_device *adev)  {
 	int i, r;
 
-	for (i = 0; i < adev->num_ip_blocks; i++) {
-		if (!adev->ip_blocks[i].status.valid)
-			continue;
+	static enum amd_ip_block_type ip_order[] = {
+		AMD_IP_BLOCK_TYPE_SMC,
+		AMD_IP_BLOCK_TYPE_DCE,
+		AMD_IP_BLOCK_TYPE_GFX,
+		AMD_IP_BLOCK_TYPE_SDMA,
+		AMD_IP_BLOCK_TYPE_VCE,
+	};
 
-		if (adev->ip_blocks[i].version->type ==

AMD_IP_BLOCK_TYPE_COMMON ||

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-				adev->ip_blocks[i].version->type ==

AMD_IP_BLOCK_TYPE_GMC ||

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-				adev->ip_blocks[i].version->type ==

AMD_IP_BLOCK_TYPE_IH )

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -5
-			continue;
+	for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {
+		int j;
+		struct amdgpu_ip_block *block;
 
-		r = adev->ip_blocks[i].version->funcs->hw_init(adev);
-		if (r) {
-			DRM_ERROR("resume of IP block <%s> failed %d\n",
-				  adev->ip_blocks[i].version->funcs->name,

r);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -1
-			return r;
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];
+
+			if (block->version->type != ip_order[i] ||
+				!block->status.valid)
+				continue;
+
+			r = block->version->funcs->hw_init(adev);
+			DRM_INFO("RE-INIT: %s %s\n", block->version-
Quoted 1 line

funcs->name,

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
+r?"failed":"successed");
 		}
 	}
 
--

2.7.4

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

#13 lore raw

Re: [PATCH 3/6] drm/amdgpu:re-write sriov_reinit_early/late

In reply to a message not in the archive

Am 03.05.2017 um 05:48 schrieb Monk Liu:

Quoted 26 lines

1,this way we make those routines compatible with the sequence
requirment for both Tonga and Vega10
2,ignore PSP hw init when doing TDR, because for SR-IOV device the ucode won't get lost after VF FLR, so no need to invoke PSP doing the ucode reloading again.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 63 ++++++++++++++++++------------
  1 file changed, 39 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -7
index 5161c20..5573792 100644
@@ -1718,19 +1718,27 @@ static int amdgpu_sriov_reinit_early(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)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_early(struct amdgpu_device *adev) · line 1729

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -1
-			r = adev->ip_blocks[i].version->funcs->hw_init(adev);
+	static enum amd_ip_block_type ip_order[] = {
+		AMD_IP_BLOCK_TYPE_GMC,
+		AMD_IP_BLOCK_TYPE_COMMON,
+		AMD_IP_BLOCK_TYPE_GFXHUB,
+		AMD_IP_BLOCK_TYPE_MMHUB,
+		AMD_IP_BLOCK_TYPE_IH,
+	};
+
+	for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {

You should use ARRAY_SIZE here instead.

Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +14 -7
+		int j;
+		struct amdgpu_ip_block *block;
+
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];
+
+			if (block->version->type != ip_order[i] ||
+				!block->status.valid)
+				continue;
 
-		if (r) {
-			DRM_ERROR("resume of IP block <%s> failed %d\n",
-				  adev->ip_blocks[i].version->funcs->name, r);
-			return r;
+			r = block->version->funcs->hw_init(adev);
+			DRM_INFO("RE-INIT: %s %s\n", block->version->funcs->name, r?"failed":"successed");
  		}
  	}
 
@@ -1741,20 +1749,27 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
  {
  	int i, r;
 
-	for (i = 0; i < adev->num_ip_blocks; i++) {
-		if (!adev->ip_blocks[i].status.valid)
-			continue;
+	static enum amd_ip_block_type ip_order[] = {
+		AMD_IP_BLOCK_TYPE_SMC,
+		AMD_IP_BLOCK_TYPE_DCE,

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev) · line 1760

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -4
+		AMD_IP_BLOCK_TYPE_GFX,
+		AMD_IP_BLOCK_TYPE_SDMA,
+		AMD_IP_BLOCK_TYPE_VCE,
+	};
 
-		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;
+	for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {

And here as well.

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -4
+		int j;
+		struct amdgpu_ip_block *block;
 
-		r = adev->ip_blocks[i].version->funcs->hw_init(adev);
-		if (r) {
-			DRM_ERROR("resume of IP block <%s> failed %d\n",
-				  adev->ip_blocks[i].version->funcs->name, r);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev) · line 1772

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -1
-			return r;
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];
+
+			if (block->version->type != ip_order[i] ||
+				!block->status.valid)
+				continue;
+
+			r = block->version->funcs->hw_init(adev);
+			DRM_INFO("RE-INIT: %s %s\n", block->version->funcs->name, r?"failed":"successed");

This changes the order in which blocks are initialized which is probably not correct.

Alex needs to take a look at this, but we clearly need to improve the handling here.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev) · line 1775

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
  		}
  	}
 

_______________________________________________
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): fe18ce3e-dc63-412b-7dbb-aa5265dfad9f-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

author
#15 lore raw

RE: [PATCH 3/6] drm/amdgpu:re-write sriov_reinit_early/late

It's correct and already working on vega10/tonga for days, In fact the guilty context already works at my side

BR Monk

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Wednesday, May 03, 2017 5:02 PM
To: Liu, Monk <[email protected]>; [email protected]
Subject: Re: [PATCH 3/6] drm/amdgpu:re-write sriov_reinit_early/late

Am 03.05.2017 um 05:48 schrieb Monk Liu:

Quoted 26 lines

1,this way we make those routines compatible with the sequence
requirment for both Tonga and Vega10 2,ignore PSP hw init when
doing TDR, because for SR-IOV device the ucode won't get lost after VF FLR, so no need to invoke PSP doing the ucode reloading again.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 63 ++++++++++++++++++------------
  1 file changed, 39 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -7
index 5161c20..5573792 100644
@@ -1718,19 +1718,27 @@ static int amdgpu_sriov_reinit_early(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)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_early(struct amdgpu_device *adev) · line 1729

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -1
-			r = adev->ip_blocks[i].version->funcs->hw_init(adev);
+	static enum amd_ip_block_type ip_order[] = {
+		AMD_IP_BLOCK_TYPE_GMC,
+		AMD_IP_BLOCK_TYPE_COMMON,
+		AMD_IP_BLOCK_TYPE_GFXHUB,
+		AMD_IP_BLOCK_TYPE_MMHUB,
+		AMD_IP_BLOCK_TYPE_IH,
+	};
+
+	for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {

You should use ARRAY_SIZE here instead.

Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +15 -7
+		int j;
+		struct amdgpu_ip_block *block;
+
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];
+
+			if (block->version->type != ip_order[i] ||
+				!block->status.valid)
+				continue;
 
-		if (r) {
-			DRM_ERROR("resume of IP block <%s> failed %d\n",
-				  adev->ip_blocks[i].version->funcs->name, r);
-			return r;
+			r = block->version->funcs->hw_init(adev);
+			DRM_INFO("RE-INIT: %s %s\n", block->version->funcs->name, 
+r?"failed":"successed");
  		}
  	}
@@ -1741,20 +1749,27 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
  {
  	int i, r;
 
-	for (i = 0; i < adev->num_ip_blocks; i++) {
-		if (!adev->ip_blocks[i].status.valid)
-			continue;
+	static enum amd_ip_block_type ip_order[] = {
+		AMD_IP_BLOCK_TYPE_SMC,
+		AMD_IP_BLOCK_TYPE_DCE,

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev) · line 1760

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -4
+		AMD_IP_BLOCK_TYPE_GFX,
+		AMD_IP_BLOCK_TYPE_SDMA,
+		AMD_IP_BLOCK_TYPE_VCE,
+	};
 
-		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;
+	for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {

And here as well.

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -5
+		int j;
+		struct amdgpu_ip_block *block;
 
-		r = adev->ip_blocks[i].version->funcs->hw_init(adev);
-		if (r) {
-			DRM_ERROR("resume of IP block <%s> failed %d\n",
-				  adev->ip_blocks[i].version->funcs->name, r);
-			return r;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10 -0
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];
+
+			if (block->version->type != ip_order[i] ||
+				!block->status.valid)
+				continue;
+
+			r = block->version->funcs->hw_init(adev);
+			DRM_INFO("RE-INIT: %s %s\n", block->version->funcs->name, 
+r?"failed":"successed");

This changes the order in which blocks are initialized which is probably not correct.

Alex needs to take a look at this, but we clearly need to improve the handling here.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev) · line 1775

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
  		}
  	}

_______________________________________________
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): DM5PR12MB1610B39D23F8DC3CBCD18A3784160-2J9CzHegvk++jCVTvoAFKAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by
#17 lore raw

Re: [PATCH 3/6] drm/amdgpu:re-write sriov_reinit_early/late

Quoted 2 lines · Monk

It's correct and already working on vega10/tonga for days, In fact the guilty context already works at my side

Need to use ARRAY_SIZE for the the loops rather than open coding it. Beyond that, if it works for sr-iov, it's fine. Maybe we can look at unifying things for sr-iov and bare metal in this case in the future. With the ARRAY_SIZE change:

Alex

Quoted 125 lines

BR Monk

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Wednesday, May 03, 2017 5:02 PM
To: Liu, Monk <[email protected]>; [email protected]
Subject: Re: [PATCH 3/6] drm/amdgpu:re-write sriov_reinit_early/late

Am 03.05.2017 um 05:48 schrieb Monk Liu:

Quoted 26 lines

1,this way we make those routines compatible with the sequence
requirment for both Tonga and Vega10 2,ignore PSP hw init when
doing TDR, because for SR-IOV device the ucode won't get lost after VF FLR, so no need to invoke PSP doing the ucode reloading again.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 63 ++++++++++++++++++------------
  1 file changed, 39 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -7
index 5161c20..5573792 100644
@@ -1718,19 +1718,27 @@ static int amdgpu_sriov_reinit_early(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)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_early(struct amdgpu_device *adev) · line 1729

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -1
-                     r = adev->ip_blocks[i].version->funcs->hw_init(adev);
+     static enum amd_ip_block_type ip_order[] = {
+             AMD_IP_BLOCK_TYPE_GMC,
+             AMD_IP_BLOCK_TYPE_COMMON,
+             AMD_IP_BLOCK_TYPE_GFXHUB,
+             AMD_IP_BLOCK_TYPE_MMHUB,
+             AMD_IP_BLOCK_TYPE_IH,
+     };
+
+     for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {

You should use ARRAY_SIZE here instead.

Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +15 -7
+             int j;
+             struct amdgpu_ip_block *block;
+
+             for (j = 0; j < adev->num_ip_blocks; j++) {
+                     block = &adev->ip_blocks[j];
+
+                     if (block->version->type != ip_order[i] ||
+                             !block->status.valid)
+                             continue;
 
-             if (r) {
-                     DRM_ERROR("resume of IP block <%s> failed %d\n",
-                               adev->ip_blocks[i].version->funcs->name, r);
-                     return r;
+                     r = block->version->funcs->hw_init(adev);
+                     DRM_INFO("RE-INIT: %s %s\n", block->version->funcs->name,
+r?"failed":"successed");
              }
      }
@@ -1741,20 +1749,27 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
  {
      int i, r;
 
-     for (i = 0; i < adev->num_ip_blocks; i++) {
-             if (!adev->ip_blocks[i].status.valid)
-                     continue;
+     static enum amd_ip_block_type ip_order[] = {
+             AMD_IP_BLOCK_TYPE_SMC,
+             AMD_IP_BLOCK_TYPE_DCE,

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev) · line 1760

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -4
+             AMD_IP_BLOCK_TYPE_GFX,
+             AMD_IP_BLOCK_TYPE_SDMA,
+             AMD_IP_BLOCK_TYPE_VCE,
+     };
 
-             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;
+     for (i = 0; i < sizeof(ip_order)/sizeof(ip_order[0]); i++) {

And here as well.

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -5
+             int j;
+             struct amdgpu_ip_block *block;
 
-             r = adev->ip_blocks[i].version->funcs->hw_init(adev);
-             if (r) {
-                     DRM_ERROR("resume of IP block <%s> failed %d\n",
-                               adev->ip_blocks[i].version->funcs->name, r);
-                     return r;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10 -0
+             for (j = 0; j < adev->num_ip_blocks; j++) {
+                     block = &adev->ip_blocks[j];
+
+                     if (block->version->type != ip_order[i] ||
+                             !block->status.valid)
+                             continue;
+
+                     r = block->version->funcs->hw_init(adev);
+                     DRM_INFO("RE-INIT: %s %s\n", block->version->funcs->name,
+r?"failed":"successed");

This changes the order in which blocks are initialized which is probably not correct.

Alex needs to take a look at this, but we clearly need to improve the handling here.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev) · line 1775

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
              }
      }
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

author
#18 lore raw

PATCH 4/6 drm/amdgpu:cleanups KIQ ring_funcs emit_frame_size

In reply to a message not in the archive

since we don't need hdp flush/inval for KIQ anymore

Change-Id I8518f479afebb73c68ef922880f92dae53b665b9
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 --
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 --
 2 files changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
index 9629f3a..022a319 100644
@@ -6988,8 +6988,6 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_kiq = {
 	.set_wptr = gfx_v8_0_ring_set_wptr_compute,
 	.emit_frame_size =
 		20 + /* gfx_v8_0_ring_emit_gds_switch */
-		7 + /* gfx_v8_0_ring_emit_hdp_flush */
-		5 + /* gfx_v8_0_ring_emit_hdp_invalidate */
 		7 + /* gfx_v8_0_ring_emit_pipeline_sync */
 		17 + /* gfx_v8_0_ring_emit_vm_flush */
 		7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_kiq x3 for user fence, vm fence */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
index 2b2a2c2..6d5b66c 100644
@@ -3620,8 +3620,6 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = {
 	.set_wptr = gfx_v9_0_ring_set_wptr_compute,
 	.emit_frame_size =
 		20 + /* gfx_v9_0_ring_emit_gds_switch */
-		7 + /* gfx_v9_0_ring_emit_hdp_flush */
-		5 + /* gfx_v9_0_ring_emit_hdp_invalidate */
 		7 + /* gfx_v9_0_ring_emit_pipeline_sync */
 		24 + /* gfx_v9_0_ring_emit_vm_flush */
 		8 + 8 + 8, /* gfx_v9_0_ring_emit_fence_kiq x3 for user fence, vm fence */
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): 1493783292-2661-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Xiangliang Yu
#20 lore raw

RE: [PATCH 4/6] drm/amdgpu:cleanups KIQ ring_funcs emit_frame_size

Thanks!
Xiangliang Yu

Quoted 51 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Wednesday, May 03, 2017 11:48 AM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 4/6] drm/amdgpu:cleanups KIQ ring_funcs emit_frame_size

since we don't need hdp flush/inval for KIQ anymore

Change-Id I8518f479afebb73c68ef922880f92dae53b665b9
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 --
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 --
 2 files changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
index 9629f3a..022a319 100644
@@ -6988,8 +6988,6 @@ static const struct amdgpu_ring_funcs
 gfx_v8_0_ring_funcs_kiq = {
 	.set_wptr = gfx_v8_0_ring_set_wptr_compute,
 	.emit_frame_size =
 		20 + /* gfx_v8_0_ring_emit_gds_switch */
-		7 + /* gfx_v8_0_ring_emit_hdp_flush */
-		5 + /* gfx_v8_0_ring_emit_hdp_invalidate */
 		7 + /* gfx_v8_0_ring_emit_pipeline_sync */
 		17 + /* gfx_v8_0_ring_emit_vm_flush */

7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_kiq x3 for user fence,
vm fence */ diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 2b2a2c2..6d5b66c 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
@@ -3620,8 +3620,6 @@ static const struct amdgpu_ring_funcs
 gfx_v9_0_ring_funcs_kiq = {
 	.set_wptr = gfx_v9_0_ring_set_wptr_compute,
 	.emit_frame_size =
 		20 + /* gfx_v9_0_ring_emit_gds_switch */
-		7 + /* gfx_v9_0_ring_emit_hdp_flush */
-		5 + /* gfx_v9_0_ring_emit_hdp_invalidate */
 		7 + /* gfx_v9_0_ring_emit_pipeline_sync */
 		24 + /* gfx_v9_0_ring_emit_vm_flush */

8 + 8 + 8, /* gfx_v9_0_ring_emit_fence_kiq x3 for user fence,
vm fence */
--
2.7.4

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

Reviewed-by
#21 lore raw

Re: [PATCH 4/6] drm/amdgpu:cleanups KIQ ring_funcs emit_frame_size

In reply to a message not in the archive

Am 03.05.2017 um 05:48 schrieb Monk Liu:

Quoted 4 lines

since we don't need hdp flush/inval for KIQ anymore

Change-Id I8518f479afebb73c68ef922880f92dae53b665b9
Quoted 23 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 --
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 --
  2 files changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
index 9629f3a..022a319 100644
@@ -6988,8 +6988,6 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_kiq = {
  	.set_wptr = gfx_v8_0_ring_set_wptr_compute,
  	.emit_frame_size =
  		20 + /* gfx_v8_0_ring_emit_gds_switch */
-		7 + /* gfx_v8_0_ring_emit_hdp_flush */
-		5 + /* gfx_v8_0_ring_emit_hdp_invalidate */
  		7 + /* gfx_v8_0_ring_emit_pipeline_sync */
  		17 + /* gfx_v8_0_ring_emit_vm_flush */
  		7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_kiq x3 for user fence, vm fence */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 2b2a2c2..6d5b66c 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = { · line 3625

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
@@ -3620,8 +3620,6 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = {
  	.set_wptr = gfx_v9_0_ring_set_wptr_compute,
  	.emit_frame_size =
  		20 + /* gfx_v9_0_ring_emit_gds_switch */
-		7 + /* gfx_v9_0_ring_emit_hdp_flush */
-		5 + /* gfx_v9_0_ring_emit_hdp_invalidate */
  		7 + /* gfx_v9_0_ring_emit_pipeline_sync */
  		24 + /* gfx_v9_0_ring_emit_vm_flush */
  		8 + 8 + 8, /* gfx_v9_0_ring_emit_fence_kiq x3 for user fence, vm fence */

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

Reviewed-by
#22 lore raw

Re: [PATCH 4/6] drm/amdgpu:cleanups KIQ ring_funcs emit_frame_size

In reply to a message not in the archive
Quoted 4 lines · Monk Liu

since we don't need hdp flush/inval for KIQ anymore

Change-Id I8518f479afebb73c68ef922880f92dae53b665b9
Quoted 34 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 --
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 --
 2 files changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
index 9629f3a..022a319 100644
@@ -6988,8 +6988,6 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_kiq = {
        .set_wptr = gfx_v8_0_ring_set_wptr_compute,
        .emit_frame_size =
                20 + /* gfx_v8_0_ring_emit_gds_switch */
-               7 + /* gfx_v8_0_ring_emit_hdp_flush */
-               5 + /* gfx_v8_0_ring_emit_hdp_invalidate */
                7 + /* gfx_v8_0_ring_emit_pipeline_sync */
                17 + /* gfx_v8_0_ring_emit_vm_flush */
                7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_kiq x3 for user fence, vm fence */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -3
index 2b2a2c2..6d5b66c 100644
@@ -3620,8 +3620,6 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = {
        .set_wptr = gfx_v9_0_ring_set_wptr_compute,
        .emit_frame_size =
                20 + /* gfx_v9_0_ring_emit_gds_switch */
-               7 + /* gfx_v9_0_ring_emit_hdp_flush */
-               5 + /* gfx_v9_0_ring_emit_hdp_invalidate */
                7 + /* gfx_v9_0_ring_emit_pipeline_sync */
                24 + /* gfx_v9_0_ring_emit_vm_flush */
                8 + 8 + 8, /* gfx_v9_0_ring_emit_fence_kiq x3 for user fence, vm fence */
--

2.7.4

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

author
#23 lore raw

PATCH 5/6 drm/amdgpu:kiq reg access need timeout(v2)

In reply to a message not in the archive

this is to prevent fence forever waiting if FLR occured during register accessing.

v2:
use define instead of hardcode for the timeout msec

Change-Id I32cc219a08f5a67654beb26c45d1b95d2b60cc96
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +8 -5
index 966bf7f..757cbc4 100644
@@ -22,6 +22,7 @@
  */
 
 #include "amdgpu.h"
+#define MAX_KIQ_REG_WAIT	100000
 
 int amdgpu_allocate_static_csa(struct amdgpu_device *adev)
 {
@@ -128,10 +129,12 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
 	amdgpu_ring_commit(ring);
 	mutex_unlock(&kiq->ring_mutex);
 
-	r = fence_wait(f, false);
-	if (r)
-		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
+	r = fence_wait_timeout(f, false, msecs_to_jiffies(MAX_KIQ_REG_WAIT));
 	fence_put(f);
+	if (r < 1) {
+		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
+		return ~0;
+	}
 
 	val = adev->wb.wb[adev->virt.reg_val_offs];
 
@@ -154,8 +157,8 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
 	amdgpu_ring_commit(ring);
 	mutex_unlock(&kiq->ring_mutex);
 
-	r = fence_wait(f, false);
-	if (r)
+	r = fence_wait_timeout(f, false, msecs_to_jiffies(MAX_KIQ_REG_WAIT));
+	if (r < 1)
 		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
 	fence_put(f);
 }
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): 1493783292-2661-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Xiangliang Yu
#25 lore raw

RE: [PATCH 5/6] drm/amdgpu:kiq reg access need timeout(v2)

Thanks!
Xiangliang Yu

Quoted 67 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Wednesday, May 03, 2017 11:48 AM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 5/6] drm/amdgpu:kiq reg access need timeout(v2)

this is to prevent fence forever waiting if FLR occured during register accessing.

v2:
use define instead of hardcode for the timeout msec

Change-Id I32cc219a08f5a67654beb26c45d1b95d2b60cc96
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -0
index 966bf7f..757cbc4 100644
@@ -22,6 +22,7 @@
  */
 
 #include "amdgpu.h"
+#define MAX_KIQ_REG_WAIT	100000
 
 int amdgpu_allocate_static_csa(struct amdgpu_device *adev)  { @@ -128,10
+129,12 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev,

uint32_t reg)

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -3
 	amdgpu_ring_commit(ring);
 	mutex_unlock(&kiq->ring_mutex);
 
-	r = fence_wait(f, false);
-	if (r)
-		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
+	r = fence_wait_timeout(f, false,

msecs_to_jiffies(MAX_KIQ_REG_WAIT));

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +6 -2
 	fence_put(f);
+	if (r < 1) {
+		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
+		return ~0;
+	}
 
 	val = adev->wb.wb[adev->virt.reg_val_offs];
@@ -154,8 +157,8 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device
 *adev, uint32_t reg, uint32_t v)
 	amdgpu_ring_commit(ring);
 	mutex_unlock(&kiq->ring_mutex);
 
-	r = fence_wait(f, false);
-	if (r)
+	r = fence_wait_timeout(f, false,
 msecs_to_jiffies(MAX_KIQ_REG_WAIT));
+	if (r < 1)
 		DRM_ERROR("wait for kiq fence error: %ld.\n", r);

fence_put(f);
}
--
2.7.4

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

author
#26 lore raw

PATCH 6/6 drm/amdgpu:PTE flag should be 64 bit width

In reply to a message not in the archive

otherwise we'll lost the high 32 bit for pte, which lead to incorrect MTYPE for vega10.

Change-Id I1b0c7b8df14e340a36d4d2a72c6c03f469fdc29c
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
index 11c6c44..c3fb2f9 100644
@@ -765,7 +765,7 @@ int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
 {
 	struct amdgpu_ttm_tt *gtt, *tmp;
 	struct ttm_mem_reg bo_mem;
-	uint32_t flags;
+	uint64_t flags;
 	int r;
 
 	bo_mem.mem_type = TTM_PL_TT;
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): 1493783292-2661-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#28 lore raw

Re: [PATCH 6/6] drm/amdgpu:PTE flag should be 64 bit width

Quoted 6 lines · Monk Liu

otherwise we'll lost the high 32 bit for pte, which lead to incorrect MTYPE for vega10.

Change-Id I1b0c7b8df14e340a36d4d2a72c6c03f469fdc29c
Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
index 11c6c44..c3fb2f9 100644
@@ -765,7 +765,7 @@ int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
 {
        struct amdgpu_ttm_tt *gtt, *tmp;
        struct ttm_mem_reg bo_mem;
-       uint32_t flags;
+       uint64_t flags;
        int r;
 
        bo_mem.mem_type = TTM_PL_TT;
--

2.7.4

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

Reviewed-by Xiangliang Yu
#29 lore raw
In reply to a message not in the archive

Thanks!
Xiangliang Yu

Quoted 40 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Wednesday, May 03, 2017 11:48 AM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 1/6] drm/amdgpu:fix cannot receive rcv/ack irq bug

Change-Id Ie8672e0c9358d9542810ce05c822d9367249bbd7
---
 drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +4 -3
index 1493301..712f36e 100644
@@ -296,11 +296,11 @@ int xgpu_ai_mailbox_add_irq_id(struct
 amdgpu_device *adev)  {
 	int r;
 
-	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 135,
 &adev->virt.rcv_irq);
+	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_BIF, 135,
+&adev->virt.rcv_irq);
 	if (r)
 		return r;
 
-	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 138,
 &adev->virt.ack_irq);
+	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_BIF, 138,
+&adev->virt.ack_irq);
 	if (r) {
 		amdgpu_irq_put(adev, &adev->virt.rcv_irq, 0);
 		return r;
--

2.7.4

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

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

Am 03.05.2017 um 05:48 schrieb Monk Liu:

Quoted 2 lines
Change-Id Ie8672e0c9358d9542810ce05c822d9367249bbd7
Quoted 12 lines
---
  drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +0 -0
index 1493301..712f36e 100644
@@ -296,11 +296,11 @@ int xgpu_ai_mailbox_add_irq_id(struct amdgpu_device *adev)
  {
  	int r;
 

drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c int xgpu_ai_mailbox_add_irq_id(struct amdgpu_device *adev) · line 306

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +2 -2
-	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 135, &adev->virt.rcv_irq);
+	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_BIF, 135, &adev->virt.rcv_irq);
  	if (r)
  		return r;
 
-	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 138, &adev->virt.ack_irq);
+	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_BIF, 138, &adev->virt.ack_irq);
  	if (r) {
  		amdgpu_irq_put(adev, &adev->virt.rcv_irq, 0);
  		return r;

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

Reviewed-by
#31 lore raw
In reply to a message not in the archive
Quoted 2 lines · Monk Liu
Change-Id Ie8672e0c9358d9542810ce05c822d9367249bbd7
Quoted 25 lines
---
 drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +2 -3
index 1493301..712f36e 100644
@@ -296,11 +296,11 @@ int xgpu_ai_mailbox_add_irq_id(struct amdgpu_device *adev)
 {
        int r;
 
-       r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 135, &adev->virt.rcv_irq);
+       r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_BIF, 135, &adev->virt.rcv_irq);
        if (r)
                return r;
 
-       r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 138, &adev->virt.ack_irq);
+       r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_BIF, 138, &adev->virt.ack_irq);
        if (r) {
                amdgpu_irq_put(adev, &adev->virt.rcv_irq, 0);
                return r;
--

2.7.4

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