Skip to contentSkip to conversation

pinctrl: amd: Clear interrupt enable on spurious IRQ and skip unhandled EOI

PATCH In review Munique Feitoza 4 participants 10 messages Oct 30 – Nov 6

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

PATCH 1/1 pinctrl: amd: Clear interrupt enable on spurious IRQ and skip unhandled EOI

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin status bit to keep re-asserting in WAKE_INT_STATUS_REG0/1. Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both main and RGPIO banks.

Additionally, if no GPIO interrupt was handled (ret == false), return early before acquiring gpio_dev->lock and writing EOI_MASK to WAKE_INT_MASTER_REG. This avoids unnecessary MMIO accesses and spinlock contention when the IRQ line is shared or asserted by an unhandled spurious interrupt storm.

---
 drivers/pinctrl/pinctrl-amd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-amd.c +5 -3
index 9fa752f55..428440949 100644
@@ -671,7 +671,8 @@ static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
 			raw_spin_lock_irqsave(&gpio_dev->lock, flags);
 			regval = readl(amd_gpio_pin_reg(gpio_dev, irqnr + i));
 			if (!gpiochip_line_is_irq(gc, irqnr + i)) {
-				regval &= ~BIT(INTERRUPT_MASK_OFF);
+				regval &= ~(BIT(INTERRUPT_MASK_OFF) |
+					    BIT(INTERRUPT_ENABLE_OFF));
 				dev_dbg(&gpio_dev->pdev->dev,
 					"Disabling spurious GPIO IRQ %d\n",
 					irqnr + i);
@@ -722,7 +723,8 @@ static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
 			raw_spin_lock_irqsave(&gpio_dev->lock, flags);
 			regval = readl(amd_gpio_pin_reg(gpio_dev, pin));
 			if (!gpiochip_line_is_irq(gc, pin)) {
-				regval &= ~BIT(INTERRUPT_MASK_OFF);
+				regval &= ~(BIT(INTERRUPT_MASK_OFF) |
+					    BIT(INTERRUPT_ENABLE_OFF));
 				dev_dbg(&gpio_dev->pdev->dev,
 					"Disabling spurious GPIO IRQ %d\n",
 					pin);
@@ -735,7 +737,7 @@ static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
 	}
 
 	/* did not cause wake on resume context for shared IRQ */
-	if (irq < 0)
+	if (irq < 0 || !ret)
 		return false;
 
 	/* Signal EOI to the GPIO unit */
Signature · 1 line
2.56.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] pinctrl: amd: missing EOI in do_amd_gpio_irq_handler() on spurious IRQ --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pinctrl: amd: missing EOI in do_amd_gpio_irq_handler() on spurious IRQ --

commit df92227f2b1cea5ec26fd7063440df3f2e4656a4
Author: Munique Feitoza <[email protected]>

pinctrl: amd: Clear interrupt enable on spurious IRQ and skip unhandled EOI

This commit clears BIT(INTERRUPT_ENABLE_OFF) alongside BIT(INTERRUPT_MASK_OFF) when disabling a spurious GPIO IRQ in do_amd_gpio_irq_handler(), and returns early before writing EOI_MASK to WAKE_INT_MASTER_REG when ret is false.

