From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796412369; b=2cZuIAROHxHb03AT12OqIUHD8MlKlPPpzmIFCxDCeGB7Wp4GHX4x+7U1Plq7CwTImxZC u1sw+Jmj/qlJGt7hC7YfMBy/xVhVh3dB6Mfmrwl3vA2NAfl4aFKYv9Ni0xGP5hq13NX2J WAZJsgt81WpEyRoeeZQnzeQLXCbMjDBG71ZiwjIOWhDvrlhV2ULT7AxkEw1yHoXV7HbYf +OP6y6BNIzALEiD0ojn4xfbFvljMDLYb9AeKrdiCVEJc8lPbpzEcpMaURYCLknSdQz/Ev +6oQVI/aposDZYjYY0VKBiZyXnJAN+zXExtGr4JPfJ5QEtlpQ0OfZ52Kj8+f0YOR2SQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796412369; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type; bh=5GuHRkDqtxt3yACbgnY9tBwc14DoRptF3WKq6tNt3cE=; b=aCMdSa1IXPR3bzO8OSoEIUQi/7YgyIxAOBbNjg9JxoIl8eO/9lVUOccht9eD4vye2Pxr KNRbaI9vqSGfqLtKmqwEY7+SU9MXRzSzPzmq5UifooezDUQmrM6/ootyBFeh9/nLRNWto hl6bycP29cVb89aMwK5U+DriHUH18ZpUBa16fDX86D3jJsRS2Q7PlnMelFTA6UuMUOvC+ pgl2rb7xvcdixTmB24Pyrj2aZgtTRsKwUi/IzfLlg156yr32PiVU09GRAWFilPhFFFmGZ Og06O1pVo/W0p9jsOS0lvc5VqJH1lictkhL2zfh9CFA1VInN8zlomBb2hUxwOxhzRRQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Z/0u+SEu"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEA89606A322; Fri, 4 Dec 2026 19:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z/0u+SEu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 888AB1F0093B; Fri, 4 Dec 2026 19:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796412369; bh=5GuHRkDqtxt3yACbgnY9tBwc14DoRptF3WKq6tNt3cE=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=Z/0u+SEuys7fzcHB42k7Se7vpjDcxi6gHByOUbSgXAgIUWA3Ka/UcOB1FRCl1zPX7 RznlK3sJIStkVkA4IhRfd3QlyBhznOlbyxDH0CqhF/Yk5VVCb8Bj7kROwke/MTZZwc z/TJB1YWrcJ7ExgWJtemxpFt3T0/i9tE2DWRlnwWitbcKqfqAcuwuQf3Fy70W4fdXK E+OUtdPVcheSfdbMzxsfatez9sq8FgMEOCV5qZrpJco/27+lWJSG+GbiUP9lRtN3J3 Ilnck9IAkGDsmBruf7/i2m19Vrf1XvIJGiaWecuCRCXjFtjAIogRuyjCXBaE+3nk7D hy7z5evMJre9w== From: Thomas Gleixner To: Ghennadi Procopciuc via B4 Relay , Krzysztof Kozlowski , Sascha Hauer , Rob Herring , Frank Li , Conor Dooley Cc: Pengutronix Kernel Team , imx@lists.linux.dev, devicetree@vger.kernel.org, NXP S32 Linux Team , linux-kernel@vger.kernel.org, Fabio Estevam , Radu Rendec , linux-arm-kernel@lists.infradead.org, echanude@redhat.com, clizzi@redhat.com, aruizrui@redhat.com, ghennadi.procopciuc@oss.nxp.com, eballetb@redhat.com Subject: Re: [PATCH 2/6] irqchip: Add NXP S32N79 MRU MSI controller driver In-Reply-To: <20261204-b4-s32n79-mru-msi-v1-2-e66f9b0dfa79@oss.nxp.com> References: <20261204-b4-s32n79-mru-msi-v1-0-e66f9b0dfa79@oss.nxp.com> <20261204-b4-s32n79-mru-msi-v1-2-e66f9b0dfa79@oss.nxp.com> Date: Fri, 04 Dec 2026 20:26:05 +0100 Message-ID: <87fqwcn8z6.ffs@fw13> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain 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