From: Munique Feitoza <muniquefeitoz4@gmail.com>
To: Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
Linus Walleij <linusw@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Munique Feitoza <muniquefeitoz4@gmail.com>
Subject: [PATCH] pinctrl: amd: Clear interrupt enable on spurious IRQ and skip unhandled EOI
Date: Fri, 30 Oct 2026 16:50:25 -0300 [thread overview]
Message-ID: <20261030195025.5153-1-muniquefeitoz4@gmail.com> (raw)
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
next reply other threads:[~2026-10-30 19:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 19:50 Munique Feitoza [this message]
2026-10-30 20:02 ` [PATCH] pinctrl: amd: Clear interrupt enable on spurious IRQ and skip unhandled EOI sashiko-bot
2026-10-30 20:08 ` [PATCH v2] pinctrl: amd: Clear interrupt enable bit on spurious GPIO IRQ Munique Feitoza
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261030195025.5153-1-muniquefeitoz4@gmail.com \
--to=muniquefeitoz4@gmail.com \
--cc=Basavaraj.Natikar@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.