* [PATCH] pinctrl: amd: Clear interrupt enable on spurious IRQ and skip unhandled EOI
@ 2026-10-30 19:50 Munique Feitoza
2026-10-30 20:08 ` [PATCH v2] pinctrl: amd: Clear interrupt enable bit on spurious GPIO IRQ Munique Feitoza
0 siblings, 1 reply; 2+ messages in thread
From: Munique Feitoza @ 2026-10-30 19:50 UTC (permalink / raw)
To: Basavaraj Natikar, Shyam Sundar S K, Linus Walleij
Cc: linux-gpio, linux-kernel, 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.
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.
Signed-off-by: Munique Feitoza <muniquefeitoz4@gmail.com>
---
drivers/pinctrl/pinctrl-amd.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index 9fa752f55..428440949 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -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 */
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH v2] pinctrl: amd: Clear interrupt enable bit on spurious GPIO IRQ
2026-10-30 19:50 [PATCH] pinctrl: amd: Clear interrupt enable on spurious IRQ and skip unhandled EOI Munique Feitoza
@ 2026-10-30 20:08 ` Munique Feitoza
0 siblings, 0 replies; 2+ messages in thread
From: Munique Feitoza @ 2026-10-30 20:08 UTC (permalink / raw)
To: Basavaraj Natikar, Shyam Sundar S K, Linus Walleij
Cc: linux-gpio, linux-kernel, sashiko-bot, 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.
Signed-off-by: Munique Feitoza <muniquefeitoz4@gmail.com>
---
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(-)
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index 9fa752f55..92a08f240 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -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);
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-30 20:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 19:50 [PATCH] pinctrl: amd: Clear interrupt enable on spurious IRQ and skip unhandled EOI Munique Feitoza
2026-10-30 20:08 ` [PATCH v2] pinctrl: amd: Clear interrupt enable bit on spurious GPIO IRQ Munique Feitoza
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®