Skip to contentSkip to conversation

drm/amdgpu: Rearm IRQ in Vega10 SR-IOV if IRQ lost

PATCH In review Trigger Huang 3 participants 4 messages Apr 30, 2019 – May 1, 2019 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: Rearm IRQ in Vega10 SR-IOV if IRQ lost

In Multi-VFs stress test, sometimes we see IRQ lost when running benchmark, just rearm it.

---
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 37 +++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +36 -1
index 1b2f69a..8d89ab7 100644
@@ -31,7 +31,7 @@
 #include "soc15_common.h"
 #include "vega10_ih.h"
 
-
+#define MAX_REARM_RETRY 10
 
 static void vega10_ih_set_interrupt_funcs(struct amdgpu_device *adev);
 
@@ -382,6 +382,38 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev,
 }
 
 /**
+ * vega10_ih_irq_rearm - rearm IRQ if lost
+ *
+ * @adev: amdgpu_device pointer
+ *
+ */
+static void vega10_ih_irq_rearm(struct amdgpu_device *adev,
+			       struct amdgpu_ih_ring *ih)
+{
+	uint32_t reg_rptr = 0;
+	uint32_t v = 0;
+	uint32_t i = 0;
+
+	if (ih == &adev->irq.ih)
+		reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR);
+	else if (ih == &adev->irq.ih1)
+		reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING1);
+	else if (ih == &adev->irq.ih2)
+		reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING2);
+	else
+		return;
+
+	/* Rearm IRQ / re-wwrite doorbell if doorbell write is lost */
+	for (i = 0; i < MAX_REARM_RETRY; i++) {
+		v = RREG32_NO_KIQ(reg_rptr);
+		if ((v < ih->ring_size) && (v != ih->rptr))
+			WDOORBELL32(ih->doorbell_index, ih->rptr);
+		else
+			break;
+	}
+}
+
+/**
  * vega10_ih_set_rptr - set the IH ring buffer rptr
  *
  * @adev: amdgpu_device pointer
@@ -395,6 +427,9 @@ static void vega10_ih_set_rptr(struct amdgpu_device *adev,
 		/* XXX check if swapping is necessary on BE */
 		*ih->rptr_cpu = ih->rptr;
 		WDOORBELL32(ih->doorbell_index, ih->rptr);
+
+		if (amdgpu_sriov_vf(adev))
+			vega10_ih_irq_rearm(adev, ih);
 	} else if (ih == &adev->irq.ih) {
 		WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, ih->rptr);
 	} else if (ih == &adev->irq.ih1) {
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): 1556637284-715-1-git-send-email-Trigger.Huang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 30.04.19 um 17:14 schrieb Trigger Huang:

Quoted 2 lines

In Multi-VFs stress test, sometimes we see IRQ lost when running benchmark, just rearm it.

Well I think I have seen that on bare metal as well, it would certainly explain some very odd behavior I've got from the IH block.

Have you pinged the hw guys about that already?

Quoted 1 line
Quoted 57 lines
---
  drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 37 +++++++++++++++++++++++++++++++++-
  1 file changed, 36 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +33 -1
index 1b2f69a..8d89ab7 100644
@@ -31,7 +31,7 @@
  #include "soc15_common.h"
  #include "vega10_ih.h"
 
-
+#define MAX_REARM_RETRY 10
 
  static void vega10_ih_set_interrupt_funcs(struct amdgpu_device *adev);
 
@@ -382,6 +382,38 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev,
  }
 
  /**
+ * vega10_ih_irq_rearm - rearm IRQ if lost
+ *
+ * @adev: amdgpu_device pointer
+ *
+ */
+static void vega10_ih_irq_rearm(struct amdgpu_device *adev,
+			       struct amdgpu_ih_ring *ih)
+{
+	uint32_t reg_rptr = 0;
+	uint32_t v = 0;
+	uint32_t i = 0;
+
+	if (ih == &adev->irq.ih)
+		reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR);
+	else if (ih == &adev->irq.ih1)
+		reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING1);
+	else if (ih == &adev->irq.ih2)
+		reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING2);
+	else
+		return;
+
+	/* Rearm IRQ / re-wwrite doorbell if doorbell write is lost */
+	for (i = 0; i < MAX_REARM_RETRY; i++) {
+		v = RREG32_NO_KIQ(reg_rptr);
+		if ((v < ih->ring_size) && (v != ih->rptr))
+			WDOORBELL32(ih->doorbell_index, ih->rptr);
+		else
+			break;
+	}
+}
+
+/**
   * vega10_ih_set_rptr - set the IH ring buffer rptr
   *
   * @adev: amdgpu_device pointer

drivers/gpu/drm/amd/amdgpu/vega10_ih.c static void vega10_ih_set_rptr(struct amdgpu_device *adev, · line 435

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +3 -0
@@ -395,6 +427,9 @@ static void vega10_ih_set_rptr(struct amdgpu_device *adev,
  		/* XXX check if swapping is necessary on BE */
  		*ih->rptr_cpu = ih->rptr;
  		WDOORBELL32(ih->doorbell_index, ih->rptr);
+
+		if (amdgpu_sriov_vf(adev))
+			vega10_ih_irq_rearm(adev, ih);
  	} else if (ih == &adev->irq.ih) {
  		WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, ih->rptr);
  	} else if (ih == &adev->irq.ih1) {

_______________________________________________
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): c9c462e1-f73f-64f0-31f8-3bbceefbea60-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw
Quoted 7 lines · Christian König

Am 30.04.19 um 17:14 schrieb Trigger Huang:

Quoted 2 lines

In Multi-VFs stress test, sometimes we see IRQ lost when running benchmark, just rearm it.

Well I think I have seen that on bare metal as well, it would certainly explain some very odd behavior I've got from the IH block.