Quoted 25 lines
drivers/pinctrl/pinctrl-amd.c +4 -2
index 9fa752f552d43..42844094916a7 100644
@@ -671,7 +671,8 @@ static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
 			raw_spin_lock_irqsave(&gpio_dev->lock, flags);
 			regval = readl(amd_gpio_pin_reg(gpio_dev, irqnr + i));
 			if (!gpiochip_line_is_irq(gc, irqnr + i)) {
-				regval &= ~BIT(INTERRUPT_MASK_OFF);
+				regval &= ~(BIT(INTERRUPT_MASK_OFF) |
+					    BIT(INTERRUPT_ENABLE_OFF));
 				dev_dbg(&gpio_dev->pdev->dev,
 					"Disabling spurious GPIO IRQ %d\n",
 					irqnr + i);
@@ -722,7 +723,8 @@ static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
 			raw_spin_lock_irqsave(&gpio_dev->lock, flags);
 			regval = readl(amd_gpio_pin_reg(gpio_dev, pin));
 			if (!gpiochip_line_is_irq(gc, pin)) {
-				regval &= ~BIT(INTERRUPT_MASK_OFF);
+				regval &= ~(BIT(INTERRUPT_MASK_OFF) |
+					    BIT(INTERRUPT_ENABLE_OFF));
 				dev_dbg(&gpio_dev->pdev->dev,
 					"Disabling spurious GPIO IRQ %d\n",
 					pin);

drivers/pinctrl/pinctrl-amd.c static bool do_amd_gpio_irq_handler(int irq, void *dev_id) · line 741

Quoted 6 lines
drivers/pinctrl/pinctrl-amd.c +1 -1
@@ -735,7 +737,7 @@ static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
 	}
 
 	/* did not cause wake on resume context for shared IRQ */
-	if (irq < 0)
+	if (irq < 0 || !ret)
 		return false;

[Severity: High]
Does skipping the EOI write when !ret is true leave the AMD GPIO controller with an unacknowledged interrupt after a spurious GPIO IRQ?

When an unmasked pin raises an interrupt while gpiochip_line_is_irq() is false (for instance, at boot before a client driver such as i2c-hid probes as in commit d21b8adbd475 ("pinctrl: amd: Disable and mask interrupts on probe"), or after suspend/resume when firmware leaves an unused pin unmasked as in commit 0cf9e48ff22e ("pinctrl: amd: Disable and mask interrupts on resume")), do_amd_gpio_irq_handler() clears and disables the pin interrupt in the !gpiochip_line_is_irq() branch on the main or RGPIO bank without setting ret = true:

drivers/pinctrl/pinctrl-amd.c:do_amd_gpio_irq_handler() {
	...
			if (!gpiochip_line_is_irq(gc, irqnr + i)) {
				regval &= ~(BIT(INTERRUPT_MASK_OFF) |
					    BIT(INTERRUPT_ENABLE_OFF));
				dev_dbg(&gpio_dev->pdev->dev,
					"Disabling spurious GPIO IRQ %d\n",
					irqnr + i);
			} else {
				ret = true;
			}
			writel(regval, amd_gpio_pin_reg(gpio_dev, irqnr + i));
	...
}

If no other registered GPIO IRQ is active during the same invocation, ret remains false even though the AMD GPIO hardware asserted the interrupt line.

Returning early at if (irq < 0 || !ret) skips writing EOI_MASK to WAKE_INT_MASTER_REG:

	/* did not cause wake on resume context for shared IRQ */
	if (irq < 0 || !ret)
		return false;

	/* Signal EOI to the GPIO unit */
	raw_spin_lock_irqsave(&gpio_dev->lock, flags);
	regval = readl(gpio_dev->base + WAKE_INT_MASTER_REG);
	regval |= EOI_MASK;
	writel(regval, gpio_dev->base + WAKE_INT_MASTER_REG);
	raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);

Because the flow handlers used by amd_gpio_irqchip (handle_edge_irq, handle_level_irq, and handle_simple_irq) do not call .irq_eoi, do_amd_gpio_irq_handler() is the only place that signals EOI to the GPIO unit. Wouldn't skipping EOI_MASK after servicing a spurious GPIO interrupt prevent the controller from delivering subsequent valid GPIO interrupts?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw

PATCH v2 1/1 pinctrl: amd: Clear interrupt enable bit on spurious GPIO IRQ

In reply to Munique Feitoza

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin interrupt status bit to keep asserting in WAKE_INT_STATUS_REG0/1.

Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both the main and RGPIO banks.

---
Changes in v2:
- Drop the early return on !ret before writing EOI_MASK to WAKE_INT_MASTER_REG so that spurious GPIO interrupts disabled in the !gpiochip_line_is_irq() path still receive an EOI signal on the controller.

 drivers/pinctrl/pinctrl-amd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-amd.c +4 -2
