Skip to contentSkip to conversation

drm/amdgpu/virt: don't check VALID bit for FLR completion message

PATCH In review Pixel Ding 2 participants 4 messages Feb 23, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Pixel Ding

author
#0 lore raw

PATCH 1/1 drm/amdgpu/virt: don't check VALID bit for FLR completion message

The interrupt after FLR is missed sometimes due to hardware reason, so guest driver get the notification of FLR completion via polling message. Then host doesn't write VALID bit to avoid sending interrupt, otherwise the completion will be handled twice.

So there's a valid message without VALID bit for FLR completion, driver should handle it without checking.

---
 drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +1 -1
index 3164d61..285d54c 100644
@@ -369,7 +369,7 @@ static int xgpu_vi_mailbox_rcv_msg(struct amdgpu_device *adev,
 	u32 mask = REG_FIELD_MASK(MAILBOX_CONTROL, RCV_MSG_VALID);
 
 	reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
-	if (!(reg & mask))
+	if (!(reg & mask) && (event != IDH_FLR_NOTIFICATION_CMPL))
 		return -ENOENT;
 
 	reg = RREG32_NO_KIQ(mmMAILBOX_MSGBUF_RCV_DW0);
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): 1487820028-11047-1-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 19 lines

The interrupt after FLR is missed sometimes due to hardware reason, so guest driver get the notification of FLR completion via polling message. Then host doesn't write VALID bit to avoid sending interrupt, otherwise the completion will be handled twice.

So there's a valid message without VALID bit for FLR completion, driver should handle it without checking.

---
 drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +0 -0
index 3164d61..285d54c 100644

drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c static int xgpu_vi_mailbox_rcv_msg(struct · line 375

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +1 -1
@@ -369,7 +369,7 @@ static int xgpu_vi_mailbox_rcv_msg(struct
 amdgpu_device *adev,
 	u32 mask = REG_FIELD_MASK(MAILBOX_CONTROL,
 RCV_MSG_VALID);
 
 	reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
-	if (!(reg & mask))
+	if (!(reg & mask) && (event != IDH_FLR_NOTIFICATION_CMPL))
 		return -ENOENT;

Small nitpick: better to move event check to top and add a comment.

Quoted 8 lines

reg = RREG32_NO_KIQ(mmMAILBOX_MSGBUF_RCV_DW0);
--
2.7.4

_______________________________________________
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
#3 lore raw

PATCH 1/1 drm/amdgpu/virt: don't check VALID bit for FLR completion message

In reply to a message not in the archive

The interrupt after FLR is missed sometimes due to hardware reason, so guest driver get the notification of FLR completion via polling message. Then host doesn't write VALID bit to avoid sending interrupt, otherwise the completion will be handled twice.

So there's a valid message without VALID bit for FLR completion, driver should handle it without checking.

---
 drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +6 -3
index 3164d61..3c6b0af 100644
@@ -368,9 +368,12 @@ static int xgpu_vi_mailbox_rcv_msg(struct amdgpu_device *adev,
 	u32 reg;
 	u32 mask = REG_FIELD_MASK(MAILBOX_CONTROL, RCV_MSG_VALID);
 
-	reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
-	if (!(reg & mask))
-		return -ENOENT;
+	/* workaround: host driver doesn't set VALID for CMPL now */
+	if (event != IDH_FLR_NOTIFICATION_CMPL) {
+		reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
+		if (!(reg & mask))
+			return -ENOENT;
+	}
 
 	reg = RREG32_NO_KIQ(mmMAILBOX_MSGBUF_RCV_DW0);
 	if (reg != event)
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): 1487833755-31177-1-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org

Reviewed-by Xiangliang Yu
#5 lore raw
Quoted 48 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Pixel Ding
Sent: Thursday, February 23, 2017 3:09 PM
To: [email protected]
Cc: Ding, Pixel <[email protected]>
Subject: [PATCH] drm/amdgpu/virt: don't check VALID bit for FLR completion message

The interrupt after FLR is missed sometimes due to hardware reason, so guest driver get the notification of FLR completion via polling message. Then host doesn't write VALID bit to avoid sending interrupt, otherwise the completion will be handled twice.

So there's a valid message without VALID bit for FLR completion, driver should handle it without checking.

---
 drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +6 -3
index 3164d61..3c6b0af 100644
@@ -368,9 +368,12 @@ static int xgpu_vi_mailbox_rcv_msg(struct
 amdgpu_device *adev,
 	u32 reg;
 	u32 mask = REG_FIELD_MASK(MAILBOX_CONTROL,
 RCV_MSG_VALID);
 
-	reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
-	if (!(reg & mask))
-		return -ENOENT;
+	/* workaround: host driver doesn't set VALID for CMPL now */
+	if (event != IDH_FLR_NOTIFICATION_CMPL) {
+		reg = RREG32_NO_KIQ(mmMAILBOX_CONTROL);
+		if (!(reg & mask))
+			return -ENOENT;
+	}
 
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +0 -1
 	reg = RREG32_NO_KIQ(mmMAILBOX_MSGBUF_RCV_DW0);
 	if (reg != event)
--

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