Re: [PATCH 2/6] irqchip: Add NXP S32N79 MRU MSI controller driver
From: Thomas Gleixner
Date: Fri Dec 04 2026 - 14:26:17 EST
On Fri, Dec 04 2026 at 14:56, Ghennadi Procopciuc via wrote:
> +
> +struct mru_msi;
> +
> +struct mru {
> + struct mru_msi *priv;
> + void __iomem *base;
> + phys_addr_t addr;
> + unsigned int index;
> + int irq;
> +};
> +
> +struct mru_msi {
> + struct irq_domain *domain;
> + unsigned long *chans_bitmap;
> + struct device *dev;
> + struct mru *mrus;
> + unsigned int nmrus;
> + unsigned int nchans;
> +};
Please read and follow:
https://docs.kernel.org/process/maintainer-tip.html
Especially struct definitions and bracket rules. Also you have 100
characters so please get rid of pointless line breaks.
> +/*
> + * The chained handler clears the status of the channel before it dispatches
> + * the vector. The vector can run later on another CPU, and by then the next
> + * message must be able to raise the SPI again. The flow handler of the device
> + * domain still needs an irq_ack() to call.
> + */
> +static void mru_msi_irq_ack(struct irq_data *d)
> +{
> +}
It's amazing how much comment an empty callback needs. The two lines of
code doing the ACK in the callback wouldn't need any and would actually
do it in the right context :)
> +static void mru_msi_compose_msg(struct irq_data *d, struct msi_msg *msg)
> +{
> + struct mru_msi *priv = irq_data_get_irq_chip_data(d);
> +
> + msi_msg_set_addr(irq_data_get_msi_desc(d), msg,
> + mru_mailbox_phys(priv, d->hwirq));
> + msg->data = 0;
> +}
> +
> +static const struct irq_chip mru_msi_parent_chip = {
> + .name = "MRU",
> + .irq_ack = mru_msi_irq_ack,
> + .irq_compose_msi_msg = mru_msi_compose_msg,
> +#ifdef CONFIG_SMP
> + .irq_set_affinity = irq_chip_redirect_set_affinity,
> +#endif
> +};
As there are no mask/unmask callbacks, this relies fully on the device
MSI implementation to provide them. MSI-X must provide masking, but MSI
does not, which can be a real pain as you have no way to prevent an
interrupt storm from a malfunctioning device.
Aside of that usually the on-SOC registers are faster to access than the
PCI registers for masking. MSI_FLAG_PCI_MSI_MASK_PARENT makes this work
so that only on startup/shutdown the masking happens at the PCI device
level, but run-time mask/unmask goes to the parent domain chip.
Just a hint. I personally don't care about debugging an interrupt storm
on your SoC :)
> +static void mru_msi_irq_handler(struct irq_desc *desc)
> +{
> + struct mru *mru = irq_desc_get_handler_data(desc);
> + struct irq_chip *chip = irq_desc_get_chip(desc);
> + struct mru_msi *priv = mru->priv;
> + unsigned int chan, pos;
> +
> + chained_irq_enter(chip, desc);
guard_chained_irq()
> + for (chan = 0; chan < MRU_CHANS_PER_MRU; chan++) {
> + void __iomem *mbstat = mru->base + chan * MRU_CH_STRIDE +
> + MRU_CH_MBSTAT;
> +
> + if (!(readl(mbstat) & MRU_MBSTAT_MBS0))
> + continue;
> +
> + writel(MRU_MBSTAT_MBS0, mbstat);
> +
> + pos = mru_mru2pos(priv, mru->index, chan);
> + if (!generic_handle_demux_domain_irq(priv->domain, pos))
> + dev_err_ratelimited(priv->dev,
> + "unexpected message on MRU%u channel %u\n",
> + mru->index, chan);
That message is nice, but that happens when an interrupt is not
mapped. But what masks the interrupt channel?
Thanks,
tglx