index 9fa752f55..92a08f240 100644
@@ -671,7 +671,8 @@ static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
 			raw_spin_lock_irqsave(&gpio_dev->lock, flags);
 			regval = readl(amd_gpio_pin_reg(gpio_dev, irqnr + i));
 			if (!gpiochip_line_is_irq(gc, irqnr + i)) {
-				regval &= ~BIT(INTERRUPT_MASK_OFF);
+				regval &= ~(BIT(INTERRUPT_MASK_OFF) |
+					    BIT(INTERRUPT_ENABLE_OFF));
 				dev_dbg(&gpio_dev->pdev->dev,
 					"Disabling spurious GPIO IRQ %d\n",
 					irqnr + i);
@@ -722,7 +723,8 @@ static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
 			raw_spin_lock_irqsave(&gpio_dev->lock, flags);
 			regval = readl(amd_gpio_pin_reg(gpio_dev, pin));
 			if (!gpiochip_line_is_irq(gc, pin)) {
-				regval &= ~BIT(INTERRUPT_MASK_OFF);
+				regval &= ~(BIT(INTERRUPT_MASK_OFF) |
+					    BIT(INTERRUPT_ENABLE_OFF));
 				dev_dbg(&gpio_dev->pdev->dev,
 					"Disabling spurious GPIO IRQ %d\n",
 					pin);
Signature · 1 line
2.56.0
maintainer
#6 lore raw
In reply to Munique Feitoza
Quoted 9 lines · Munique Feitoza

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin status bit to keep re-asserting in WAKE_INT_STATUS_REG0/1. Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both main and RGPIO banks.

Quoted 7 lines

Additionally, if no GPIO interrupt was handled (ret == false), return early before acquiring gpio_dev->lock and writing EOI_MASK to WAKE_INT_MASTER_REG. This avoids unnecessary MMIO accesses and spinlock contention when the IRQ line is shared or asserted by an unhandled spurious interrupt storm.

Sashiko comments aside, we really need to put Mario on CC for AMD patches, Mario what about adding yourself to this MAINTAINERS entry:

PIN CONTROLLER - AMD

M:      Basavaraj Natikar <[email protected]>
M:      Shyam Sundar S K <[email protected]>
S:      Maintained
F:      drivers/pinctrl/pinctrl-amd.c

Yours,
Linus Walleij

maintainer
#3 lore raw

Re: [PATCH v2] pinctrl: amd: Clear interrupt enable bit on spurious GPIO IRQ

In reply to Munique Feitoza
Quoted 10 lines · Munique Feitoza

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin interrupt status bit to keep asserting in WAKE_INT_STATUS_REG0/1.

Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both the main and RGPIO banks.

Quoted 7 lines

---
Changes in v2:
- Drop the early return on !ret before writing EOI_MASK to WAKE_INT_MASTER_REG so that spurious GPIO interrupts disabled in the !gpiochip_line_is_irq() path still receive an EOI signal on the controller.

Loop in Mario on v2

Yours,
Linus Walleij

#4 lore raw

Re: [PATCH v2] pinctrl: amd: Clear interrupt enable bit on spurious GPIO IRQ

Hi Linus, Mario,

Adding Mario to CC as requested for v2.

Mario, could you please take a look at the v2 patch?

Best regards,
Munique

Quoted 26 lines · Linus Walleij
Quoted 10 lines · Munique Feitoza

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin interrupt status bit to keep asserting in WAKE_INT_STATUS_REG0/1.

Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both the main and RGPIO banks.

Quoted 7 lines

---
Changes in v2:
- Drop the early return on !ret before writing EOI_MASK to WAKE_INT_MASTER_REG so that spurious GPIO interrupts disabled in the !gpiochip_line_is_irq() path still receive an EOI signal on the controller.

Loop in Mario on v2

Yours,
Linus Walleij

#5 lore raw

Re: [PATCH v2] pinctrl: amd: Clear interrupt enable bit on spurious GPIO IRQ

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin interrupt status bit to keep asserting in WAKE_INT_STATUS_REG0/1.

Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both the main and RGPIO banks.

I'd like to understand more about this situation that lead you to this patch before we decide which way to go on the patch.

Was this just analyzing the code and looking for a code flow problem? Or do you have a real problem on a real system and came up with this to fix it?

#7 lore raw
In reply to Linus Walleij

Hi Mario,

This is a real issue observed on my desktop system during boot:

CPU: AMD Ryzen 5 5500
Motherboard: HA0QING A520 (BIOS 5.17)

During boot, the system experiences an interrupt storm on the AMD GPIO controller (IRQ 7), eventually triggering irq 7: nobody cared and leading the kernel to disable the IRQ line entirely:

´´´
irq 7: nobody cared (try booting with the "irqpoll" option)

CPU: 5 UID: 0 PID: 0 Comm: swapper/5 Not tainted 7.2.14-arch1-1 #1 PREEMPT(full)
Hardware name: HA0QING A520/A520, BIOS 5.17 04/02/2026
Call Trace:
 <IRQ>
 dump_stack_lvl+0x5d/0x80
 __report_bad_irq+0x35/0xaa
 note_interrupt.cold+0x1a/0x58
 handle_irq_event+0x72/0x90
 handle_fasteoi_irq+0xb6/0x1f0
 ...

handlers:
[<00000000d546c9c3>] amd_gpio_irq_handler
Disabling IRQ #7
´´´

Checking /proc/interrupts shows IRQ 7 (pinctrl_amd) accumulating around 200,000 unhandled interrupts on core 5 before being disabled.

When looking into do_amd_gpio_irq_handler(), pins that trigger an interrupt but are not registered as IRQ lines (!gpiochip_line_is_irq()) only have BIT(INTERRUPT_MASK_OFF) cleared while BIT(INTERRUPT_ENABLE_OFF) remains set. Clearing both bits stops the spurious interrupt status from re-asserting.

Best regards,
Munique Feitoza

Quoted 34 lines · Linus Walleij
Quoted 9 lines · Munique Feitoza

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin status bit to keep re-asserting in WAKE_INT_STATUS_REG0/1. Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both main and RGPIO banks.

Quoted 7 lines

Additionally, if no GPIO interrupt was handled (ret == false), return early before acquiring gpio_dev->lock and writing EOI_MASK to WAKE_INT_MASTER_REG. This avoids unnecessary MMIO accesses and spinlock contention when the IRQ line is shared or asserted by an unhandled spurious interrupt storm.

Sashiko comments aside, we really need to put Mario on CC for AMD patches, Mario what about adding yourself to this MAINTAINERS entry:

PIN CONTROLLER - AMD

M:      Basavaraj Natikar <[email protected]>
M:      Shyam Sundar S K <[email protected]>
S:      Maintained
F:      drivers/pinctrl/pinctrl-amd.c

Yours,
Linus Walleij

#8 lore raw
Quoted 31 lines · Munique Feitoza

Hi Mario,

This is a real issue observed on my desktop system during boot:

CPU: AMD Ryzen 5 5500
Motherboard: HA0QING A520 (BIOS 5.17)

During boot, the system experiences an interrupt storm on the AMD GPIO controller (IRQ 7), eventually triggering irq 7: nobody cared and leading the kernel to disable the IRQ line entirely:

´´´
irq 7: nobody cared (try booting with the "irqpoll" option)

CPU: 5 UID: 0 PID: 0 Comm: swapper/5 Not tainted 7.2.14-arch1-1 #1 PREEMPT(full)
Hardware name: HA0QING A520/A520, BIOS 5.17 04/02/2026
Call Trace:
  <IRQ>
  dump_stack_lvl+0x5d/0x80
  __report_bad_irq+0x35/0xaa
  note_interrupt.cold+0x1a/0x58
  handle_irq_event+0x72/0x90
  handle_fasteoi_irq+0xb6/0x1f0
  ...

handlers:
[<00000000d546c9c3>] amd_gpio_irq_handler
Disabling IRQ #7
´´´

Checking /proc/interrupts shows IRQ 7 (pinctrl_amd) accumulating around 200,000 unhandled interrupts on core 5 before being disabled.

Quoted 8 lines

When looking into do_amd_gpio_irq_handler(), pins that trigger an interrupt but are not registered as IRQ lines (!gpiochip_line_is_irq()) only have BIT(INTERRUPT_MASK_OFF) cleared while BIT(INTERRUPT_ENABLE_OFF) remains set. Clearing both bits stops the spurious interrupt status from re-asserting.

Best regards,
Munique Feitoza

Hi,

Thanks for confirming. Can you please share:
1) your full kernel log
2) an acpidump
3) /sys/kernel/debug/gpio

On a kernel bugzilla? I'd like to look at a few things.

At least this sure *sounds* like a floating GPIO.

Thanks,>

Quoted 35 lines · Linus Walleij
Quoted 34 lines
Quoted 9 lines · Munique Feitoza

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin status bit to keep re-asserting in WAKE_INT_STATUS_REG0/1. Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both main and RGPIO banks.

Quoted 7 lines

Additionally, if no GPIO interrupt was handled (ret == false), return early before acquiring gpio_dev->lock and writing EOI_MASK to WAKE_INT_MASTER_REG. This avoids unnecessary MMIO accesses and spinlock contention when the IRQ line is shared or asserted by an unhandled spurious interrupt storm.

Sashiko comments aside, we really need to put Mario on CC for AMD patches, Mario what about adding yourself to this MAINTAINERS entry:

PIN CONTROLLER - AMD

M:      Basavaraj Natikar <[email protected]>
M:      Shyam Sundar S K <[email protected]>
S:      Maintained
F:      drivers/pinctrl/pinctrl-amd.c

Yours,
Linus Walleij

#9 lore raw

Hi Mario,

Thanks! I've created Bugzilla ticket 222242 and attached the requested
files: https://bugzilla.kernel.org/show_bug.cgi?id=222242

Please let me know if you need any additional information or further debugging.

Best regards,
Munique

Quoted 91 lines · Mario Limonciello
Quoted 31 lines · Munique Feitoza

Hi Mario,

This is a real issue observed on my desktop system during boot:

CPU: AMD Ryzen 5 5500
Motherboard: HA0QING A520 (BIOS 5.17)

During boot, the system experiences an interrupt storm on the AMD GPIO controller (IRQ 7), eventually triggering irq 7: nobody cared and leading the kernel to disable the IRQ line entirely:

´´´
irq 7: nobody cared (try booting with the "irqpoll" option)

CPU: 5 UID: 0 PID: 0 Comm: swapper/5 Not tainted 7.2.14-arch1-1 #1 PREEMPT(full)
Hardware name: HA0QING A520/A520, BIOS 5.17 04/02/2026
Call Trace:
  <IRQ>
  dump_stack_lvl+0x5d/0x80
  __report_bad_irq+0x35/0xaa
  note_interrupt.cold+0x1a/0x58
  handle_irq_event+0x72/0x90
  handle_fasteoi_irq+0xb6/0x1f0
  ...

handlers:
[<00000000d546c9c3>] amd_gpio_irq_handler
Disabling IRQ #7
´´´

Checking /proc/interrupts shows IRQ 7 (pinctrl_amd) accumulating around 200,000 unhandled interrupts on core 5 before being disabled.

Quoted 8 lines

When looking into do_amd_gpio_irq_handler(), pins that trigger an interrupt but are not registered as IRQ lines (!gpiochip_line_is_irq()) only have BIT(INTERRUPT_MASK_OFF) cleared while BIT(INTERRUPT_ENABLE_OFF) remains set. Clearing both bits stops the spurious interrupt status from re-asserting.

Best regards,
Munique Feitoza

Hi,

Thanks for confirming. Can you please share:
1) your full kernel log
2) an acpidump
3) /sys/kernel/debug/gpio

On a kernel bugzilla? I'd like to look at a few things.

At least this sure *sounds* like a floating GPIO.

Thanks,>

Quoted 35 lines · Linus Walleij
Quoted 34 lines
Quoted 9 lines · Munique Feitoza

When do_amd_gpio_irq_handler() detects a spurious interrupt on a pin that is not configured as an IRQ line (!gpiochip_line_is_irq()), it currently only clears BIT(INTERRUPT_MASK_OFF) while leaving BIT(INTERRUPT_ENABLE_OFF) set. Unlike amd_gpio_irq_disable(), leaving INTERRUPT_ENABLE_OFF enabled allows the pin status bit to keep re-asserting in WAKE_INT_STATUS_REG0/1. Clear both INTERRUPT_MASK_OFF and INTERRUPT_ENABLE_OFF when disabling a spurious GPIO IRQ on both main and RGPIO banks.

Quoted 7 lines

Additionally, if no GPIO interrupt was handled (ret == false), return early before acquiring gpio_dev->lock and writing EOI_MASK to WAKE_INT_MASTER_REG. This avoids unnecessary MMIO accesses and spinlock contention when the IRQ line is shared or asserted by an unhandled spurious interrupt storm.

Sashiko comments aside, we really need to put Mario on CC for AMD patches, Mario what about adding yourself to this MAINTAINERS entry:

PIN CONTROLLER - AMD

M:      Basavaraj Natikar <[email protected]>
M:      Shyam Sundar S K <[email protected]>
S:      Maintained
F:      drivers/pinctrl/pinctrl-amd.c

Yours,
Linus Walleij