Skip to contentSkip to conversation

crypto: amlogic: Fix IRQ handler return value and fallthrough logic

PATCH In review Mohamad Raizudeen 2 participants 2 messages Sep 18 – Sep 23

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

PATCH v3 1/1 crypto: amlogic: Fix IRQ handler return value and fallthrough logic

In meson_irq_handler(), when an interrupt matches a flow but the status register is empty, the driver prints an error but doesn't return. It falls through the loop and incorrectly prints an unknown irq message.

Fix this by returning immediately. For empty status registers, return IRQ_NONE instead of IRQ_HANDLED to avoid masking spurious interrupts and allow the kernel to detect interrupt storms. Also use dev_err_ratelimited() to prevent console lockups during an interrupt storm.

Additionally, the handler returned IRQ_HANDLED for genuinely unknown interrupts. Return IRQ_NONE instead for unhandled interrupts.

Fixes 48fe583fe5417 ("crypto: amlogic - Add crypto accelerator for amlogic GXL")

---
I have addressed the IRQ specific issues in this v3. The other pre-exisiting issues mentioned by Sashiko are already addressed in my separate patch.

Changes in v3:
- Revert accidental clock management changes that were squashed into v2.

Changes in v2:
- Return IRQ_NONE instead of IRQ_HANDLED when status register is empty to avoid masking spurious interrupts.
- Use dev_err_ratelimited() to prevent console lockups.

Link to v2: https://lore.kernel.org/all/[email protected]/T/

 drivers/crypto/amlogic/amlogic-gxl-core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/amlogic/amlogic-gxl-core.c +4 -3
index 169c6eeb51e5..09d3ccd92b80 100644
@@ -37,12 +37,13 @@ static irqreturn_t meson_irq_handler(int irq, void *data)
 				complete(&mc->chanlist[flow].complete);
 				return IRQ_HANDLED;
 			}
-			dev_err(mc->dev, "%s %d Got irq for flow %d but ctrl is empty\n", __func__, irq, flow);
+			dev_err_ratelimited(mc->dev, "%s %d Got irq for flow %d but ctrl is empty\n", __func__, irq, flow);
+			return IRQ_NONE;
 		}
 	}
 
-	dev_err(mc->dev, "%s %d from unknown irq\n", __func__, irq);
-	return IRQ_HANDLED;
+	dev_err_ratelimited(mc->dev, "%s %d from unknown irq\n", __func__, irq);
+	return IRQ_NONE;
 }
 
 static struct meson_alg_template mc_algs[] = {
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 29 lines · Mohamad Raizudeen

In meson_irq_handler(), when an interrupt matches a flow but the status register is empty, the driver prints an error but doesn't return. It falls through the loop and incorrectly prints an unknown irq message.

Fix this by returning immediately. For empty status registers, return IRQ_NONE instead of IRQ_HANDLED to avoid masking spurious interrupts and allow the kernel to detect interrupt storms. Also use dev_err_ratelimited() to prevent console lockups during an interrupt storm.

Additionally, the handler returned IRQ_HANDLED for genuinely unknown interrupts. Return IRQ_NONE instead for unhandled interrupts.

Fixes 48fe583fe5417 ("crypto: amlogic - Add crypto accelerator for amlogic GXL")

---
I have addressed the IRQ specific issues in this v3. The other pre-exisiting issues mentioned by Sashiko are already addressed in my separate patch.

Changes in v3:
- Revert accidental clock management changes that were squashed into v2.

Changes in v2:
- Return IRQ_NONE instead of IRQ_HANDLED when status register is empty to avoid masking spurious interrupts.
- Use dev_err_ratelimited() to prevent console lockups.

Quoted 4 lines

Link to v2: https://lore.kernel.org/all/[email protected]/T/

 drivers/crypto/amlogic/amlogic-gxl-core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt