The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: "Gregory CLEMENT" <gregory.clement@bootlin.com>,
	"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
	"Benoît Monin" <benoit.monin@bootlin.com>,
	"Théo Lebrun" <theo.lebrun@bootlin.com>,
	"Radu Rendec" <radu@rendec.net>, "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org,
	Gregory CLEMENT <gregory.clement@bootlin.com>
Subject: Re: [PATCH v4 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver
Date: Tue, 01 Dec 2026 16:07:19 +0100	[thread overview]
Message-ID: <87y0a9ox94.ffs@fw13> (raw)
In-Reply-To: <20261116-eyeq5_msi-v4-2-2e1233b014b0@bootlin.com>

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

  reply	other threads:[~2026-12-01 15:07 UTC|newest]

Thread overview: 7+ 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-12-01 15:07   ` Thomas Gleixner [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=87y0a9ox94.ffs@fw13 \
    --to=tglx@kernel.org \
    --cc=benoit.monin@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=radu@rendec.net \
    --cc=robh@kernel.org \
    --cc=theo.lebrun@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=vladimir.kondratiev@mobileye.com \
    /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