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 v2 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller
Date: Thu, 03 Dec 2026 19:07:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-248465@kernel.org> (raw)
In-Reply-To: <20261203-linux-7-4-rc4-pic64hpsc-nvm-intc-v2-2-a2621f8147bd@microchip.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] irqchip: pic64hpsc-nvm-intc: W1C STATUS cleared in irq_ack()
before handler
--
commit 2768ce3c4af3d3ef913407768bf27bb848e0d049
Author: Romain Caritey <romain.caritey@microchip.com>
irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller
This commit adds an irqchip driver for the Microchip PIC64-HPSC/HX NVM
interrupt controller, which aggregates NAND, xSPI, and eMMC/SD interrupts
onto a single parent APLIC line.
> 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..2dd6577aa6046
> --- /dev/null
> +++ b/drivers/irqchip/irq-mchp-pic64hpsc-nvm-intc.c
> @@ -0,0 +1,199 @@
[ ... ]
> +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 const struct irq_chip p64h_nvm_intc_irq_chip = {
> + .irq_print_chip = p64h_nvm_intc_irq_print_chip,
> + .irq_ack = p64h_nvm_intc_irq_ack,
> + .irq_mask = p64h_nvm_intc_irq_mask,
> + .irq_unmask = p64h_nvm_intc_irq_unmask,
> + .irq_set_type = p64h_nvm_intc_irq_set_type,
> +};
> +
> +static int p64h_nvm_intc_domain_map(struct irq_domain *domain, unsigned int virq,
> + irq_hw_number_t hwirq)
> +{
> + if (!p64h_nvm_intc_hwirq_is_valid(hwirq))
> + return -EINVAL;
> +
> + irq_set_chip_data(virq, domain->host_data);
> + irq_set_chip_and_handler(virq, &p64h_nvm_intc_irq_chip, handle_level_irq);
> + irq_set_noprobe(virq);
> +
> + return 0;
> +}
[ ... ]
> +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) & READ_ONCE(intc->enable);
> + if (!pending)
> + return IRQ_NONE;
[Severity: High]
As reported by Thomas Gleixner on v1 [1], can clearing the write-1-to-clear
P64H_NVM_INTC_STATUS register inside p64h_nvm_intc_irq_ack() break level-high
interrupts and leave stale masked bits unhandled?
handle_level_irq() calls mask_ack_irq() before handle_irq_event() services
the child peripheral, and only calls p64h_nvm_intc_irq_unmask() afterward.
If P64H_NVM_INTC_STATUS is level-latched, the bit remains set and triggers a
spurious interrupt on unmask (such as after a threaded IRQF_ONESHOT handler).
While a line is masked in P64H_NVM_INTC_ENABLE, p64h_nvm_intc_handler() also
returns IRQ_NONE without clearing or documenting whether a stale status bit
re-invokes the parent handler.
If P64H_NVM_INTC_STATUS is instead edge-latched, clearing it in irq_ack()
before the handler runs (or unconditionally in p64h_nvm_intc_probe()) drops
the latch while a level-high source remains asserted, losing the interrupt
because level IRQs are not software-resent.
Using handle_fasteoi_irq() with an irq_eoi callback and IRQCHIP_EOI_THREADED
would clear P64H_NVM_INTC_STATUS after the child handler deasserts the line,
and masked bits in P64H_NVM_INTC_STATUS should either be handled or
documented.
[1] https://lore.kernel.org/r/874icwpzlk.ffs@fw13
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-linux-7-4-rc4-pic64hpsc-nvm-intc-v2-0-a2621f8147bd@microchip.com?part=2
prev parent reply other threads:[~2026-12-03 19:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 18:15 [PATCH v2 0/2] Add support for Microchip PIC64-HPSC/HX NVM interrupt controller Charles Perry
2026-12-03 18:15 ` [PATCH v2 1/2] dt-bindings: interrupt-controller: document Microchip PIC64-HPSC/HX NVM intc Charles Perry
2026-12-03 18:43 ` sashiko-bot
2026-12-03 18:15 ` [PATCH v2 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller Charles Perry
2026-12-03 19:07 ` sashiko-bot [this message]
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-248465@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox