All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: Fil Dunsky via B4 Relay
	<devnull+filipp.dunsky.gmail.com@kernel.org>,
	Radu Rendec <radu@rendec.net>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Fil Dunsky <filipp.dunsky@gmail.com>
Subject: Re: [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller
Date: Tue, 01 Dec 2026 16:51:12 +0100	[thread overview]
Message-ID: <87mrqpov7z.ffs@fw13> (raw)
In-Reply-To: <20261117-cs75xx-intc-v4-2-0a678f35e5f3@gmail.com>

On Tue, Nov 17 2026 at 23:29, Fil Dunsky via wrote:
> +static void cs75xx_intc_handler(struct irq_desc *desc)
> +{
> +	struct irq_domain *domain = irq_desc_get_handler_data(desc);
> +	struct irq_chip *chip = irq_desc_get_chip(desc);
> +	struct irq_chip_generic *gc;
> +	unsigned long pending;
> +	unsigned int hwirq;
> +
> +	gc = irq_get_domain_generic_chip(domain, 0);
> +	chained_irq_enter(chip, desc);

        guard_chained_irq()

> +	pending = readl(gc->reg_base + CS75XX_INTC_STATUS) & gc->mask_cache;
> +	for_each_set_bit(hwirq, &pending, CS75XX_INTC_NR_IRQS)
> +		generic_handle_domain_irq(domain, hwirq);
> +
> +	chained_irq_exit(chip, desc);
> +}
> +
> +static int __init cs75xx_intc_init(struct device_node *np, struct device_node *parent)
> +{
> +	struct irq_chip_generic *gc;
> +	struct irq_domain *domain;
> +	void __iomem *base;
> +	int parent_irq;
> +	int ret;

        int ret, parent_irq;

> +	base = of_io_request_and_map(np, 0, of_node_full_name(np));
> +	if (IS_ERR(base)) {
> +		pr_err("%pOF: unable to map registers\n", np);
> +		return PTR_ERR(base);
> +	}
> +
> +	/* Mask everything before the chained handler is installed */
> +	writel(0, base + CS75XX_INTC_ENABLE);
> +
> +	parent_irq = irq_of_parse_and_map(np, 0);
> +	if (!parent_irq) {
> +		pr_err("%pOF: unable to map parent interrupt\n", np);
> +		ret = -EINVAL;
> +		goto err_unmap;
> +	}
> +
> +	domain = irq_domain_create_linear(of_fwnode_handle(np), CS75XX_INTC_NR_IRQS,
> +					  &irq_generic_chip_ops, NULL);
> +	if (!domain) {
> +		ret = -ENOMEM;
> +		goto err_dispose;
> +	}
> +
> +	ret = irq_alloc_domain_generic_chips(domain, CS75XX_INTC_NR_IRQS, 1, "cs75xx-intc",
> +					     handle_level_irq, IRQ_NOREQUEST | IRQ_NOPROBE, 0,
> +					     IRQ_GC_INIT_MASK_CACHE);
> +	if (ret)
> +		goto err_domain;
> +
> +	gc = irq_get_domain_generic_chip(domain, 0);
> +	gc->reg_base = base;
> +	gc->chip_types[0].regs.mask = CS75XX_INTC_ENABLE;
> +	gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
> +	gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;

This sequence is racy because the interrupt domain becomes visible
_before_ the chip has been allocated and initialized.

See lan966x_oic_probe() how this can be avoided.

Thanks,

        tglx

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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 20:29 [PATCH v4 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller Fil Dunsky
2026-11-17 20:29 ` Fil Dunsky via B4 Relay
2026-11-17 20:29 ` [PATCH v4 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 " Fil Dunsky
2026-11-17 20:29   ` Fil Dunsky via B4 Relay
2026-11-17 20:29 ` [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx " Fil Dunsky
2026-11-17 20:29   ` Fil Dunsky via B4 Relay
2026-11-17 20:52   ` sashiko-bot
2026-12-01 15:51   ` Thomas Gleixner [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=87mrqpov7z.ffs@fw13 \
    --to=tglx@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+filipp.dunsky.gmail.com@kernel.org \
    --cc=filipp.dunsky@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=radu@rendec.net \
    --cc=robh@kernel.org \
    /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.