Maybe we should enable this for bare metal too in a follow up patch.

Alex

Quoted 70 lines

Have you pinged the hw guys about that already?

Quoted 1 line
Quoted 63 lines
---
  drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 37 +++++++++++++++++++++++++++++++++-
  1 file changed, 36 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +36 -1
index 1b2f69a..8d89ab7 100644
@@ -31,7 +31,7 @@
  #include "soc15_common.h"
  #include "vega10_ih.h"
 
-
+#define MAX_REARM_RETRY 10
 
  static void vega10_ih_set_interrupt_funcs(struct amdgpu_device *adev);
 
@@ -382,6 +382,38 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev,
  }
 
  /**
+ * vega10_ih_irq_rearm - rearm IRQ if lost
+ *
+ * @adev: amdgpu_device pointer
+ *
+ */
+static void vega10_ih_irq_rearm(struct amdgpu_device *adev,
+                            struct amdgpu_ih_ring *ih)
+{
+     uint32_t reg_rptr = 0;
+     uint32_t v = 0;
+     uint32_t i = 0;
+
+     if (ih == &adev->irq.ih)
+             reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR);
+     else if (ih == &adev->irq.ih1)
+             reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING1);
+     else if (ih == &adev->irq.ih2)
+             reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING2);
+     else
+             return;
+
+     /* Rearm IRQ / re-wwrite doorbell if doorbell write is lost */
+     for (i = 0; i < MAX_REARM_RETRY; i++) {
+             v = RREG32_NO_KIQ(reg_rptr);
+             if ((v < ih->ring_size) && (v != ih->rptr))
+                     WDOORBELL32(ih->doorbell_index, ih->rptr);
+             else
+                     break;
+     }
+}
+
+/**
   * vega10_ih_set_rptr - set the IH ring buffer rptr
   *
   * @adev: amdgpu_device pointer
@@ -395,6 +427,9 @@ static void vega10_ih_set_rptr(struct amdgpu_device *adev,
              /* XXX check if swapping is necessary on BE */
              *ih->rptr_cpu = ih->rptr;
              WDOORBELL32(ih->doorbell_index, ih->rptr);
+
+             if (amdgpu_sriov_vf(adev))
+                     vega10_ih_irq_rearm(adev, ih);
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vega10_ih.c static void vega10_ih_set_rptr(struct amdgpu_device *adev, · line 435

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +0 -0
      } else if (ih == &adev->irq.ih) {
              WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, ih->rptr);
      } else if (ih == &adev->irq.ih1) {

_______________________________________________
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 Acked-by Christian König
#5 lore raw
In reply to a message not in the archive

Hi Christian,

Yes, it is the HW guys who suggested to rearm it.

Thanks & Best Wishes,
Trigger Huang

-----Original Message-----
From: Christian König <[email protected]>
Sent: Wednesday, May 01, 2019 1:10 AM
To: Huang, Trigger <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Rearm IRQ in Vega10 SR-IOV if IRQ lost

[CAUTION: External Email]

Am 30.04.19 um 17:14 schrieb Trigger Huang:

Quoted 2 lines

In Multi-VFs stress test, sometimes we see IRQ lost when running benchmark, just rearm it.

Well I think I have seen that on bare metal as well, it would certainly explain some very odd behavior I've got from the IH block.

Have you pinged the hw guys about that already?

Quoted 1 line
Quoted 58 lines
---
  drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 37 +++++++++++++++++++++++++++++++++-
  1 file changed, 36 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +32 -1
index 1b2f69a..8d89ab7 100644
@@ -31,7 +31,7 @@
  #include "soc15_common.h"
  #include "vega10_ih.h"
 
-
+#define MAX_REARM_RETRY 10
 
  static void vega10_ih_set_interrupt_funcs(struct amdgpu_device 
 *adev);
@@ -382,6 +382,38 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev,
  }
 
  /**
+ * vega10_ih_irq_rearm - rearm IRQ if lost
+ *
+ * @adev: amdgpu_device pointer
+ *
+ */
+static void vega10_ih_irq_rearm(struct amdgpu_device *adev,
+                            struct amdgpu_ih_ring *ih) {
+     uint32_t reg_rptr = 0;
+     uint32_t v = 0;
+     uint32_t i = 0;
+
+     if (ih == &adev->irq.ih)
+             reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR);
+     else if (ih == &adev->irq.ih1)
+             reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING1);
+     else if (ih == &adev->irq.ih2)
+             reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING2);
+     else
+             return;
+
+     /* Rearm IRQ / re-wwrite doorbell if doorbell write is lost */
+     for (i = 0; i < MAX_REARM_RETRY; i++) {
+             v = RREG32_NO_KIQ(reg_rptr);
+             if ((v < ih->ring_size) && (v != ih->rptr))
+                     WDOORBELL32(ih->doorbell_index, ih->rptr);
+             else
+                     break;
+     }
+}
+
+/**
   * vega10_ih_set_rptr - set the IH ring buffer rptr
   *
   * @adev: amdgpu_device pointer

drivers/gpu/drm/amd/amdgpu/vega10_ih.c static void vega10_ih_set_rptr(struct amdgpu_device *adev, · line 435

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +3 -0
@@ -395,6 +427,9 @@ static void vega10_ih_set_rptr(struct amdgpu_device *adev,
              /* XXX check if swapping is necessary on BE */
              *ih->rptr_cpu = ih->rptr;
              WDOORBELL32(ih->doorbell_index, ih->rptr);
+
+             if (amdgpu_sriov_vf(adev))
+                     vega10_ih_irq_rearm(adev, ih);
      } else if (ih == &adev->irq.ih) {
              WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, ih->rptr);
      } else if (ih == &adev->irq.ih1) {

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