Skip to contentSkip to conversation

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

PATCH In review Monk Liu 3 participants 12 messages May 1, 2017 5 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): 1493620480-22002-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
author
#3 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): 1493620480-22002-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#5 lore raw

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

Quoted 26 lines · Monk Liu

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++) {

Use ARRAY_SIZE(ip_order)

Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +16 -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,
+               AMD_IP_BLOCK_TYPE_GFX,
+               AMD_IP_BLOCK_TYPE_SDMA,

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -4
+               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;

Same here.

With that fixed:

Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -6
-               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");
                }
        }
 
--

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

#6 lore raw

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

In reply to a message not in the archive

Am 01.05.2017 um 08:34 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++) {

Please use ARRAY_SIZE for this.

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++) {

Dito.

Apart from that it looks a bit like we are changing the order here?

Is that a good idea. Usually the blocks should be initialized in the order defined by ip_blocks.

Christian.

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -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;
+		for (j = 0; j < adev->num_ip_blocks; j++) {
+			block = &adev->ip_blocks[j];

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

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

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

author
#7 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 ac64e01..337f077 100644
@@ -6974,8 +6974,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 08daa3f..006049e 100644
@@ -3531,8 +3531,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): 1493620480-22002-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#9 lore raw

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

Am 01.05.2017 um 08:34 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 ac64e01..337f077 100644
@@ -6974,8 +6974,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 08daa3f..006049e 100644

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

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
@@ -3531,8 +3531,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

author
#10 lore raw

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

In reply to a message not in the archive

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

Change-Id I32cc219a08f5a67654beb26c45d1b95d2b60cc96
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +7 -5
index 1363239..6ab500b 100644
@@ -129,10 +129,12 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
 	amdgpu_ring_commit(ring);
 	mutex_unlock(&adev->virt.lock_kiq);
 
-	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(10000));
 	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];
 
@@ -155,8 +157,8 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
 	amdgpu_ring_commit(ring);
 	mutex_unlock(&adev->virt.lock_kiq);
 
-	r = fence_wait(f, false);
-	if (r)
+	r = fence_wait_timeout(f, false, msecs_to_jiffies(10000));
+	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): 1493620480-22002-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

#12 lore raw

Re: [PATCH 5/6] drm/amdgpu:kiq reg access need timeout

Am 01.05.2017 um 08:34 schrieb Monk Liu:

Quoted 14 lines

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

Change-Id I32cc219a08f5a67654beb26c45d1b95d2b60cc96
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -0
index 1363239..6ab500b 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg) · line 132

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -3
@@ -129,10 +129,12 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
  	amdgpu_ring_commit(ring);
  	mutex_unlock(&adev->virt.lock_kiq);
 
-	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(10000));

We should probably add a define for that somewhere.

Apart from that the change looks good to me,
Christian.

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +4 -0
  	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];
 

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v) · line 164

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -2
@@ -155,8 +157,8 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
  	amdgpu_ring_commit(ring);
  	mutex_unlock(&adev->virt.lock_kiq);
 
-	r = fence_wait(f, false);
-	if (r)
+	r = fence_wait_timeout(f, false, msecs_to_jiffies(10000));
+	if (r < 1)
  		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
  	fence_put(f);
  }

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

author
#13 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): 1493620480-22002-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

#15 lore raw

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

Am 01.05.2017 um 08:34 schrieb Monk Liu:

Quoted 5 lines

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

Change-Id I1b0c7b8df14e340a36d4d2a72c6c03f469fdc29c

Nice catch, patch is Reviewed-by: Christian König <[email protected]>

Quoted 9 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 +0 -0
index 11c6c44..c3fb2f9 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_recover_gart(struct amdgpu_device *adev) · line 771

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -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;

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

Reviewed-by
#16 lore raw
In reply to a message not in the archive
Quoted 2 lines · Monk Liu
Change-Id Ie8672e0c9358d9542810ce05c822d9367249bbd7

A couple of comments on patch 3. The rest are:

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