[PATCH v4 2/5] irqchip: Add the Sky1 AUDSS auxiliary interrupt controller

Thomas Gleixner tglx at kernel.org
Tue Dec 1 07:24:13 PST 2026


On Tue, Nov 17 2026 at 17:44, Jelly Jia wrote:
> +#define INFO_AP_IRQC		0x54
> +#define INFO_AP_IRQC_DMAC_MASK	GENMASK(7, 0)
> +#define SKY1_AUDSS_DMAC_IRQS	8
> +
> +struct sky1_audss_irq {
> +	struct regmap *regmap;
> +	struct irq_domain *domain;
> +	int parent_irq;
> +};

Please use tabular layout for the defines and struct declaration.

   https://docs.kernel.org/process/maintainer-tip.html

> +
> +static void sky1_audss_irq_mask(struct irq_data *d)
> +{
> +	struct sky1_audss_irq *priv = irq_data_get_irq_chip_data(d);
> +
> +	regmap_update_bits(priv->regmap, INFO_AP_IRQC, BIT(d->hwirq), 0);
> +}
> +
> +static void sky1_audss_irq_unmask(struct irq_data *d)
> +{
> +	struct sky1_audss_irq *priv = irq_data_get_irq_chip_data(d);
> +
> +	regmap_update_bits(priv->regmap, INFO_AP_IRQC,
> +			   BIT(d->hwirq), BIT(d->hwirq));

No line break requied you have 100 characters.

> +}
> +
> +static int sky1_audss_irq_request_resources(struct irq_data *d)
> +{
> +	return try_module_get(THIS_MODULE) ? 0 : -ENODEV;
> +}
> +
> +static void sky1_audss_irq_release_resources(struct irq_data *d)
> +{
> +	module_put(THIS_MODULE);
> +}

What's the point of this exercise?

> +
> +static struct irq_chip sky1_audss_irq_chip = {
> +	.name			= "sky1-audss-dmac",
> +	.irq_mask		= sky1_audss_irq_mask,
> +	.irq_unmask		= sky1_audss_irq_unmask,
> +	.irq_disable		= sky1_audss_irq_mask,
> +	.irq_request_resources	= sky1_audss_irq_request_resources,
> +	.irq_release_resources	= sky1_audss_irq_release_resources,
> +	.flags			= IRQCHIP_SKIP_SET_WAKE,
> +};
> +
> +static int sky1_audss_irq_map(struct irq_domain *d, unsigned int irq,
> +			      irq_hw_number_t hwirq)
> +{
> +	if (hwirq >= SKY1_AUDSS_DMAC_IRQS)
> +		return -EINVAL;
> +
> +	irq_set_chip_data(irq, d->host_data);
> +	irq_set_chip_and_handler(irq, &sky1_audss_irq_chip, handle_level_irq);
> +	/*
> +	 * There is no per-channel pending status in the CRU. Poll enabled
> +	 * children without spurious-IRQ accounting, but retain level flow
> +	 * control so disabled and oneshot-threaded children stay masked.
> +	 */
> +	irq_set_status_flags(irq, IRQ_LEVEL | IRQ_IS_POLLED);

Huch? The chained handler below ...

> +	irq_set_noprobe(irq);
> +
> +	return 0;
> +}
> +
> +static const struct irq_domain_ops sky1_audss_irq_ops = {
> +	.map	= sky1_audss_irq_map,
> +	.xlate	= irq_domain_xlate_onecell,
> +};
> +
> +static void sky1_audss_irq_handler(struct irq_desc *desc)
> +{
> +	struct sky1_audss_irq *priv = irq_desc_get_handler_data(desc);
> +	struct irq_chip *chip = irq_desc_get_chip(desc);
> +	unsigned long enabled;
> +	unsigned int hwirq;
> +	u32 val;
> +
> +	chained_irq_enter(chip, desc);
> +
> +	if (!regmap_read(priv->regmap, INFO_AP_IRQC, &val)) {

.. clearly reads the pending bits, no?

> +		enabled = val & INFO_AP_IRQC_DMAC_MASK;


> +		for_each_set_bit(hwirq, &enabled, SKY1_AUDSS_DMAC_IRQS)
> +			generic_handle_domain_irq(priv->domain, hwirq);
> +	}
> +
> +	chained_irq_exit(chip, desc);
> +}
> +
> +static int sky1_audss_irq_runtime_suspend(struct device *dev)
> +{
> +	struct sky1_audss_irq *priv = dev_get_drvdata(dev);
> +
> +	/* The parent CRU may turn its clocks off after the child suspends. */
> +	disable_irq(priv->parent_irq);

This operates on the interrupt which runs the chained handler, which
means disable_irq() is _not_ synchronizing against a handler in flight
on a different CPU because chained handlers do not set/clear INPROGRESS.

Please explain how this is supposed to be correct under all circumstances.

Thanks,

        tglx



More information about the linux-arm-kernel mailing list