From: sashiko-bot@kernel.org
To: "Charles Perry" <charles.perry@microchip.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller
Date: Tue, 01 Dec 2026 16:21:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-243677@kernel.org> (raw)
In-Reply-To: <20261201-linux-7-4-rc4-pic64hpsc-nvm-intc-v1-2-e87ed786dc1b@microchip.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] irqchip: pic64hpsc-nvm-intc: premature STATUS clear loses level
IRQs
--
commit 73f24bc314fe5e84231bc25d702188d9731ab0ca
Author: Romain Caritey <romain.caritey@microchip.com>
irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller
This commit adds an irqchip driver for the local NVM interrupt controller
found on Microchip PIC64-HPSC and PIC64-HX SoCs.
> diff --git a/drivers/irqchip/irq-mchp-pic64hpsc-nvm-intc.c b/drivers/irqchip/irq-mchp-pic64hpsc-nvm-intc.c
> new file mode 100644
> index 0000000000000..84e4cfdbc5e7f
> --- /dev/null
> +++ b/drivers/irqchip/irq-mchp-pic64hpsc-nvm-intc.c
[ ... ]
> +static void p64h_nvm_intc_irq_ack(struct irq_data *d)
> +{
> + struct p64h_nvm_intc *intc = irq_data_get_irq_chip_data(d);
> +
> + writel(BIT(d->hwirq), intc->base + P64H_NVM_INTC_STATUS);
> +}
> +
> +static void p64h_nvm_intc_irq_mask(struct irq_data *d)
> +{
> + struct p64h_nvm_intc *intc = irq_data_get_irq_chip_data(d);
> +
> + p64h_nvm_intc_update_enable(intc, BIT(d->hwirq), 0);
> +}
> +
> +static void p64h_nvm_intc_irq_unmask(struct irq_data *d)
> +{
> + struct p64h_nvm_intc *intc = irq_data_get_irq_chip_data(d);
> +
> + p64h_nvm_intc_update_enable(intc, 0, BIT(d->hwirq));
> +}
[ ... ]
> +static irqreturn_t p64h_nvm_intc_handler(int irq, void *data)
> +{
> + struct p64h_nvm_intc *intc = data;
> + unsigned long pending;
> + unsigned int hwirq;
> +
> + pending = readl(intc->base + P64H_NVM_INTC_STATUS) &
> + readl(intc->base + P64H_NVM_INTC_ENABLE) &
> + P64H_NVM_INTC_VALID_MASK;
> +
> + if (!pending)
> + return IRQ_NONE;
> +
> + /*
> + * STATUS may hold a stale edge, already handled while masked.
> + * Clear it, then dispatch only the sources whose line is still high.
> + */
> + writel(pending, intc->base + P64H_NVM_INTC_STATUS);
> +
> + pending &= readl(intc->base + P64H_NVM_INTC_VALUE);
> +
> + for_each_set_bit(hwirq, &pending, P64H_NVM_INTC_NUM_IRQS)
> + generic_handle_domain_irq(intc->domain, hwirq);
> +
> + return IRQ_HANDLED;
> +}
[Severity: High]
Can clearing P64H_NVM_INTC_STATUS before the child device deasserts its
level-high interrupt line permanently lose level interrupts?
From the comment and handling in p64h_nvm_intc_handler(),
P64H_NVM_INTC_VALUE reflects the live level of the child lines, whereas
P64H_NVM_INTC_STATUS latches rising edges and gates the parent APLIC line
together with P64H_NVM_INTC_ENABLE. However, P64H_NVM_INTC_STATUS is
cleared in p64h_nvm_intc_handler() and again in p64h_nvm_intc_irq_ack() via
handle_level_irq() -> mask_ack_irq() before the child handler services the
device, while the child line in P64H_NVM_INTC_VALUE is still high.
If the child line stays continuously high without dropping low and rising
again (for example, when a controller has another pending event keeping its
line asserted after handle_irq_event(), or when handle_level_irq() bails
out at !irq_can_handle(desc) while the IRQ is disabled),
P64H_NVM_INTC_STATUS remains 0 when p64h_nvm_intc_irq_unmask() re-enables
the line, and the interrupt never fires again. Unconditionally clearing
P64H_NVM_INTC_STATUS in p64h_nvm_intc_probe() has the same problem for any
child line already asserted high at probe time.
Conversely, if a transient edge latches into P64H_NVM_INTC_STATUS while the
child IRQ is masked (such as during an IRQF_ONESHOT threaded handler) and
is already cleared at the device before unmasking, p64h_nvm_intc_irq_unmask()
leaves the stale bit set in P64H_NVM_INTC_STATUS, immediately triggering a
spurious parent interrupt where pending &= readl(... + P64H_NVM_INTC_VALUE)
is 0.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-linux-7-4-rc4-pic64hpsc-nvm-intc-v1-0-e87ed786dc1b@microchip.com?part=2
next prev parent reply other threads:[~2026-12-01 16:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 16:06 [PATCH 0/2] Add support for Microchip PIC64-HPSC/HX NVM interrupt controller Charles Perry
2026-12-01 16:06 ` [PATCH 1/2] dt-bindings: interrupt-controller: document Microchip PIC64-HPSC/HX NVM intc Charles Perry
2026-12-01 18:13 ` Conor Dooley
2026-12-01 16:06 ` [PATCH 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller Charles Perry
2026-12-01 16:21 ` sashiko-bot [this message]
2026-12-01 19:31 ` Thomas Gleixner
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=sashiko-outbox-243677@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=charles.perry@microchip.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.