From patchwork Sun Jun 23 15:18:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 13708652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44279C2BBCA for ; Sun, 23 Jun 2024 15:21:16 +0000 (UTC) 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:Date:Content-Type: MIME-Version:References:Subject:Cc:To:From:Message-ID:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=xmjvOHOYTgqqA8IGPC6dGdyVEF+BEZiptiYdpVIpqZo=; b=1FcezU28pkyTkA dqr0nN5Qwp369PzUydnFVrSpLlUtTzTROL89E/9tAyM2bLIfq9tfoe2olJ3ht9JuNbamYKXD07eLI Sr8USV0d0YEt326QMwpJjMIPgLl9RUPkrtnexG2ofFXovOEhSXGs8lLKaCH2oD/AmyW+mOe8iP5Y3 95JhL3boU3/hISrE3ZjtA2DyxkxWqP25UVsQsr9CqrYGdvXFnV6Cn+XrvUlI84H/R5NpotGeyvbtt CQoDeP9BmI2/AoLcGpx6Y5thqIQAX49BDhXxm7bmt1+yW8uuXs0wtogxBQzfWuMOhMdVBI0z9V3aI Eay/OMOxW9oFgMwbvygA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLP1Y-0000000EGwm-27LW; Sun, 23 Jun 2024 15:21:01 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLP0A-0000000EGXI-3xsF for linux-arm-kernel@bombadil.infradead.org; Sun, 23 Jun 2024 15:19:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Date:Content-Type:MIME-Version: References:Subject:Cc:To:From:Message-ID:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:In-Reply-To; bh=xmjvOHOYTgqqA8IGPC6dGdyVEF+BEZiptiYdpVIpqZo=; b=VXPrJra9dqLzy139vJN7wmdSLu Y/XCa4E7c0IhZlI9+iSMt5LUvM74JuRf3GGVXu+g0+TotTqDgcU4mepaYXixWpHvrzVNnXhdjkQIC O3ZWTuf99klf+vDK8E2Ge+qc/Exnk0iSAfa101Mo612wfi7WOTS1Rw+mH5J/D/In/27+bYVJeLABS wlFzlMCknlBx2MHfI7KsauBTwxiRqmKkkkVTyTpyFL1vTH/otjBaer95sTLc318McvHd2hBokM2nZ na4q5UrT/sAEuXZiE6F3RpWg0RG2okzOd34dbfJgivNUVRpFjfIQQCWR8UQg+BBpMqbNHm3N5j7Gv ZIMSxESA==; Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLP02-000000083iI-3nU7 for linux-arm-kernel@lists.infradead.org; Sun, 23 Jun 2024 15:19:32 +0000 Message-ID: <20240623142235.574932935@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1719155935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=xmjvOHOYTgqqA8IGPC6dGdyVEF+BEZiptiYdpVIpqZo=; b=qp5upnBZ+1NyWs0CvwwCQrncLiBS8I6KTxE67kiH5Nv5eXp+ed7OW+wPcarCMqZCD+n1Tn iuVceQsXYCZUWDcCI8TUjcHM0IKFaQjDCSXiqjwxw7ShSL7FPeEy7lnr6LgoAoKKvypvzt 2Qh21MURYpsA3KtX6Ur1fzBtxQVFj3geo+enAlnAkxYp7s/s8CDE3MzwRVAgBMF1sM6uKQ eK0DHvM9lKpmY1AGckCLV/QA7c1NIk73G01ibgFJsw/RLlQGjPp7fpYOssPsUPH5x0C6B2 XSiMjRq/A7TYxrV5QG6xr/ET744bL/NU8bmyWzBhdAzwbn9rw0yVyG0Y+wTktw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1719155935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=xmjvOHOYTgqqA8IGPC6dGdyVEF+BEZiptiYdpVIpqZo=; b=YeEWya1KcwBS4zD/3+n3R//OLaeRvAQB9LFZb4QIocoHlRBptQiYET/Ptbotl6nf80+FSP Y+H+hqZYpWmTX3Aw== From: Thomas Gleixner To: LKML Cc: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, maz@kernel.org, tglx@linutronix.de, anna-maria@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, bhelgaas@google.com, rdunlap@infradead.org, vidyas@nvidia.com, ilpo.jarvinen@linux.intel.com, apatel@ventanamicro.com, kevin.tian@intel.com, nipun.gupta@amd.com, den@valinux.co.jp, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, gregkh@linuxfoundation.org, rafael@kernel.org, alex.williamson@redhat.com, will@kernel.org, lorenzo.pieralisi@arm.com, jgg@mellanox.com, ammarfaizi2@gnuweeb.org, robin.murphy@arm.com, lpieralisi@kernel.org, nm@ti.com, kristo@kernel.org, vkoul@kernel.org, okaya@kernel.org, agross@kernel.org, andersson@kernel.org, mark.rutland@arm.com, shameerali.kolothum.thodi@huawei.com, yuzenghui@huawei.com, shivamurthy.shastri@linutronix.de Subject: [patch V4 14/21] irqchip/imx-mu-msi: Switch to MSI parent References: <20240623142137.448898081@linutronix.de> MIME-Version: 1.0 Date: Sun, 23 Jun 2024 17:18:55 +0200 (CEST) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240623_161929_934396_83E90644 X-CRM114-Status: GOOD ( 16.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thomas Gleixner All platform MSI users and the PCI/MSI code handle per device MSI domains when the irqdomain associated to the device provides MSI parent functionality. Remove the "global" platform domain related code and provide the MSI parent functionality by filling in msi_parent_ops. Signed-off-by: Thomas Gleixner Signed-off-by: Anna-Maria Behnsen Signed-off-by: Shivamurthy Shastri Signed-off-by: Thomas Gleixner --- --- drivers/irqchip/Kconfig | 1 drivers/irqchip/irq-imx-mu-msi.c | 48 +++++++++++++++++---------------------- drivers/irqchip/irq-msi-lib.c | 2 + 3 files changed, 24 insertions(+), 27 deletions(-) --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -492,6 +492,7 @@ config IMX_MU_MSI select IRQ_DOMAIN select IRQ_DOMAIN_HIERARCHY select GENERIC_MSI_IRQ + select IRQ_MSI_LIB help Provide a driver for the i.MX Messaging Unit block used as a CPU-to-CPU MSI controller. This requires a specially crafted DT --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -24,6 +24,8 @@ #include #include +#include "irq-msi-lib.h" + #define IMX_MU_CHANS 4 enum imx_mu_xcr { @@ -114,20 +116,6 @@ static void imx_mu_msi_parent_ack_irq(st imx_mu_read(msi_data, msi_data->cfg->xRR + data->hwirq * 4); } -static struct irq_chip imx_mu_msi_irq_chip = { - .name = "MU-MSI", - .irq_ack = irq_chip_ack_parent, -}; - -static struct msi_domain_ops imx_mu_msi_irq_ops = { -}; - -static struct msi_domain_info imx_mu_msi_domain_info = { - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS), - .ops = &imx_mu_msi_irq_ops, - .chip = &imx_mu_msi_irq_chip, -}; - static void imx_mu_msi_parent_compose_msg(struct irq_data *data, struct msi_msg *msg) { @@ -195,6 +183,7 @@ static void imx_mu_msi_domain_irq_free(s } static const struct irq_domain_ops imx_mu_msi_domain_ops = { + .select = msi_lib_irq_domain_select, .alloc = imx_mu_msi_domain_irq_alloc, .free = imx_mu_msi_domain_irq_free, }; @@ -216,6 +205,21 @@ static void imx_mu_msi_irq_handler(struc chained_irq_exit(chip, desc); } +#define IMX_MU_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ + MSI_FLAG_USE_DEF_CHIP_OPS | \ + MSI_FLAG_PARENT_PM_DEV) + +#define IMX_MU_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK) + +static const struct msi_parent_ops imx_mu_msi_parent_ops = { + .supported_flags = IMX_MU_MSI_FLAGS_SUPPORTED, + .required_flags = IMX_MU_MSI_FLAGS_REQUIRED, + .bus_select_token = DOMAIN_BUS_NEXUS, + .bus_select_mask = MATCH_PLATFORM_MSI, + .prefix = "MU-MSI-", + .init_dev_msi_info = msi_lib_init_dev_msi_info, +}; + static int imx_mu_msi_domains_init(struct imx_mu_msi *msi_data, struct device *dev) { struct fwnode_handle *fwnodes = dev_fwnode(dev); @@ -230,19 +234,9 @@ static int imx_mu_msi_domains_init(struc } irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS); - - msi_data->msi_domain = platform_msi_create_irq_domain(fwnodes, - &imx_mu_msi_domain_info, - parent); - - if (!msi_data->msi_domain) { - dev_err(dev, "failed to create MSI domain\n"); - irq_domain_remove(parent); - return -ENOMEM; - } - - irq_domain_set_pm_device(msi_data->msi_domain, dev); - + parent->dev = parent->pm_dev = dev; + parent->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; + parent->msi_parent_ops = &imx_mu_msi_parent_ops; return 0; } --- a/drivers/irqchip/irq-msi-lib.c +++ b/drivers/irqchip/irq-msi-lib.c @@ -89,6 +89,8 @@ bool msi_lib_init_dev_msi_info(struct de /* Chip updates for all child bus types */ if (!info->chip->irq_eoi) info->chip->irq_eoi = irq_chip_eoi_parent; + if (!info->chip->irq_ack) + info->chip->irq_ack = irq_chip_ack_parent; /* * The device MSI domain can never have a set affinity callback. It