Re: [PATCH v4 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver

From: Thomas Gleixner

Date: Tue Dec 01 2026 - 10:07:26 EST


On Mon, Nov 16 2026 at 14:58, Gregory CLEMENT wrote:
> +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;

Please put the variables into the scope in which they are actually used.

> +
> + 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);
> + }
> + }

How is this supposed to work in a situation where the driver invokes
disable_irq() for one of those interrupts?

disable_irq() defaults to lazy disable, which means the interrupt is not
masked in hardware. So if an interrupt is raised by the device after the
lazy disable, then the edge handler will mask it and set the pending
bit.

enable_irq() will then unmask and observe the pending bit and tries to
resend the interrupt by walking the hierarchy to find a chip with a
irq_retrigger() callback. If that's not available then it falls back to
software resend, which requires CONFIG_HARDIRQS_SW_RESEND=y. That's not
set by the mobileye platform. (It's only selected by BMIPS_GENERIC).

So in that case the interrupt is lost because from a device POV edge
interrupts are fire and forget.

You can't fix that by marking the chip with DISABLE_UNLAZY either
because the interrupt might be pending and cleared on a different CPU
right before the mask write hits the hardware. The handler then runs
into the same situation as with the lazy masking.

So either you can retrigger or you need to use software resend to handle
this.

> +}

> +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);

devm_of_iomap() ?

> + if (!msi->gcsr_base) {
> + pr_err("failed to map GCSR registers\n");
> + return -ENOMEM;
> + }
> +
> + msi->msi_base = of_iomap(node, 1);

Ditto

Thanks,

tglx