From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8557E606A322 for ; Fri, 4 Dec 2026 19:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=sqbQMmW6; 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 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=5GuHRkDqtxt3yACbgnY9tBwc14DoRptF3WKq6tNt3cE=; b=sqbQMmW6aewJPc1Sik1eVpuc50 OdpQ/pfPlhm1X1Ts6yWc1m/RmpgilQ7s3AEKd/0NA5+fjbtCfjXLdeRj7kQqa+L2Tpx9GwtZcwK/e CGKebD8dAgcafDRYcNjs6J9tcFsV10oV3sWGjYrj5JZ0j0kq6MNyNIznwHtZmTET5P+eSbylXVRLz NfO6kTBm637pCs2l6RXEu7/uvfDEGvDI0M1us1mzTLZrAjE7tlq1Ef/yYrixuzpG6xST4jqQk7Eq0 DnPZv4ZcNd2C5rtUfmbxLJzsD7M41ONyw5cnylVnZEgFT298IwYyHRkZZCbY2e+5w3tYtlKV5RL/g svN4vcpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZYvk-00000001HcA-1jIu; Fri, 04 Dec 2026 19:26:52 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZYv4-00000001HZ9-2GK5 for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2026 19:26:50 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id A02316182B; Fri, 4 Dec 2026 19:26:09 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-6.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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