From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: sashiko-reviews@lists.linux.dev
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver
Date: Fri, 20 Nov 2026 17:24:07 +0100 [thread overview]
Message-ID: <87a4n3pj2w.fsf@BLaptop.bootlin.com> (raw)
In-Reply-To: <sashiko-outbox-217188@kernel.org>
Hello,
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] irqchip/eyeq5-msi: lost and unmasked interrupts in
> eyeq_msi_isr()
> --
>
> commit ecbaf749e93a909382eba764dafb43426071620b
> Author: Gregory CLEMENT <gregory.clement@bootlin.com>
>
> irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver
>
> This commit adds an irqchip driver for the Mobileye EyeQ5 PCIe MSI
> controller, supporting both root complex PCI MSI and endpoint platform MSI
> roles.
>
>> diff --git a/drivers/irqchip/irq-eyeq5-msi.c b/drivers/irqchip/irq-eyeq5-msi.c
>> new file mode 100644
>> index 0000000000000..823dfb0b00b5b
>> --- /dev/null
>> +++ b/drivers/irqchip/irq-eyeq5-msi.c
> [ ... ]
>> +static struct irq_chip eyeq_msi_irq_chip = {
>> + .name = "EyeQ5-MSI",
>> + .irq_mask = eyeq_msi_mask_irq,
>> + .irq_unmask = eyeq_msi_unmask_irq,
>> + .irq_ack = eyeq_msi_ack_irq,
>> + .irq_compose_msi_msg = eyeq_msi_compose_msg,
>> +#ifdef CONFIG_SMP
>> + .irq_set_affinity = irq_chip_redirect_set_affinity,
>> +#endif
>> +};
>> +
>> +static void eyeq_msi_isr(struct irq_desc *desc)
>> +{
>> + struct irq_chip *parent_chip = irq_desc_get_chip(desc);
>> + struct eyeq_msi *msi = irq_desc_get_handler_data(desc);
>> + void __iomem *status_reg;
>> + unsigned long pending;
>> + unsigned int bit;
>> +
>> + guard_chained_irq(parent_chip, desc);
>> +
>> + status_reg = msi->gcsr_base + GCSR_IRQSTATUS;
>> +
>> + while (true) {
>> + pending = FIELD_GET(GCSR_IRQSTATUS_MASK, readw(status_reg));
>> + if (!pending)
>> + break;
>> +
>> + /*
>> + * Write-one-to-clear status register.
>> + */
>> + writew(FIELD_PREP(GCSR_IRQSTATUS_MASK, pending), status_reg);
>> +
>> + for_each_set_bit(bit, &pending, EYEQ_MSI_MAX_VECTORS) {
>> + if (!generic_handle_demux_domain_irq(msi->msi_domain, bit))
>> + pr_err_ratelimited("unmapped MSI interrupt %u\n", bit);
>> + }
>> + }
>> +}
>
> [Severity: Medium]
> Can eyeq_msi_isr() lose interrupts that arrive while a vector is lazily
> disabled, and dispatch vectors that are masked in GCSR_IRQMASK?
>
> eyeq_msi_domain_alloc() sets handle_edge_irq without IRQ_DISABLE_UNLAZY or
> an .irq_disable callback. When an MSI arrives after disable_irq(),
> eyeq_msi_isr() clears its bit in GCSR_IRQSTATUS before handle_edge_irq()
> records IRQS_PENDING and masks GCSR_IRQMASK. Because eyeq_msi_irq_chip
> has no .irq_retrigger callback and neither EYEQ5_MSI nor MIPS selects
> HARDIRQS_SW_RESEND, enable_irq() -> check_irq_resend() cannot replay
> IRQS_PENDING and the interrupt is lost.
>
> In addition, eyeq_msi_isr() does not mask pending with the enabled bits in
> GCSR_IRQMASK before clearing GCSR_IRQSTATUS and calling
> generic_handle_demux_domain_irq(). If a masked vector latches in
> GCSR_IRQSTATUS, a sibling vector firing will clear and dispatch the masked
> vector (for example re-entering a masked IRQF_ONESHOT threaded handler,
> since handle_edge_irq() checks irq_can_handle() rather than
> irqd_irq_masked()), or repeated writes to a masked vector can keep the
> while (true) loop spinning.
>
I reused my MSI test setup and added a new test: on the host, a helper
disables one MSI-X vector, raises that MSI-X from the endpoint, then
enables the vector again and checks its count in /proc/interrupts. This
confirmed the lost-interrupt issue was real and let me write the fix.
Since there was no further comment, I will send a v5 with the fix soon.
Grégory
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261116-eyeq5_msi-v4-0-2e1233b014b0@bootlin.com?part=2
--
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-11-20 16:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 13:58 [PATCH v4 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT
2026-11-16 13:58 ` [PATCH v4 1/5] dt-bindings: interrupt-controller: add Mobileye " Gregory CLEMENT
2026-11-16 13:58 ` [PATCH v4 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver Gregory CLEMENT
2026-11-16 14:43 ` sashiko-bot
2026-11-20 16:24 ` Gregory CLEMENT [this message]
2026-11-16 13:58 ` [PATCH v4 3/5] MIPS: eyeq: select the EyeQ5 MSI controller Gregory CLEMENT
2026-11-16 13:58 ` [PATCH v4 4/5] MIPS: dts: eyeq5: add MSI controllers Gregory CLEMENT
2026-11-16 13:58 ` [PATCH v4 5/5] MAINTAINERS: add EyeQ5 MSI controller entry Gregory CLEMENT
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=87a4n3pj2w.fsf@BLaptop.bootlin.com \
--to=gregory.clement@bootlin.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.