Skip to contentSkip to conversation

drm/amdgpu: Fix interrupt handling on ih_soft ring

PATCH Superseded Mukul Joshi 3 participants 6 messages Aug 12, 2022 – Aug 15, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix interrupt handling on ih_soft ring

There are no backing hardware registers for ih_soft ring. As a result, don't try to access hardware registers for read and write pointers when processing interrupts on the IH soft ring.

---
 drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +6 -1
index 3b4eb8285943..2022ffbb8dba 100644
@@ -385,9 +385,11 @@ static u32 vega20_ih_get_wptr(struct amdgpu_device *adev,
 	u32 wptr, tmp;
 	struct amdgpu_ih_regs *ih_regs;
 
-	if (ih == &adev->irq.ih) {
+	if (ih == &adev->irq.ih || ih == &adev->irq.ih_soft) {
 		/* Only ring0 supports writeback. On other rings fall back
 		 * to register-based code with overflow checking below.
+		 * ih_soft ring doesn't have any backing hardware registers,
+		 * update wptr and return.
 		 */
 		wptr = le32_to_cpu(*ih->wptr_cpu);
 
@@ -461,6 +463,9 @@ static void vega20_ih_set_rptr(struct amdgpu_device *adev,
 {
 	struct amdgpu_ih_regs *ih_regs;
 
+	if (ih == &adev->irq.ih_soft)
+		return;
+
 	if (ih->use_doorbell) {
 		/* XXX check if swapping is necessary on BE */
 		*ih->rptr_cpu = ih->rptr;
Signature · 1 line
2.35.1
#1 lore raw
Quoted 6 lines · Mukul Joshi

There are no backing hardware registers for ih_soft ring. As a result, don't try to access hardware registers for read and write pointers when processing interrupts on the IH soft ring.

The patch looks good to me. But you probably should apply the same changes to vega10_ih.c and navi10_ih.c as well.

Regards,
  Felix

Quoted 31 lines
---
  drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +6 -1
index 3b4eb8285943..2022ffbb8dba 100644
@@ -385,9 +385,11 @@ static u32 vega20_ih_get_wptr(struct amdgpu_device *adev,
  	u32 wptr, tmp;
  	struct amdgpu_ih_regs *ih_regs;
 
-	if (ih == &adev->irq.ih) {
+	if (ih == &adev->irq.ih || ih == &adev->irq.ih_soft) {
  		/* Only ring0 supports writeback. On other rings fall back
  		 * to register-based code with overflow checking below.
+		 * ih_soft ring doesn't have any backing hardware registers,
+		 * update wptr and return.
  		 */
  		wptr = le32_to_cpu(*ih->wptr_cpu);
 
@@ -461,6 +463,9 @@ static void vega20_ih_set_rptr(struct amdgpu_device *adev,
  {
  	struct amdgpu_ih_regs *ih_regs;
 
+	if (ih == &adev->irq.ih_soft)
+		return;
+
  	if (ih->use_doorbell) {
  		/* XXX check if swapping is necessary on BE */
  		*ih->rptr_cpu = ih->rptr;
#2 lore raw

[AMD Official Use Only - General]

Quoted 8 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Friday, August 12, 2022 5:27 PM
To: Joshi, Mukul <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Fix interrupt handling on ih_soft ring

On 2022-08-12 16:56, Mukul Joshi wrote:

Quoted 9 lines
Quoted 5 lines

There are no backing hardware registers for ih_soft ring. As a result, don't try to access hardware registers for read and write pointers when processing interrupts on the IH soft ring.

The patch looks good to me. But you probably should apply the same changes to vega10_ih.c and navi10_ih.c as well.

Oops sorry I missed that. Will update the patch and re-send.

Regards,
Mukul

Quoted 38 lines

Regards,
  Felix

drivers/gpu/drm/amd/amdgpu/vega20_ih.c static u32 vega20_ih_get_wptr(struct

Quoted 10 lines
---
  drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +0 -0
index 3b4eb8285943..2022ffbb8dba 100644
@@ -385,9 +385,11 @@ static u32 vega20_ih_get_wptr(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/vega20_ih.c static void vega20_ih_set_rptr(struct

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +3 -1
  	u32 wptr, tmp;
  	struct amdgpu_ih_regs *ih_regs;
 
-	if (ih == &adev->irq.ih) {
+	if (ih == &adev->irq.ih || ih == &adev->irq.ih_soft) {
  		/* Only ring0 supports writeback. On other rings fall back
  		 * to register-based code with overflow checking below.
+		 * ih_soft ring doesn't have any backing hardware registers,
+		 * update wptr and return.
  		 */
  		wptr = le32_to_cpu(*ih->wptr_cpu);
 
@@ -461,6 +463,9 @@ static void vega20_ih_set_rptr(struct

amdgpu_device *adev,

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +3 -0
  {
  	struct amdgpu_ih_regs *ih_regs;
 
+	if (ih == &adev->irq.ih_soft)
+		return;
+
  	if (ih->use_doorbell) {
  		/* XXX check if swapping is necessary on BE */
  		*ih->rptr_cpu = ih->rptr;
#3 lore raw
In reply to Mukul Joshi

Am 12.08.22 um 22:56 schrieb Mukul Joshi:

Quoted 4 lines

There are no backing hardware registers for ih_soft ring. As a result, don't try to access hardware registers for read and write pointers when processing interrupts on the IH soft ring.

Mhm, the original plan was to have different ih function for the rings but I think we just forgot to implement this fully.

When you do it this way you need to apply it to a bunch of different hw generation as Felix mentioned as well.

Might be easier to clean that up.

Regards,
Christian.

Quoted 33 lines
---
  drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +6 -1
index 3b4eb8285943..2022ffbb8dba 100644
@@ -385,9 +385,11 @@ static u32 vega20_ih_get_wptr(struct amdgpu_device *adev,
  	u32 wptr, tmp;
  	struct amdgpu_ih_regs *ih_regs;
 
-	if (ih == &adev->irq.ih) {
+	if (ih == &adev->irq.ih || ih == &adev->irq.ih_soft) {
  		/* Only ring0 supports writeback. On other rings fall back
  		 * to register-based code with overflow checking below.
+		 * ih_soft ring doesn't have any backing hardware registers,
+		 * update wptr and return.
  		 */
  		wptr = le32_to_cpu(*ih->wptr_cpu);
 
@@ -461,6 +463,9 @@ static void vega20_ih_set_rptr(struct amdgpu_device *adev,
  {
  	struct amdgpu_ih_regs *ih_regs;
 
+	if (ih == &adev->irq.ih_soft)
+		return;
+
  	if (ih->use_doorbell) {
  		/* XXX check if swapping is necessary on BE */
  		*ih->rptr_cpu = ih->rptr;
#4 lore raw

Am 2022-08-14 um 13:27 schrieb Christian König:

Quoted 11 lines

Am 12.08.22 um 22:56 schrieb Mukul Joshi:

Quoted 4 lines

There are no backing hardware registers for ih_soft ring. As a result, don't try to access hardware registers for read and write pointers when processing interrupts on the IH soft ring.

Mhm, the original plan was to have different ih function for the rings but I think we just forgot to implement this fully.

When you do it this way you need to apply it to a bunch of different hw generation as Felix mentioned as well.

Might be easier to clean that up.

Right now ih_funcs cannot be different per ring. Are you suggesting moving the ih_funcs into the amdgpu_ih_ring structure?

Regards,
  Felix

Quoted 36 lines

Regards,
Christian.

Quoted 31 lines

---
  drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 7 ++++++-

  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +3 -0
index 3b4eb8285943..2022ffbb8dba 100644
@@ -385,9 +385,11 @@ static u32 vega20_ih_get_wptr(struct 
 amdgpu_device *adev,
       u32 wptr, tmp;
       struct amdgpu_ih_regs *ih_regs;
   -    if (ih == &adev->irq.ih) {
+    if (ih == &adev->irq.ih || ih == &adev->irq.ih_soft) {
           /* Only ring0 supports writeback. On other rings fall back
            * to register-based code with overflow checking below.
+         * ih_soft ring doesn't have any backing hardware registers,
+         * update wptr and return.
            */
           wptr = le32_to_cpu(*ih->wptr_cpu);

  @@ -461,6 +463,9 @@ static void vega20_ih_set_rptr(struct amdgpu_device *adev, {
      struct amdgpu_ih_regs *ih_regs;
  +    if (ih == &adev->irq.ih_soft)
+        return;
+
      if (ih->use_doorbell) {
          /* XXX check if swapping is necessary on BE */ *ih->rptr_cpu = ih->rptr;

#5 lore raw

Am 15.08.22 um 17:16 schrieb Felix Kuehling:

Quoted 7 lines

Am 2022-08-14 um 13:27 schrieb Christian König:

Quoted 6 lines

Am 12.08.22 um 22:56 schrieb Mukul Joshi:

Quoted 4 lines

There are no backing hardware registers for ih_soft ring. As a result, don't try to access hardware registers for read and write pointers when processing interrupts on the IH soft ring.

Quoted 7 lines
Quoted 5 lines

Mhm, the original plan was to have different ih function for the rings but I think we just forgot to implement this fully.

When you do it this way you need to apply it to a bunch of different hw generation as Felix mentioned as well.

Might be easier to clean that up.

Right now ih_funcs cannot be different per ring. Are you suggesting moving the ih_funcs into the amdgpu_ih_ring structure?

IIRC we even discussed on that already and thought that would be the best approach.

It's just that nobody ever came around to do it.

Regards,
Christian.

Quoted 41 lines

Regards,
  Felix

Quoted 36 lines

Regards,
Christian.

Quoted 31 lines

---
  drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 7 ++++++-

  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +3 -0
index 3b4eb8285943..2022ffbb8dba 100644
@@ -385,9 +385,11 @@ static u32 vega20_ih_get_wptr(struct 
 amdgpu_device *adev,
       u32 wptr, tmp;
       struct amdgpu_ih_regs *ih_regs;
   -    if (ih == &adev->irq.ih) {
+    if (ih == &adev->irq.ih || ih == &adev->irq.ih_soft) {
           /* Only ring0 supports writeback. On other rings fall back
            * to register-based code with overflow checking below.
+         * ih_soft ring doesn't have any backing hardware registers,
+         * update wptr and return.
            */
           wptr = le32_to_cpu(*ih->wptr_cpu);

  @@ -461,6 +463,9 @@ static void vega20_ih_set_rptr(struct amdgpu_device *adev, {
      struct amdgpu_ih_regs *ih_regs;
  +    if (ih == &adev->irq.ih_soft)
+        return;
+
      if (ih->use_doorbell) {
          /* XXX check if swapping is necessary on BE */ *ih->rptr_cpu = ih->rptr;