Skip to contentSkip to conversation

drm/amdgpu/vcn: remove irq disabling in vcn 5 suspend

PATCH In review David (Ming Qiang) Wu 4 participants 6 messages May 9, 2024 – May 13, 2024

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

PATCH 1/1 drm/amdgpu/vcn: remove irq disabling in vcn 5 suspend

We do not directly enable/disable VCN IRQ in vcn 5.0.0. And we do not handle the IRQ state as well. So the calls to disable IRQ and set state are removed. This effectively gets rid of the warining of

      "WARN_ON(!amdgpu_irq_enabled(adev, src, type))"

in amdgpu_irq_put().

---
 drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 19 -------------------
 1 file changed, 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -19
index 851975b5ce29..9b87d6a49b39 100644
@@ -229,8 +229,6 @@ static int vcn_v5_0_0_hw_fini(void *handle)
 	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 		if (adev->vcn.harvest_config & (1 << i))
 			continue;
-
-		amdgpu_irq_put(adev, &adev->vcn.inst[i].irq, 0);
 	}
 
 	return 0;
@@ -1226,22 +1224,6 @@ static int vcn_v5_0_0_set_powergating_state(void *handle, enum amd_powergating_s
 	return ret;
 }
 
-/**
- * vcn_v5_0_0_set_interrupt_state - set VCN block interrupt state
- *
- * @adev: amdgpu_device pointer
- * @source: interrupt sources
- * @type: interrupt types
- * @state: interrupt states
- *
- * Set VCN block interrupt state
- */
-static int vcn_v5_0_0_set_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *source,
-	unsigned type, enum amdgpu_interrupt_state state)
-{
-	return 0;
-}
-
 /**
  * vcn_v5_0_0_process_interrupt - process VCN block interrupt
  *
@@ -1287,7 +1269,6 @@ static int vcn_v5_0_0_process_interrupt(struct amdgpu_device *adev, struct amdgp
 }
 
 static const struct amdgpu_irq_src_funcs vcn_v5_0_0_irq_funcs = {
-	.set = vcn_v5_0_0_set_interrupt_state,
 	.process = vcn_v5_0_0_process_interrupt,
 };
 
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 60 lines · David (Ming Qiang) Wu

We do not directly enable/disable VCN IRQ in vcn 5.0.0. And we do not handle the IRQ state as well. So the calls to disable IRQ and set state are removed. This effectively gets rid of the warining of

      "WARN_ON(!amdgpu_irq_enabled(adev, src, type))"

in amdgpu_irq_put().

---
 drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 19 -------------------
 1 file changed, 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -20
index 851975b5ce29..9b87d6a49b39 100644
@@ -229,8 +229,6 @@ static int vcn_v5_0_0_hw_fini(void *handle)
        for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
                if (adev->vcn.harvest_config & (1 << i))
                        continue;
-
-               amdgpu_irq_put(adev, &adev->vcn.inst[i].irq, 0);
        }
 
        return 0;
@@ -1226,22 +1224,6 @@ static int vcn_v5_0_0_set_powergating_state(void *handle, enum amd_powergating_s
        return ret;
 }
 
-/**
- * vcn_v5_0_0_set_interrupt_state - set VCN block interrupt state
- *
- * @adev: amdgpu_device pointer
- * @source: interrupt sources
- * @type: interrupt types
- * @state: interrupt states
- *
- * Set VCN block interrupt state
- */
-static int vcn_v5_0_0_set_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *source,
-       unsigned type, enum amdgpu_interrupt_state state)
-{
-       return 0;
-}
-
 /**
  * vcn_v5_0_0_process_interrupt - process VCN block interrupt
  *
@@ -1287,7 +1269,6 @@ static int vcn_v5_0_0_process_interrupt(struct amdgpu_device *adev, struct amdgp
 }
 
 static const struct amdgpu_irq_src_funcs vcn_v5_0_0_irq_funcs = {
-       .set = vcn_v5_0_0_set_interrupt_state,
        .process = vcn_v5_0_0_process_interrupt,
 };
 
--

2.34.1

maintainer
#2 lore raw
In reply to David (Ming Qiang) Wu

Am 09.05.24 um 20:40 schrieb David (Ming Qiang) Wu:

Quoted 17 lines

We do not directly enable/disable VCN IRQ in vcn 5.0.0. And we do not handle the IRQ state as well. So the calls to disable IRQ and set state are removed. This effectively gets rid of the warining of

       "WARN_ON(!amdgpu_irq_enabled(adev, src, type))"

in amdgpu_irq_put().

---
  drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 19 -------------------
  1 file changed, 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -0
index 851975b5ce29..9b87d6a49b39 100644

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c static int vcn_v5_0_0_hw_fini(void *handle) · line 232

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -2
@@ -229,8 +229,6 @@ static int vcn_v5_0_0_hw_fini(void *handle)
  	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
  		if (adev->vcn.harvest_config & (1 << i))
  			continue;
-
-		amdgpu_irq_put(adev, &adev->vcn.inst[i].irq, 0);
  	}

Looks like you can now remove the whole for loop.

Apart from that looks good to me,
Christian.

Quoted 33 lines
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -17
  	return 0;
@@ -1226,22 +1224,6 @@ static int vcn_v5_0_0_set_powergating_state(void *handle, enum amd_powergating_s
  	return ret;
  }
 
-/**
- * vcn_v5_0_0_set_interrupt_state - set VCN block interrupt state
- *
- * @adev: amdgpu_device pointer
- * @source: interrupt sources
- * @type: interrupt types
- * @state: interrupt states
- *
- * Set VCN block interrupt state
- */
-static int vcn_v5_0_0_set_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *source,
-	unsigned type, enum amdgpu_interrupt_state state)
-{
-	return 0;
-}
-
  /**
   * vcn_v5_0_0_process_interrupt - process VCN block interrupt
   *
@@ -1287,7 +1269,6 @@ static int vcn_v5_0_0_process_interrupt(struct amdgpu_device *adev, struct amdgp
  }
 
  static const struct amdgpu_irq_src_funcs vcn_v5_0_0_irq_funcs = {
-	.set = vcn_v5_0_0_set_interrupt_state,
  	.process = vcn_v5_0_0_process_interrupt,
  };
 
#3 lore raw
Quoted 15 lines · Christian König

Am 09.05.24 um 20:40 schrieb David (Ming Qiang) Wu:

Quoted 12 lines

We do not directly enable/disable VCN IRQ in vcn 5.0.0. And we do not handle the IRQ state as well. So the calls to disable IRQ and set state are removed. This effectively gets rid of the warining of "WARN_ON(!amdgpu_irq_enabled(adev, src, type))" in amdgpu_irq_put().

---
  drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 19 -------------------

  1 file changed, 19 deletions(-)
Quoted 13 lines

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c static int vcn_v5_0_0_hw_fini(void *handle) · line 232

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -2
index 851975b5ce29..9b87d6a49b39 100644
@@ -229,8 +229,6 @@ static int vcn_v5_0_0_hw_fini(void *handle)
       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
           if (adev->vcn.harvest_config & (1 << i))
               continue;
-
-        amdgpu_irq_put(adev, &adev->vcn.inst[i].irq, 0);
       }

Looks like you can now remove the whole for loop.

I realized that but there is a new patch added inside this loop to cover the suspend/resume issue.

Quoted 37 lines

Apart from that looks good to me,
Christian.

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -0
         return 0;
@@ -1226,22 +1224,6 @@ static int 

vcn_v5_0_0_set_powergating_state(void *handle, enum amd_powergating_s return ret;
  }
  -/**
- * vcn_v5_0_0_set_interrupt_state - set VCN block interrupt state
- *
- * @adev: amdgpu_device pointer
- * @source: interrupt sources
- * @type: interrupt types
- * @state: interrupt states
- *
- * Set VCN block interrupt state
- */
-static int vcn_v5_0_0_set_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *source,
-    unsigned type, enum amdgpu_interrupt_state state)

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -4
-{
-    return 0;
-}
-

  /**
   * vcn_v5_0_0_process_interrupt - process VCN block interrupt *

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -0
@@ -1287,7 +1269,6 @@ static int vcn_v5_0_0_process_interrupt(struct 

amdgpu_device *adev, struct amdgp
  }
    static const struct amdgpu_irq_src_funcs vcn_v5_0_0_irq_funcs = { -    .set = vcn_v5_0_0_set_interrupt_state,
      .process = vcn_v5_0_0_process_interrupt,
  };

maintainer
#4 lore raw

Am 13.05.24 um 19:41 schrieb David Wu:

Quoted 30 lines · Christian König
Quoted 15 lines

Am 09.05.24 um 20:40 schrieb David (Ming Qiang) Wu:

Quoted 12 lines

We do not directly enable/disable VCN IRQ in vcn 5.0.0. And we do not handle the IRQ state as well. So the calls to disable IRQ and set state are removed. This effectively gets rid of the warining of "WARN_ON(!amdgpu_irq_enabled(adev, src, type))" in amdgpu_irq_put().

---
  drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 19 -------------------

  1 file changed, 19 deletions(-)
Quoted 13 lines

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c static int vcn_v5_0_0_hw_fini(void *handle) · line 232

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -2
index 851975b5ce29..9b87d6a49b39 100644
@@ -229,8 +229,6 @@ static int vcn_v5_0_0_hw_fini(void *handle)
       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
           if (adev->vcn.harvest_config & (1 << i))
               continue;
-
-        amdgpu_irq_put(adev, &adev->vcn.inst[i].irq, 0);
       }

Looks like you can now remove the whole for loop.

Quoted 1 line

I realized that but there is a new patch added inside this loop to cover the suspend/resume issue.

Is that added in a later patch or did you rebased your patch ontop of it?

If it's added in a later patch then it's better to remove and re-add the lines. Otherwise you can get a mail from automated scripts that you have dead code.

Bit annoying but the documented way of doing things in the kernel.

Regards,
Christian.

Quoted 37 lines
Quoted 37 lines

Apart from that looks good to me,
Christian.

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -0
         return 0;
@@ -1226,22 +1224,6 @@ static int 

vcn_v5_0_0_set_powergating_state(void *handle, enum amd_powergating_s return ret;
  }
  -/**
- * vcn_v5_0_0_set_interrupt_state - set VCN block interrupt state
- *
- * @adev: amdgpu_device pointer
- * @source: interrupt sources
- * @type: interrupt types
- * @state: interrupt states
- *
- * Set VCN block interrupt state
- */
-static int vcn_v5_0_0_set_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *source,
-    unsigned type, enum amdgpu_interrupt_state state)

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -4
-{
-    return 0;
-}
-

  /**
   * vcn_v5_0_0_process_interrupt - process VCN block interrupt *

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -0
@@ -1287,7 +1269,6 @@ static int vcn_v5_0_0_process_interrupt(struct 

amdgpu_device *adev, struct amdgp
  }
    static const struct amdgpu_irq_src_funcs vcn_v5_0_0_irq_funcs = { -    .set = vcn_v5_0_0_set_interrupt_state,
      .process = vcn_v5_0_0_process_interrupt,
  };

#5 lore raw
Quoted 31 lines · Christian König

Am 13.05.24 um 19:41 schrieb David Wu:

Quoted 30 lines · Christian König
Quoted 28 lines

Am 09.05.24 um 20:40 schrieb David (Ming Qiang) Wu:

Quoted 17 lines

We do not directly enable/disable VCN IRQ in vcn 5.0.0. And we do not handle the IRQ state as well. So the calls to disable IRQ and set state are removed. This effectively gets rid of the warining of "WARN_ON(!amdgpu_irq_enabled(adev, src, type))" in amdgpu_irq_put().

---
  drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 19 -------------------

  1 file changed, 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -0
index 851975b5ce29..9b87d6a49b39 100644

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c static int vcn_v5_0_0_hw_fini(void *handle) · line 232

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -2
@@ -229,8 +229,6 @@ static int vcn_v5_0_0_hw_fini(void *handle)
       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
           if (adev->vcn.harvest_config & (1 << i))
               continue;
-
-        amdgpu_irq_put(adev, &adev->vcn.inst[i].irq, 0);
       }

Looks like you can now remove the whole for loop.

Quoted 7 lines
Quoted 1 line

I realized that but there is a new patch added inside this loop to cover the suspend/resume issue.

Is that added in a later patch or did you rebased your patch ontop of it?

If it's added in a later patch then it's better to remove and re-add the lines. Otherwise you can get a mail from automated scripts that you have dead code.

Bit annoying but the documented way of doing things in the kernel.

understood - it is added in the next patch right after this one - so far I have not got an email for the dead code yet. If it raises an issue I will  work on it.

Quoted 42 lines

Regards,
Christian.

Quoted 37 lines
Quoted 37 lines

Apart from that looks good to me,
Christian.

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -0
         return 0;
@@ -1226,22 +1224,6 @@ static int 

vcn_v5_0_0_set_powergating_state(void *handle, enum amd_powergating_s return ret;
  }
  -/**
- * vcn_v5_0_0_set_interrupt_state - set VCN block interrupt state
- *
- * @adev: amdgpu_device pointer
- * @source: interrupt sources
- * @type: interrupt types
- * @state: interrupt states
- *
- * Set VCN block interrupt state
- */
-static int vcn_v5_0_0_set_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *source,
-    unsigned type, enum amdgpu_interrupt_state state)

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -4
-{
-    return 0;
-}
-

  /**
   * vcn_v5_0_0_process_interrupt - process VCN block interrupt *

drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +0 -0
@@ -1287,7 +1269,6 @@ static int 

vcn_v5_0_0_process_interrupt(struct amdgpu_device *adev, struct amdgp }
    static const struct amdgpu_irq_src_funcs vcn_v5_0_0_irq_funcs = { -    .set = vcn_v5_0_0_set_interrupt_state,
      .process = vcn_v5_0_0_process_interrupt,
  };