* [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller
@ 2026-12-03 15:09 Gregory CLEMENT
2026-12-03 15:09 ` [PATCH v6 1/5] dt-bindings: interrupt-controller: add Mobileye " Gregory CLEMENT
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Gregory CLEMENT @ 2026-12-03 15:09 UTC (permalink / raw)
To: Vladimir Kondratiev, Benoît Monin, Théo Lebrun,
Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Thomas Bogendoerfer
Cc: Thomas Petazzoni, linux-mips, linux-kernel, devicetree,
Gregory CLEMENT
Hello,
This series adds support for the MSI controller present in the
Mobileye EyeQ5 PCIe ports.
Although the driver uses the standard MSI library, the EyeQ5 hardware
has several specific features. First, each PCIe port has its own MSI
controller, which snoops the MSI write TLPs that the port receives. A
port supports a maximum of 4 MSI vectors, and the memory-region
property gives the base address of the doorbell window. In addition,
the GCSR mode selects the role: in root complex mode the driver
registers a PCI MSI parent, while in endpoint mode it registers a
platform MSI parent. The last specific point is that the driver uses
the snooper domain as a chained controller on one GIC interrupt.
The series adds the binding document, the irqchip driver, the EyeQ5
DTS changes, and the MAINTAINERS entry. In particular, the DTS changes
add the two MSI controllers to the EyeQ5 SoC.
I tested the series on two EyeQ5 SoCs that have a PCIe link. One SoC
acted as the host and the other SoC acted as the endpoint. The
pci_endpoint_test kselftest passed the MSI-X and DOORBELL_TEST cases.
The MSI test uses one vector because the controller does not support
standard Multi-MSI. An additional test made sure that each MSI-X vector
uses its target CPU (using affinity).
This sixth series addresses the ACK/disable_irq() race reported by Thomas
Gleixner. The MSI is now acknowledged from the irq_chip callback under
desc->lock instead of clearing GCSR_IRQSTATUS in the chained handler, so a
concurrent disable_irq() can no longer clear a status bit that must stay
latched. A dedicated race test reproduces the loss on v5 and passes with
this change.
Grégory
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
Changes in v6:
- irqchip: address the ACK path review from Thomas Gleixner:
- acknowledge from the irq_chip callback under desc->lock instead of
write-one-to-clearing GCSR_IRQSTATUS in the chained handler, so a
concurrent disable_irq() cannot clear a status bit that must stay
latched;
- skip the acknowledge while the vector is disabled so the hardware
retriggers it on unmask;
- drop the bulk acknowledge and only mask and acknowledge unmapped
vectors under the controller lock;
- cache GCSR_IRQMASK and dispatch from a lockless READ_ONCE() snapshot;
- move the per-iteration declarations into the loop scope.
- irqchip: delegate the acknowledge to the parent irq_data with
MSI_CHIP_FLAG_SET_ACK, so the callback gets the right chip_data/hwirq.
- The issue was reproduced with a dedicated MSI race test on EyeQ5
hardware, and the same test passes with this revision.
- Link to v5: https://patch.msgid.link/20261125-eyeq5_msi-v5-0-72346cd10736@bootlin.com
Changes in v5:
- irqchip: fix the MSI loss. Mask the vector on disable_irq() with
IRQ_DISABLE_UNLAZY so the MSI stays pending in GCSR_IRQSTATUS until
enable_irq(). (sashiko)
- irqchip: filter GCSR_IRQSTATUS with GCSR_IRQMASK in eyeq_msi_isr()
so a masked vector is not dispatched when a sibling fires. (sashiko)
- irqchip: clear GCSR_IRQSTATUS on vector alloc and free, so a reused
vector does not deliver a stale MSI to its new owner.
- irqchip: program the hardware before creating the IRQ domain, so no
vector can be allocated before the hardware is ready.
- irqchip: bound the ISR loop, so a device that keeps setting a vector
cannot hang a CPU.
- Link to v4: https://patch.msgid.link/20261116-eyeq5_msi-v4-0-2e1233b014b0@bootlin.com
Changes in v4:
- irqchip: use a plain raw_spinlock() in the mask/unmask callbacks, which
run with interrupts disabled.
- irqchip: use guard_chained_irq() to balance the chained handler on every
return path.
- irqchip: simplify the domain alloc/free callbacks now that nr_irqs is
always 1.
- irqchip: reformat the MSI flag macros and use a distinct "EYEQ-P-" prefix
for the platform MSI parent.
- MIPS: move the EYEQ5_MSI selection into a separate MIPS patch, out of the
irqchip driver patch.
- Link to v3: https://patch.msgid.link/20261104-eyeq5_msi-v3-0-2866f732cd38@bootlin.com
Changes in v3:
- Address review comments from sashiko.
- dt-bindings: drop the interrupt-controller, #interrupt-cells and label
properties.
- irqchip: use handle_edge_irq() with an ack callback instead of
handle_simple_irq(), so a vector is masked while disabled and a second
MSI is not lost while the first is in progress. For this one, I ran
some tests to confirm that the issue was real (it was) and that the fix
resolves it.
- irqchip: convert to a platform driver because the node is no longer an
interrupt controller and is no longer probed by of_irq_init().
- irqchip: stop parsing the label property and use the node full name in
the boot message.
- MIPS: dts: update the MSI nodes according to the binding changes.
- Link to v2: https://patch.msgid.link/20261102-eyeq5_msi-v2-0-4aa3d3608064@bootlin.com
Changes in v2:
- Address review comments from Krzysztof Kozlowski, Thomas Gleixner and
sashiko.
- dt-bindings: drop the num-vectors property (all ports have four
vectors) and simplify the example.
- irqchip: use the fixed four-vector count, add lockdep assertions, and
dispatch through generic_handle_demux_domain_irq() with a redirect-based
irq_set_affinity() callback.
- irqchip: drop MSI_FLAG_MULTI_PCI_MSI (standard Multi-MSI cannot work
with the address-based vector decoding) and MSI_FLAG_NO_AFFINITY; add
MSI_FLAG_PCI_MSI_MASK_PARENT.
- irqchip: keep vectors masked during allocation, mask all vectors and
clear pending status before installing the chained handler, and reject
of_irq_get() returning 0.
- MIPS: dts: drop the num-vectors property from both MSI nodes.
- Reformat the driver for the 100-column limit.
- Link to v1: https://patch.msgid.link/20261028-eyeq5_msi-v1-0-c464752fb55f@bootlin.com
To: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
To: Benoît Monin <benoit.monin@bootlin.com>
To: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Théo Lebrun <theo.lebrun@bootlin.com>
To: Thomas Gleixner <tglx@kernel.org>
To: Radu Rendec <radu@rendec.net>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org
---
Gregory CLEMENT (5):
dt-bindings: interrupt-controller: add Mobileye EyeQ5 PCIe MSI controller
irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver
MIPS: eyeq: select the EyeQ5 MSI controller
MIPS: dts: eyeq5: add MSI controllers
MAINTAINERS: add EyeQ5 MSI controller entry
.../interrupt-controller/mobileye,eyeq5-msi.yaml | 76 ++++
MAINTAINERS | 2 +
arch/mips/Kconfig | 1 +
arch/mips/boot/dts/mobileye/eyeq5.dtsi | 22 +
drivers/irqchip/Kconfig | 5 +
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-eyeq5-msi.c | 465 +++++++++++++++++++++
7 files changed, 572 insertions(+)
---
base-commit: 08b814ca0a6945b8effc1a0d64999d562f24c923
change-id: 20261028-eyeq5_msi-86aa1d590684
Best regards,
--
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v6 1/5] dt-bindings: interrupt-controller: add Mobileye EyeQ5 PCIe MSI controller 2026-12-03 15:09 [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT @ 2026-12-03 15:09 ` Gregory CLEMENT 2026-12-03 15:09 ` [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver Gregory CLEMENT ` (4 subsequent siblings) 5 siblings, 0 replies; 10+ messages in thread From: Gregory CLEMENT @ 2026-12-03 15:09 UTC (permalink / raw) To: Vladimir Kondratiev, Benoît Monin, Théo Lebrun, Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer Cc: Thomas Petazzoni, linux-mips, linux-kernel, devicetree, Gregory CLEMENT Add binding for the Mobileye EyeQ5 PCIe MSI controller. Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- .../interrupt-controller/mobileye,eyeq5-msi.yaml | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/Documentation/devicetree/bindings/interrupt-controller/mobileye,eyeq5-msi.yaml b/Documentation/devicetree/bindings/interrupt-controller/mobileye,eyeq5-msi.yaml new file mode 100644 index 0000000000000..e41a92aec3b8e --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/mobileye,eyeq5-msi.yaml @@ -0,0 +1,76 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/mobileye,eyeq5-msi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mobileye EyeQ5 PCIe MSI controller + +maintainers: + - Gregory CLEMENT <gregory.clement@bootlin.com> + +description: | + The Mobileye EyeQ5 PCIe MSI controller snoops the MSI write TLPs of a + PCIe port. The controller signals the parent interrupt controller when a + vector is pending. The memory-region property gives the base address of + the doorbell window. A port supports a maximum of 4 MSI vectors. + + This node is an MSI parent for the PCIe port. The driver chains the + controller interrupt to the parent interrupt controller. + +allOf: + - $ref: /schemas/interrupt-controller/msi-controller.yaml# + +properties: + compatible: + const: mobileye,eyeq5-msi + + reg: + items: + - description: GCSR block of the PCIe port + - description: MSI vector control block + + interrupts: + maxItems: 1 + + msi-controller: true + + '#msi-cells': + const: 0 + + memory-region: + maxItems: 1 + description: + Reserved-memory region. The hardware uses its base address as the MSI + doorbell window. + +required: + - compatible + - reg + - interrupts + - msi-controller + - '#msi-cells' + - memory-region + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/mips-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + msi-controller@5840000 { + compatible = "mobileye,eyeq5-msi"; + reg = <0x0 0x05840000 0x0 0x10>, + <0x0 0x05840040 0x0 0x20>; + interrupt-parent = <&gic>; + interrupts = <GIC_SHARED 7 IRQ_TYPE_LEVEL_HIGH>; + msi-controller; + #msi-cells = <0>; + memory-region = <&pci0_msi_reserved>; + }; + }; -- 2.53.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver 2026-12-03 15:09 [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT 2026-12-03 15:09 ` [PATCH v6 1/5] dt-bindings: interrupt-controller: add Mobileye " Gregory CLEMENT @ 2026-12-03 15:09 ` Gregory CLEMENT 2026-12-03 15:51 ` sashiko-bot 2026-12-03 15:09 ` [PATCH v6 3/5] MIPS: eyeq: select the EyeQ5 MSI controller Gregory CLEMENT ` (3 subsequent siblings) 5 siblings, 1 reply; 10+ messages in thread From: Gregory CLEMENT @ 2026-12-03 15:09 UTC (permalink / raw) To: Vladimir Kondratiev, Benoît Monin, Théo Lebrun, Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer Cc: Thomas Petazzoni, linux-mips, linux-kernel, devicetree, Gregory CLEMENT Each EyeQ5 PCIe port has its own MSI controller. The controller snoops the MSI write TLPs that the port receives. It raises an interrupt when a write targets the doorbell window. A port supports a maximum of 4 MSI vectors. The driver supports two roles, selected by the GCSR mode. In root complex mode, it registers a PCI MSI parent. In endpoint mode, it registers a platform MSI parent. The driver chains the snooper domain to one GIC interrupt. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- drivers/irqchip/Kconfig | 5 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-eyeq5-msi.c | 465 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 471 insertions(+) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 90daedb7554ae..5d5a2e31d5eab 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -827,6 +827,11 @@ config APPLE_AIC Support for the Apple Interrupt Controller found on Apple Silicon SoCs, such as the M1. +config EYEQ5_MSI + bool + select IRQ_DOMAIN + select IRQ_MSI_LIB + config MCHP_EIC bool "Microchip External Interrupt Controller" depends on ARCH_AT91 || COMPILE_TEST diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index eb539d41251e2..4b96194e70b72 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -132,6 +132,7 @@ obj-$(CONFIG_MACH_REALTEK_RTL) += irq-realtek-rtl.o obj-$(CONFIG_WPCM450_AIC) += irq-wpcm450-aic.o obj-$(CONFIG_IRQ_IDT3243X) += irq-idt3243x.o obj-$(CONFIG_APPLE_AIC) += irq-apple-aic.o +obj-$(CONFIG_EYEQ5_MSI) += irq-eyeq5-msi.o obj-$(CONFIG_MCHP_EIC) += irq-mchp-eic.o obj-$(CONFIG_SOPHGO_SG2042_MSI) += irq-sg2042-msi.o obj-$(CONFIG_SUNPLUS_SP7021_INTC) += irq-sp7021-intc.o diff --git a/drivers/irqchip/irq-eyeq5-msi.c b/drivers/irqchip/irq-eyeq5-msi.c new file mode 100644 index 0000000000000..3d50f13d7c9dd --- /dev/null +++ b/drivers/irqchip/irq-eyeq5-msi.c @@ -0,0 +1,465 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Mobileye EyeQ5 MSI interrupt controller + * + * Copyright Mobileye (2026) + */ + +#define pr_fmt(fmt) "eyeq5-msi: " fmt + +#include <linux/bitfield.h> +#include <linux/bitmap.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/irq.h> +#include <linux/irqchip.h> +#include <linux/irqchip/chained_irq.h> +#include <linux/irqchip/irq-msi-lib.h> +#include <linux/irqdomain.h> +#include <linux/msi.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/slab.h> +#include <linux/spinlock.h> + +/* + * The snooper decodes the vector number from TLP address bits [4:3], so a + * port can serve at most 4 vectors. + */ +#define EYEQ_MSI_MAX_VECTORS 4 + +/* + * Vector n is raised by a write to the doorbell base + n * 8. + */ +#define EYEQ_MSI_VECTOR_STRIDE 8 + +/* + * Maximum number of loops in the ISR: each vector may be handled twice, then + * we stop. A device that keeps setting a vector that is still active must not + * hold the CPU in the ISR. The level-triggered parent IRQ calls the handler + * again for any status bits still pending. + */ +#define EYEQ_MSI_MAX_DRAIN (EYEQ_MSI_MAX_VECTORS * 2) + +#define GCSR_CONFIG 0x00 +#define GCSR_CONFIG_RC BIT(0) + +#define GCSR_IRQSTATUS 0x0a +#define GCSR_IRQSTATUS_MASK GENMASK(15, 12) + +#define GCSR_IRQMASK 0x0c +#define GCSR_IRQMASK_MASK GENMASK(15, 12) + +#define MSI_BASE_LO 0x00 +#define MSI_BASE_HI 0x02 + +#define MSI_CTRL 0x04 +#define MSI_CTRL_EN_OVERRIDE BIT(15) +#define MSI_CTRL_BAR_MATCH_MODE BIT(10) +#define MSI_CTRL_BAR_COMPARE GENMASK(9, 7) + +#define VECTOR_ADDR_LO GENMASK_ULL(20, 5) +#define VECTOR_ADDR_HI GENMASK_ULL(36, 21) + +struct eyeq_msi { + raw_spinlock_t lock; + struct irq_domain *msi_domain; + DECLARE_BITMAP(used, EYEQ_MSI_MAX_VECTORS); + + void __iomem *gcsr_base; + void __iomem *msi_base; + + phys_addr_t vector_phys; + + u16 mask_cache; + + int irq; +}; + +static void __eyeq_msi_mask_irq(struct eyeq_msi *msi, unsigned int bit) +{ + u16 value; + + lockdep_assert_held(&msi->lock); + + value = READ_ONCE(msi->mask_cache); + value &= ~FIELD_PREP(GCSR_IRQMASK_MASK, BIT(bit)); + WRITE_ONCE(msi->mask_cache, value); + writew(value, msi->gcsr_base + GCSR_IRQMASK); +} + +static void __eyeq_msi_unmask_irq(struct eyeq_msi *msi, unsigned int bit) +{ + u16 value; + + lockdep_assert_held(&msi->lock); + + value = READ_ONCE(msi->mask_cache); + value |= FIELD_PREP(GCSR_IRQMASK_MASK, BIT(bit)); + WRITE_ONCE(msi->mask_cache, value); + writew(value, msi->gcsr_base + GCSR_IRQMASK); +} + +static void __eyeq_msi_ack_irq(struct eyeq_msi *msi, unsigned int bit) +{ + lockdep_assert_held(&msi->lock); + + /* Write-one-to-clear the status bit. */ + writew(FIELD_PREP(GCSR_IRQSTATUS_MASK, BIT(bit)), + msi->gcsr_base + GCSR_IRQSTATUS); +} + +static void eyeq_msi_mask_irq(struct irq_data *data) +{ + struct eyeq_msi *msi = irq_data_get_irq_chip_data(data); + + guard(raw_spinlock)(&msi->lock); + __eyeq_msi_mask_irq(msi, data->hwirq); +} + +static void eyeq_msi_unmask_irq(struct irq_data *data) +{ + struct eyeq_msi *msi = irq_data_get_irq_chip_data(data); + + guard(raw_spinlock)(&msi->lock); + __eyeq_msi_unmask_irq(msi, data->hwirq); +} + +static void eyeq_msi_compose_msg(struct irq_data *data, struct msi_msg *msg) +{ + struct eyeq_msi *msi = irq_data_get_irq_chip_data(data); + phys_addr_t address; + + memset(msg, 0, sizeof(*msg)); + + address = msi->vector_phys + data->hwirq * EYEQ_MSI_VECTOR_STRIDE; + + msg->address_lo = lower_32_bits(address); + msg->address_hi = upper_32_bits(address); + msg->data = data->hwirq; +} + +/* + * Runs under desc->lock, which serializes with irq_disable(). Leave the + * status bit latched while disabled so unmask retriggers it. + */ +static void eyeq_msi_ack_irq(struct irq_data *data) +{ + struct eyeq_msi *msi = irq_data_get_irq_chip_data(data); + + if (irqd_irq_disabled(data)) + return; + + guard(raw_spinlock)(&msi->lock); + __eyeq_msi_ack_irq(msi, data->hwirq); +} + +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 = msi->gcsr_base + GCSR_IRQSTATUS; + + guard_chained_irq(parent_chip, desc); + + for (int i = 0; i < EYEQ_MSI_MAX_DRAIN; i++) { + unsigned long mask, pending; + unsigned int bit; + + pending = FIELD_GET(GCSR_IRQSTATUS_MASK, readw(status_reg)); + if (!pending) + break; + + /* + * Masked vectors stay latched so that unmask re-asserts the + * parent interrupt. + */ + mask = FIELD_GET(GCSR_IRQMASK_MASK, READ_ONCE(msi->mask_cache)); + pending &= mask; + if (!pending) + break; + + for_each_set_bit(bit, &pending, EYEQ_MSI_MAX_VECTORS) { + if (generic_handle_demux_domain_irq(msi->msi_domain, bit)) + continue; + + /* Silence an interrupt for an unmapped vector. */ + guard(raw_spinlock)(&msi->lock); + __eyeq_msi_mask_irq(msi, bit); + __eyeq_msi_ack_irq(msi, bit); + } + } +} + +static int eyeq_msi_domain_alloc(struct irq_domain *domain, unsigned int virq, + unsigned int nr_irqs, void *args) +{ + struct eyeq_msi *msi = domain->host_data; + unsigned long bit; + + if (WARN_ON_ONCE(nr_irqs != 1)) + return -EINVAL; + + scoped_guard(raw_spinlock_irqsave, &msi->lock) { + bit = find_first_zero_bit(msi->used, EYEQ_MSI_MAX_VECTORS); + if (bit >= EYEQ_MSI_MAX_VECTORS) + return -ENOSPC; + + set_bit(bit, msi->used); + + /* + * Drop a stale latch left by a previous owner so the new + * owner does not receive a spurious MSI on unmask. + */ + __eyeq_msi_ack_irq(msi, bit); + } + + irq_domain_set_info(domain, virq, bit, &eyeq_msi_irq_chip, msi, + handle_edge_irq, NULL, NULL); + + /* Mask on the first disabled edge; the state-aware ack keeps it latched. */ + irq_set_status_flags(virq, IRQ_DISABLE_UNLAZY); + + return 0; +} + +static void eyeq_msi_domain_free(struct irq_domain *domain, unsigned int virq, + unsigned int nr_irqs) +{ + struct irq_data *data = irq_domain_get_irq_data(domain, virq); + irq_hw_number_t hwirq; + struct eyeq_msi *msi; + + if (WARN_ON_ONCE(nr_irqs != 1)) + return; + + if (WARN_ON_ONCE(!data)) + return; + + msi = irq_data_get_irq_chip_data(data); + hwirq = data->hwirq; + + guard(raw_spinlock_irqsave)(&msi->lock); + + if (!test_and_clear_bit(hwirq, msi->used)) { + pr_warn("attempt to free unused hwirq %lu\n", (unsigned long)hwirq); + return; + } + + __eyeq_msi_mask_irq(msi, hwirq); + __eyeq_msi_ack_irq(msi, hwirq); +} + +/* + * The same callbacks serve the PCI MSI parent (root complex mode) and the + * platform MSI parent (endpoint mode). + */ +static const struct irq_domain_ops eyeq_msi_domain_ops = { + .alloc = eyeq_msi_domain_alloc, + .free = eyeq_msi_domain_free, + .select = msi_lib_irq_domain_select, +}; + +#define EYEQ_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ + MSI_FLAG_USE_DEF_CHIP_OPS | \ + MSI_FLAG_PCI_MSI_MASK_PARENT) + +#define EYEQ_MSI_FLAGS_SUPPORTED (MSI_FLAG_PCI_MSIX | \ + MSI_GENERIC_FLAGS_MASK) + +static const struct msi_parent_ops eyeq_msi_parent_ops = { + .required_flags = EYEQ_MSI_FLAGS_REQUIRED, + .supported_flags = EYEQ_MSI_FLAGS_SUPPORTED, + .chip_flags = MSI_CHIP_FLAG_SET_ACK, + .bus_select_token = DOMAIN_BUS_NEXUS, + .bus_select_mask = MATCH_PCI_MSI, + .prefix = "EYEQ-", + .init_dev_msi_info = msi_lib_init_dev_msi_info, +}; + +/* + * In endpoint mode the snooper is a platform MSI controller: the host writes + * the doorbell and the snooper raises a local interrupt. Expose it as a + * platform MSI parent so endpoint functions can allocate doorbells. + */ +static const struct msi_parent_ops eyeq_msi_platform_parent_ops = { + .required_flags = EYEQ_MSI_FLAGS_REQUIRED, + .supported_flags = EYEQ_MSI_FLAGS_SUPPORTED, + .chip_flags = MSI_CHIP_FLAG_SET_ACK, + .bus_select_token = DOMAIN_BUS_NEXUS, + .bus_select_mask = MATCH_PLATFORM_MSI, + .prefix = "EYEQ-P-", + .init_dev_msi_info = msi_lib_init_dev_msi_info, +}; + +static int eyeq_msi_create_domain(struct eyeq_msi *msi, struct device_node *node, bool is_rc) +{ + const struct msi_parent_ops *parent_ops = is_rc ? + &eyeq_msi_parent_ops : &eyeq_msi_platform_parent_ops; + struct irq_domain_info info = { + .fwnode = of_fwnode_handle(node), + .ops = &eyeq_msi_domain_ops, + .host_data = msi, + .size = EYEQ_MSI_MAX_VECTORS, + /* + * The composed doorbell address does not depend on affinity, + * as required by platform MSI doorbell consumers. + */ + .domain_flags = is_rc ? 0 : IRQ_DOMAIN_FLAG_MSI_IMMUTABLE, + }; + + msi->msi_domain = msi_create_parent_irq_domain(&info, parent_ops); + if (!msi->msi_domain) + return -ENOMEM; + + return 0; +} + +static int eyeq_msi_parse_vector_region(struct eyeq_msi *msi, struct device_node *node) +{ + struct device_node *memory_node; + struct resource resource; + int ret; + + memory_node = of_parse_phandle(node, "memory-region", 0); + if (!memory_node) { + pr_err("missing memory-region property\n"); + return -EINVAL; + } + + ret = of_address_to_resource(memory_node, 0, &resource); + of_node_put(memory_node); + + if (ret) { + pr_err("failed to parse MSI vector memory region: %d\n", ret); + return ret; + } + + msi->vector_phys = resource.start; + + return 0; +} + +static void eyeq_msi_program_hardware(struct eyeq_msi *msi, bool is_rc) +{ + u16 control, value; + u32 match_bar; + + guard(raw_spinlock_irqsave)(&msi->lock); + value = readw(msi->gcsr_base + GCSR_IRQMASK); + value &= ~GCSR_IRQMASK_MASK; + WRITE_ONCE(msi->mask_cache, value); + writew(value, msi->gcsr_base + GCSR_IRQMASK); + writew(GCSR_IRQSTATUS_MASK, msi->gcsr_base + GCSR_IRQSTATUS); + + /* + * The register holds address bits 5..36. + */ + writew(FIELD_GET(VECTOR_ADDR_LO, msi->vector_phys), msi->msi_base + MSI_BASE_LO); + + writew(FIELD_GET(VECTOR_ADDR_HI, msi->vector_phys), msi->msi_base + MSI_BASE_HI); + + /* + * RC mode uses BAR 2 as the no-translation BAR, endpoint mode uses + * BAR 3 as the MSI BAR. + */ + match_bar = is_rc ? 2 : 3; + + /* + * MSI_ADDR_MASK is left to zero: the vector region only differs from + * its base on address bits [4:3], which hardware excludes from the + * comparison since they hold the vector number. + */ + control = MSI_CTRL_EN_OVERRIDE | MSI_CTRL_BAR_MATCH_MODE | + FIELD_PREP(MSI_CTRL_BAR_COMPARE, match_bar); + + writew(control, msi->msi_base + MSI_CTRL); +} + +static int eyeq_msi_probe(struct platform_device *pdev, struct device_node *parent) +{ + struct device_node *node = pdev->dev.of_node; + struct eyeq_msi *msi; + bool is_rc; + int ret; + + msi = devm_kzalloc(&pdev->dev, sizeof(*msi), GFP_KERNEL); + if (!msi) + return -ENOMEM; + + raw_spin_lock_init(&msi->lock); + bitmap_zero(msi->used, EYEQ_MSI_MAX_VECTORS); + msi->irq = -1; + + msi->gcsr_base = of_iomap(node, 0); + if (!msi->gcsr_base) { + pr_err("failed to map GCSR registers\n"); + return -ENOMEM; + } + + msi->msi_base = of_iomap(node, 1); + if (!msi->msi_base) { + pr_err("failed to map MSI registers\n"); + ret = -ENOMEM; + goto err_unmap_gcsr; + } + + ret = eyeq_msi_parse_vector_region(msi, node); + if (ret) + goto err_unmap_msi; + + msi->irq = of_irq_get(node, 0); + if (msi->irq <= 0) { + ret = msi->irq ?: -EINVAL; + pr_err("failed to obtain parent IRQ: %d\n", ret); + goto err_unmap_msi; + } + + is_rc = FIELD_GET(GCSR_CONFIG_RC, readw(msi->gcsr_base + GCSR_CONFIG)); + + eyeq_msi_program_hardware(msi, is_rc); + + ret = eyeq_msi_create_domain(msi, node, is_rc); + if (ret) { + pr_err("failed to create IRQ domain: %d\n", ret); + goto err_dispose_irq; + } + + /* + * Install the chained handler only once the domain and hardware are + * ready, otherwise an interrupt could arrive unhandled. + */ + irq_set_chained_handler_and_data(msi->irq, eyeq_msi_isr, msi); + + pr_info("%s: initialized in %s mode with %u vectors, parent IRQ %d\n", + of_node_full_name(node), is_rc ? "root-complex" : "endpoint", + EYEQ_MSI_MAX_VECTORS, msi->irq); + + return 0; + +err_dispose_irq: + irq_dispose_mapping(msi->irq); + +err_unmap_msi: + iounmap(msi->msi_base); + +err_unmap_gcsr: + iounmap(msi->gcsr_base); + + return ret; +} + +IRQCHIP_PLATFORM_DRIVER_BEGIN(eyeq5_msi) +IRQCHIP_MATCH("mobileye,eyeq5-msi", eyeq_msi_probe) +IRQCHIP_PLATFORM_DRIVER_END(eyeq5_msi) -- 2.53.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver 2026-12-03 15:09 ` [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver Gregory CLEMENT @ 2026-12-03 15:51 ` sashiko-bot 0 siblings, 0 replies; 10+ messages in thread From: sashiko-bot @ 2026-12-03 15:51 UTC (permalink / raw) To: Gregory CLEMENT; +Cc: devicetree, robh, conor+dt Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] irqchip/eyeq5-msi: missing irq_pre_redirect causes SMP parent IRQ storm - [Medium] irqchip/eyeq5-msi: TOCTOU race in eyeq_msi_isr() masks reallocated vector - [Medium] irqchip: unnecessary spinlock in eyeq_msi_ack_irq() hot path - [Low] irqchip: eyeq_msi_probe() keeps unmanaged of_iomap() despite v4 review -- commit b06bebb42809e988f802666b3d556a924b893597 Author: Gregory CLEMENT <gregory.clement@bootlin.com> irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver This commit adds the EyeQ5 PCIe MSI controller driver, supporting up to 4 vectors per port in either root complex (PCI MSI parent) or endpoint (platform MSI parent) mode chained to a parent GIC interrupt. > diff --git a/drivers/irqchip/irq-eyeq5-msi.c b/drivers/irqchip/irq-eyeq5-msi.c > new file mode 100644 > index 0000000000000..3d50f13d7c9dd > --- /dev/null > +++ b/drivers/irqchip/irq-eyeq5-msi.c > @@ -0,0 +1,465 @@ [ ... ] > +static void eyeq_msi_ack_irq(struct irq_data *data) > +{ > + struct eyeq_msi *msi = irq_data_get_irq_chip_data(data); > + > + if (irqd_irq_disabled(data)) > + return; > + > + guard(raw_spinlock)(&msi->lock); > + __eyeq_msi_ack_irq(msi, data->hwirq); > +} [Severity: Medium] Does eyeq_msi_ack_irq() need to take msi->lock on every handled MSI? __eyeq_msi_ack_irq() only does a single-bit write-one-to-clear writew() to GCSR_IRQSTATUS without touching msi->mask_cache or msi->used. Same-vector serialization with disable, mask, and unmask is already handled by desc->lock, and distinct status bits are independent in hardware. Acquiring the controller-wide spinlock on every interrupt serializes all four vectors and dirties the cacheline holding struct eyeq_msi (including msi_domain, gcsr_base, and mask_cache read by eyeq_msi_isr()) on remote CPUs. Dropping msi->lock here avoids that contention and false sharing. > + > +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 > +}; [Severity: High] As reported by Thomas Gleixner on v5 [1], can omitting irq_pre_redirect on eyeq_msi_irq_chip cause a level-triggered parent GIC IRQ storm on SMP? When a vector is steered to another CPU, demux_redirect_remote() queues redirect work and returns true without calling eyeq_msi_ack_irq(). GCSR_IRQSTATUS stays asserted, so eyeq_msi_isr() spins through EYEQ_MSI_MAX_DRAIN and the parent GIC IRQ storms until target_cpu runs it. If desc->action is NULL when demux_redirect_remote() runs, no work is queued and the parent CPU locks up permanently. Also, __free_irq() clears IRQ_DISABLE_UNLAZY from eyeq_msi_domain_alloc(), so after a free/request cycle a disabled redirected vector is left unmasked. Implementing irq_pre_redirect() to ack active vectors and mask disabled ones in parent ISR context, and wiring irq_chip_pre_redirect_parent in a custom init_dev_msi_info callback (since msi_lib_init_dev_msi_info() does not set it), would address this. [ ... ] > + for_each_set_bit(bit, &pending, EYEQ_MSI_MAX_VECTORS) { > + if (generic_handle_demux_domain_irq(msi->msi_domain, bit)) > + continue; > + > + /* Silence an interrupt for an unmapped vector. */ > + guard(raw_spinlock)(&msi->lock); > + __eyeq_msi_mask_irq(msi, bit); > + __eyeq_msi_ack_irq(msi, bit); > + } [Severity: Medium] Can this unmapped-vector fallback mask a vector that has just been reallocated and enabled on another CPU? irq_domain_free_irqs() removes the revmap entry and frees the bit in msi->used without waiting for an RCU grace period, so another CPU can reallocate and unmask the same vector before eyeq_msi_isr() takes msi->lock: CPU0 CPU1 eyeq_msi_isr() readw(GCSR_IRQSTATUS) irq_domain_free_irqs() irq_domain_remove_irq() eyeq_msi_domain_free() generic_handle_demux_domain_irq() -> returns false (unmapped) eyeq_msi_domain_alloc() set_bit(bit, msi->used) request_irq() eyeq_msi_unmask_irq() guard(raw_spinlock)(&msi->lock) __eyeq_msi_mask_irq(msi, bit) <-- masks newly enabled vector __eyeq_msi_ack_irq(msi, bit) This leaves the new owner's vector masked in GCSR_IRQMASK and msi->mask_cache while irq_desc still considers it unmasked, silencing future interrupts. Checking !test_bit(bit, msi->used) under msi->lock before masking and acking avoids clobbering the new owner. [ ... ] > + msi->gcsr_base = of_iomap(node, 0); > + if (!msi->gcsr_base) { > + pr_err("failed to map GCSR registers\n"); > + return -ENOMEM; > + } > + > + msi->msi_base = of_iomap(node, 1); > + if (!msi->msi_base) { > + pr_err("failed to map MSI registers\n"); > + ret = -ENOMEM; > + goto err_unmap_gcsr; > + } [Severity: Low] As reported by Thomas Gleixner on v4 [2], could both of_iomap() calls use devm_of_iomap() (or devm_platform_ioremap_resource()) instead? That reserves the I/O resources and removes the manual err_unmap_msi and err_unmap_gcsr iounmap() paths (switching the error checks to IS_ERR()). [1] https://lore.kernel.org/r/87jylsq3lz.ffs@fw13 [2] https://lore.kernel.org/r/87y0a9ox94.ffs@fw13 -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203-eyeq5_msi-v6-0-8ffe74494bd2@bootlin.com?part=2 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v6 3/5] MIPS: eyeq: select the EyeQ5 MSI controller 2026-12-03 15:09 [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT 2026-12-03 15:09 ` [PATCH v6 1/5] dt-bindings: interrupt-controller: add Mobileye " Gregory CLEMENT 2026-12-03 15:09 ` [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver Gregory CLEMENT @ 2026-12-03 15:09 ` Gregory CLEMENT 2026-12-03 15:33 ` sashiko-bot 2026-12-03 15:09 ` [PATCH v6 4/5] MIPS: dts: eyeq5: add MSI controllers Gregory CLEMENT ` (2 subsequent siblings) 5 siblings, 1 reply; 10+ messages in thread From: Gregory CLEMENT @ 2026-12-03 15:09 UTC (permalink / raw) To: Vladimir Kondratiev, Benoît Monin, Théo Lebrun, Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer Cc: Thomas Petazzoni, linux-mips, linux-kernel, devicetree, Gregory CLEMENT The MSI controller is part of the EyeQ SoC. This change selects it by default. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ed17c9b1624ca..19dbf24684b23 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -632,6 +632,7 @@ config EYEQ select CPU_MIPSR2_IRQ_VI select CSRC_R4K select DMA_NONCOHERENT + select EYEQ5_MSI select HAVE_PCI select IRQ_MIPS_CPU select MIPS_AUTO_PFN_OFFSET -- 2.53.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v6 3/5] MIPS: eyeq: select the EyeQ5 MSI controller 2026-12-03 15:09 ` [PATCH v6 3/5] MIPS: eyeq: select the EyeQ5 MSI controller Gregory CLEMENT @ 2026-12-03 15:33 ` sashiko-bot 0 siblings, 0 replies; 10+ messages in thread From: sashiko-bot @ 2026-12-03 15:33 UTC (permalink / raw) To: Gregory CLEMENT; +Cc: devicetree, robh, conor+dt Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] irqchip/eyeq5-msi: missing irq_pre_redirect causes SMP IRQ storm and livelock -- commit 9fe61b747dd4fd35959e5a168f4786412aa69225 Author: Gregory CLEMENT <gregory.clement@bootlin.com> MIPS: eyeq: select the EyeQ5 MSI controller This commit selects EYEQ5_MSI under config EYEQ in arch/mips/Kconfig so the EyeQ5 MSI controller driver is enabled by default on EyeQ platforms. > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > index ed17c9b1624ca..19dbf24684b23 100644 > --- a/arch/mips/Kconfig > +++ b/arch/mips/Kconfig > @@ -632,6 +632,7 @@ config EYEQ > select CPU_MIPSR2_IRQ_VI > select CSRC_R4K > select DMA_NONCOHERENT > + select EYEQ5_MSI > select HAVE_PCI > select IRQ_MIPS_CPU > select MIPS_AUTO_PFN_OFFSET [Severity: High] Can enabling EYEQ5_MSI on SMP EyeQ platforms cause a parent IRQ storm, duplicate MSI deliveries, and a livelock when an MSI is routed to a remote CPU? In drivers/irqchip/irq-eyeq5-msi.c, eyeq_msi_irq_chip uses irq_chip_redirect_set_affinity under CONFIG_SMP and acks GCSR_IRQSTATUS only in irq_ack. Neither eyeq_msi_irq_chip nor its child MSI chips implement irq_pre_redirect. When an MSI targets a remote CPU, demux_redirect_remote() queues irq_work and returns true without calling eyeq_msi_ack_irq(). GCSR_IRQSTATUS stays latched, so eyeq_msi_isr() spins through its drain loop and keeps re-entering the level-triggered parent GIC IRQ until the remote CPU runs. This also allows a duplicate MSI if the spinning parent ISR runs after irq_work_single() clears IRQ_WORK_PENDING: CPU0 (parent GIC IRQ) CPU1 (target CPU) eyeq_msi_isr() generic_handle_demux_domain_irq() demux_redirect_remote() irq_work_queue_on(..., CPU1) /* GCSR_IRQSTATUS still set */ /* re-enters parent GIC IRQ */ irq_work_single() clear IRQ_WORK_PENDING eyeq_msi_isr() demux_redirect_remote() irq_work_queue_on(..., CPU1) <-- duplicate MSI queued irq_redirect_work() eyeq_msi_ack_irq() If an interrupt arrives for a remotely-affined vector while desc->action is NULL (racing with __free_irq()), demux_redirect_remote() skips irq_work_queue_on() without acking GCSR_IRQSTATUS, leaving the parent GIC line permanently asserted. Moving the GCSR_IRQSTATUS ack into irq_pre_redirect under CONFIG_SMP (making irq_ack a no-op) and setting irq_chip_pre_redirect_parent in init_dev_msi_info(), as drivers/irqchip/irq-al-fic.c does, would avoid this. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203-eyeq5_msi-v6-0-8ffe74494bd2@bootlin.com?part=3 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v6 4/5] MIPS: dts: eyeq5: add MSI controllers 2026-12-03 15:09 [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT ` (2 preceding siblings ...) 2026-12-03 15:09 ` [PATCH v6 3/5] MIPS: eyeq: select the EyeQ5 MSI controller Gregory CLEMENT @ 2026-12-03 15:09 ` Gregory CLEMENT 2026-12-03 15:28 ` sashiko-bot 2026-12-03 15:09 ` [PATCH v6 5/5] MAINTAINERS: add EyeQ5 MSI controller entry Gregory CLEMENT 2026-12-03 16:14 ` [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT 5 siblings, 1 reply; 10+ messages in thread From: Gregory CLEMENT @ 2026-12-03 15:09 UTC (permalink / raw) To: Vladimir Kondratiev, Benoît Monin, Théo Lebrun, Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer Cc: Thomas Petazzoni, linux-mips, linux-kernel, devicetree, Gregory CLEMENT Add the two EyeQ5 MSI controllers. They use reserved-memory regions as their doorbell windows. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- arch/mips/boot/dts/mobileye/eyeq5.dtsi | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/mips/boot/dts/mobileye/eyeq5.dtsi b/arch/mips/boot/dts/mobileye/eyeq5.dtsi index cec5ad8752285..ab63a90ed3e92 100644 --- a/arch/mips/boot/dts/mobileye/eyeq5.dtsi +++ b/arch/mips/boot/dts/mobileye/eyeq5.dtsi @@ -309,6 +309,28 @@ gpio1: gpio@1500000 { resets = <&olb 0 26>; }; + msi0: msi-controller@5840000 { + compatible = "mobileye,eyeq5-msi"; + reg = <0x0 0x05840000 0x0 0x10>, + <0x0 0x05840040 0x0 0x20>; + interrupt-parent = <&gic>; + msi-controller; + #msi-cells = <0>; + interrupts = <GIC_SHARED 7 IRQ_TYPE_LEVEL_HIGH>; + memory-region = <&pci0_msi_reserved>; + }; + + msi1: msi-controller@5840010 { + compatible = "mobileye,eyeq5-msi"; + reg = <0x0 0x05840010 0x0 0x10>, + <0x0 0x05840060 0x0 0x20>; + interrupt-parent = <&gic>; + msi-controller; + #msi-cells = <0>; + interrupts = <GIC_SHARED 48 IRQ_TYPE_LEVEL_HIGH>; + memory-region = <&pci1_msi_reserved>; + }; + iocu-bus { compatible = "simple-bus"; #address-cells = <2>; -- 2.53.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v6 4/5] MIPS: dts: eyeq5: add MSI controllers 2026-12-03 15:09 ` [PATCH v6 4/5] MIPS: dts: eyeq5: add MSI controllers Gregory CLEMENT @ 2026-12-03 15:28 ` sashiko-bot 0 siblings, 0 replies; 10+ messages in thread From: sashiko-bot @ 2026-12-03 15:28 UTC (permalink / raw) To: Gregory CLEMENT; +Cc: devicetree, robh, conor+dt Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] irqchip/eyeq5-msi: missing irq_pre_redirect causes GIC interrupt storm -- commit c2600b2477722b6bc60b82e5cabce2f821979819 Author: Gregory CLEMENT <gregory.clement@bootlin.com> MIPS: dts: eyeq5: add MSI controllers This commit adds the msi0 and msi1 MSI controller nodes to eyeq5.dtsi, wired to level-triggered GIC shared interrupts and reserved memory doorbell windows. > diff --git a/arch/mips/boot/dts/mobileye/eyeq5.dtsi b/arch/mips/boot/dts/mobileye/eyeq5.dtsi > index cec5ad8752285..ab63a90ed3e92 100644 > --- a/arch/mips/boot/dts/mobileye/eyeq5.dtsi > +++ b/arch/mips/boot/dts/mobileye/eyeq5.dtsi > @@ -309,6 +309,28 @@ gpio1: gpio@1500000 { > resets = <&olb 0 26>; > }; > > + msi0: msi-controller@5840000 { > + compatible = "mobileye,eyeq5-msi"; > + reg = <0x0 0x05840000 0x0 0x10>, > + <0x0 0x05840040 0x0 0x20>; > + interrupt-parent = <&gic>; > + msi-controller; > + #msi-cells = <0>; > + interrupts = <GIC_SHARED 7 IRQ_TYPE_LEVEL_HIGH>; > + memory-region = <&pci0_msi_reserved>; > + }; > + > + msi1: msi-controller@5840010 { > + compatible = "mobileye,eyeq5-msi"; > + reg = <0x0 0x05840010 0x0 0x10>, > + <0x0 0x05840060 0x0 0x20>; > + interrupt-parent = <&gic>; > + msi-controller; > + #msi-cells = <0>; > + interrupts = <GIC_SHARED 48 IRQ_TYPE_LEVEL_HIGH>; [Severity: High] Can wiring msi0 and msi1 to level-triggered GIC interrupts cause an interrupt storm on SMP when an MSI vector is redirected to another CPU? In commit "irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver", eyeq_msi_irq_chip sets irq_chip_redirect_set_affinity and the parent ops use msi_lib_init_dev_msi_info directly. Neither sets irq_pre_redirect, leaving hardware ack in eyeq_msi_ack_irq(). When an MSI vector targets a CPU other than the parent GIC CPU, eyeq_msi_isr() calls generic_handle_demux_domain_irq() -> demux_redirect_remote(). With irq_pre_redirect unset, demux_redirect_remote() queues desc->redirect.work on the target CPU without clearing GCSR_IRQSTATUS. With GCSR_IRQSTATUS still pending, eyeq_msi_isr() spins through all EYEQ_MSI_MAX_DRAIN iterations and the level-triggered GIC line re-fires until the target CPU runs irq_redirect_work() -> eyeq_msi_ack_irq(). If desc->action is NULL, the work is dropped and the GIC line stays asserted. Implementing irq_pre_redirect on eyeq_msi_irq_chip to ack GCSR_IRQSTATUS, setting info->chip->irq_pre_redirect = irq_chip_pre_redirect_parent in a custom init_dev_msi_info callback, and using a no-op irq_ack under CONFIG_SMP (as in dw_pcie_init_dev_msi_info()) would avoid this. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203-eyeq5_msi-v6-0-8ffe74494bd2@bootlin.com?part=4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v6 5/5] MAINTAINERS: add EyeQ5 MSI controller entry 2026-12-03 15:09 [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT ` (3 preceding siblings ...) 2026-12-03 15:09 ` [PATCH v6 4/5] MIPS: dts: eyeq5: add MSI controllers Gregory CLEMENT @ 2026-12-03 15:09 ` Gregory CLEMENT 2026-12-03 16:14 ` [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT 5 siblings, 0 replies; 10+ messages in thread From: Gregory CLEMENT @ 2026-12-03 15:09 UTC (permalink / raw) To: Vladimir Kondratiev, Benoît Monin, Théo Lebrun, Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer Cc: Thomas Petazzoni, linux-mips, linux-kernel, devicetree, Gregory CLEMENT Add the EyeQ5 MSI controller binding document and driver. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 93abbb315065d..ca3a32790261d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18769,12 +18769,14 @@ M: Gregory CLEMENT <gregory.clement@bootlin.com> M: Théo Lebrun <theo.lebrun@bootlin.com> L: linux-mips@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/interrupt-controller/mobileye,eyeq5-msi.yaml F: Documentation/devicetree/bindings/mips/mobileye.yaml F: Documentation/devicetree/bindings/soc/mobileye/ F: arch/mips/boot/dts/mobileye/ F: arch/mips/configs/eyeq*_defconfig F: arch/mips/mobileye/board-epm5.its.S F: drivers/clk/clk-eyeq.c +F: drivers/irqchip/irq-eyeq5-msi.c F: drivers/phy/phy-eyeq5-eth.c F: drivers/pinctrl/pinctrl-eyeq5.c F: drivers/reset/reset-eyeq.c -- 2.53.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller 2026-12-03 15:09 [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT ` (4 preceding siblings ...) 2026-12-03 15:09 ` [PATCH v6 5/5] MAINTAINERS: add EyeQ5 MSI controller entry Gregory CLEMENT @ 2026-12-03 16:14 ` Gregory CLEMENT 5 siblings, 0 replies; 10+ messages in thread From: Gregory CLEMENT @ 2026-12-03 16:14 UTC (permalink / raw) To: Vladimir Kondratiev, Benoît Monin, Théo Lebrun, Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer Cc: Thomas Petazzoni, linux-mips, linux-kernel, devicetree Hello, [...] > This sixth series addresses the ACK/disable_irq() race reported by Thomas > Gleixner. The MSI is now acknowledged from the irq_chip callback under > desc->lock instead of clearing GCSR_IRQSTATUS in the chained handler, so a > concurrent disable_irq() can no longer clear a status bit that must stay > latched. A dedicated race test reproduces the loss on v5 and passes with > this change. Argh, Sashiko just pointed me a bug with missing irq_pre_redirect. Indeed in this version, I kept `IRQ_DISABLE_UNLAZY` and I removed `irq_pre_redirect()`. I did this because I did not want to add a new core API that lets the driver set `IRQ_MASKED`. The driver needs this API only when `irq_pre_redirect()` masks a disabled vector itself. But this decision made me too focused on the `disable_irq()` race. So I did not see the SMP redirect case. In that case, the deferred ACK lets the level parent interrupt fire again. I will rework the code as Sashiko suggests. Sorry for the mess, I will then submitting a new version again next week, I see that there are also other suggestion from Sashiko I will review them too. Grégory > > Grégory > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> > --- > Changes in v6: > - irqchip: address the ACK path review from Thomas Gleixner: > - acknowledge from the irq_chip callback under desc->lock instead of > write-one-to-clearing GCSR_IRQSTATUS in the chained handler, so a > concurrent disable_irq() cannot clear a status bit that must stay > latched; > - skip the acknowledge while the vector is disabled so the hardware > retriggers it on unmask; > - drop the bulk acknowledge and only mask and acknowledge unmapped > vectors under the controller lock; > - cache GCSR_IRQMASK and dispatch from a lockless READ_ONCE() snapshot; > - move the per-iteration declarations into the loop scope. > - irqchip: delegate the acknowledge to the parent irq_data with > MSI_CHIP_FLAG_SET_ACK, so the callback gets the right chip_data/hwirq. > - The issue was reproduced with a dedicated MSI race test on EyeQ5 > hardware, and the same test passes with this revision. > - Link to v5: https://patch.msgid.link/20261125-eyeq5_msi-v5-0-72346cd10736@bootlin.com > > Changes in v5: > - irqchip: fix the MSI loss. Mask the vector on disable_irq() with > IRQ_DISABLE_UNLAZY so the MSI stays pending in GCSR_IRQSTATUS until > enable_irq(). (sashiko) > - irqchip: filter GCSR_IRQSTATUS with GCSR_IRQMASK in eyeq_msi_isr() > so a masked vector is not dispatched when a sibling fires. (sashiko) > - irqchip: clear GCSR_IRQSTATUS on vector alloc and free, so a reused > vector does not deliver a stale MSI to its new owner. > - irqchip: program the hardware before creating the IRQ domain, so no > vector can be allocated before the hardware is ready. > - irqchip: bound the ISR loop, so a device that keeps setting a vector > cannot hang a CPU. > - Link to v4: https://patch.msgid.link/20261116-eyeq5_msi-v4-0-2e1233b014b0@bootlin.com > > Changes in v4: > - irqchip: use a plain raw_spinlock() in the mask/unmask callbacks, which > run with interrupts disabled. > - irqchip: use guard_chained_irq() to balance the chained handler on every > return path. > - irqchip: simplify the domain alloc/free callbacks now that nr_irqs is > always 1. > - irqchip: reformat the MSI flag macros and use a distinct "EYEQ-P-" prefix > for the platform MSI parent. > - MIPS: move the EYEQ5_MSI selection into a separate MIPS patch, out of the > irqchip driver patch. > - Link to v3: https://patch.msgid.link/20261104-eyeq5_msi-v3-0-2866f732cd38@bootlin.com > > Changes in v3: > - Address review comments from sashiko. > - dt-bindings: drop the interrupt-controller, #interrupt-cells and label > properties. > - irqchip: use handle_edge_irq() with an ack callback instead of > handle_simple_irq(), so a vector is masked while disabled and a second > MSI is not lost while the first is in progress. For this one, I ran > some tests to confirm that the issue was real (it was) and that the fix > resolves it. > - irqchip: convert to a platform driver because the node is no longer an > interrupt controller and is no longer probed by of_irq_init(). > - irqchip: stop parsing the label property and use the node full name in > the boot message. > - MIPS: dts: update the MSI nodes according to the binding changes. > - Link to v2: https://patch.msgid.link/20261102-eyeq5_msi-v2-0-4aa3d3608064@bootlin.com > > Changes in v2: > - Address review comments from Krzysztof Kozlowski, Thomas Gleixner and > sashiko. > - dt-bindings: drop the num-vectors property (all ports have four > vectors) and simplify the example. > - irqchip: use the fixed four-vector count, add lockdep assertions, and > dispatch through generic_handle_demux_domain_irq() with a redirect-based > irq_set_affinity() callback. > - irqchip: drop MSI_FLAG_MULTI_PCI_MSI (standard Multi-MSI cannot work > with the address-based vector decoding) and MSI_FLAG_NO_AFFINITY; add > MSI_FLAG_PCI_MSI_MASK_PARENT. > - irqchip: keep vectors masked during allocation, mask all vectors and > clear pending status before installing the chained handler, and reject > of_irq_get() returning 0. > - MIPS: dts: drop the num-vectors property from both MSI nodes. > - Reformat the driver for the 100-column limit. > - Link to v1: https://patch.msgid.link/20261028-eyeq5_msi-v1-0-c464752fb55f@bootlin.com > > To: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com> > To: Benoît Monin <benoit.monin@bootlin.com> > To: Gregory CLEMENT <gregory.clement@bootlin.com> > To: Théo Lebrun <theo.lebrun@bootlin.com> > To: Thomas Gleixner <tglx@kernel.org> > To: Radu Rendec <radu@rendec.net> > To: Rob Herring <robh@kernel.org> > To: Krzysztof Kozlowski <krzk+dt@kernel.org> > To: Conor Dooley <conor+dt@kernel.org> > To: Thomas Bogendoerfer <tsbogend@alpha.franken.de> > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> > Cc: linux-mips@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: devicetree@vger.kernel.org > > --- > Gregory CLEMENT (5): > dt-bindings: interrupt-controller: add Mobileye EyeQ5 PCIe MSI controller > irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver > MIPS: eyeq: select the EyeQ5 MSI controller > MIPS: dts: eyeq5: add MSI controllers > MAINTAINERS: add EyeQ5 MSI controller entry > > .../interrupt-controller/mobileye,eyeq5-msi.yaml | 76 ++++ > MAINTAINERS | 2 + > arch/mips/Kconfig | 1 + > arch/mips/boot/dts/mobileye/eyeq5.dtsi | 22 + > drivers/irqchip/Kconfig | 5 + > drivers/irqchip/Makefile | 1 + > drivers/irqchip/irq-eyeq5-msi.c | 465 +++++++++++++++++++++ > 7 files changed, 572 insertions(+) > --- > base-commit: 08b814ca0a6945b8effc1a0d64999d562f24c923 > change-id: 20261028-eyeq5_msi-86aa1d590684 > > Best regards, > -- > Grégory CLEMENT, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com > -- Grégory CLEMENT, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-12-03 16:14 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-03 15:09 [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT 2026-12-03 15:09 ` [PATCH v6 1/5] dt-bindings: interrupt-controller: add Mobileye " Gregory CLEMENT 2026-12-03 15:09 ` [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver Gregory CLEMENT 2026-12-03 15:51 ` sashiko-bot 2026-12-03 15:09 ` [PATCH v6 3/5] MIPS: eyeq: select the EyeQ5 MSI controller Gregory CLEMENT 2026-12-03 15:33 ` sashiko-bot 2026-12-03 15:09 ` [PATCH v6 4/5] MIPS: dts: eyeq5: add MSI controllers Gregory CLEMENT 2026-12-03 15:28 ` sashiko-bot 2026-12-03 15:09 ` [PATCH v6 5/5] MAINTAINERS: add EyeQ5 MSI controller entry Gregory CLEMENT 2026-12-03 16:14 ` [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox