From patchwork Wed Dec 4 12:45:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893733 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 E1936E77178 for ; Wed, 4 Dec 2024 12:58:39 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eeCBlcIwLaY2mG6jZqfUVdEsB7Kam1ZpO0aPx+zXCZk=; b=p/hnFkZAmhpJtJrVZxwEmRic0B 2JUUlkP61mbbwUuhu4+CzTMWczaDwuWEUUzxFRMiwNE2Zuk0bbWavO2aDJQqWIrsR0uc4cpzSh3Pe oH/6VHdy2x9bWRmuNb+gvzp5Nqm/ElNaHlO0GJiyR1BqPC639QjkgcufOoo223L5hiqwdOV1vXl1Q iKUTBYObOmF+QIfsFZS21NAlt/enVtssqEB33BHg2CwIw9LYP2QtKYey9yQRkbCRYaNEcK9J1vn+Z MYURS9QEHY2pMTDzkyA+xhakzt50XualYT7anRYH68OB8pYv+HwrMCv9/DDRDJ0vTWaLO3RlVSElS phLvIrhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxJ-0000000Case-3Z1C; Wed, 04 Dec 2024 12:58:13 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolc-0000000CYQn-0GSO; Wed, 04 Dec 2024 12:46:09 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B40BAA40DA1; Wed, 4 Dec 2024 12:44:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55C02C4CED2; Wed, 4 Dec 2024 12:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316366; bh=SWvLGrD5bHK6LkQqH6wSJ0wPWFyKPMKVEBv+X+6czU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pgksu6L1x9lwvYyaR3de4qE6JqwFDBovjtoTrN72K/hv52SRySq6bgOz66gXZLGNz H2EBNr2q9g5m4CWtw9cseezfj2nVE+Iry+yaV9zSR8GNv4brlz+JLl6UTuG2H81bVv 2FN3KyehEeefVz6SXsPjW6TPGStkwp5ym8FrRqrfDNT3tHvaV072SLW6CfEE4BQIpF 1xunjw5GxcrqrdOe9U3Qmst0MPdobQtxSTMjfDXkQ/F4+IIZxAZq0CHKa63n0AzFpN PgnLfWoiTX3zLNJcJkMRtOGh+Uz8yHIzFXGsv89qxKkuikpmQUAlXQByHh8pNRcD6d l55O49e2iQl0w== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIolY-000RHy-3p; Wed, 04 Dec 2024 12:46:04 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 01/11] irqchip: Make irq-msi-lib.h globally available Date: Wed, 4 Dec 2024 12:45:39 +0000 Message-Id: <20241204124549.607054-2-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044608_242996_AC04C326 X-CRM114-Status: GOOD ( 13.95 ) 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 Move irq-msi-lib.h into include/linux/irqchip, making it available to compilation units outside of drivers/irqchip. This requires some churn in drivers to fetch it from the new location. Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-gic-v2m.c | 2 +- drivers/irqchip/irq-gic-v3-its-msi-parent.c | 2 +- drivers/irqchip/irq-gic-v3-its.c | 2 +- drivers/irqchip/irq-gic-v3-mbi.c | 2 +- drivers/irqchip/irq-imx-mu-msi.c | 2 +- drivers/irqchip/irq-loongarch-avec.c | 2 +- drivers/irqchip/irq-loongson-pch-msi.c | 2 +- drivers/irqchip/irq-msi-lib.c | 2 +- drivers/irqchip/irq-mvebu-gicp.c | 2 +- drivers/irqchip/irq-mvebu-icu.c | 2 +- drivers/irqchip/irq-mvebu-odmi.c | 2 +- drivers/irqchip/irq-mvebu-sei.c | 2 +- {drivers => include/linux}/irqchip/irq-msi-lib.h | 6 +++--- 13 files changed, 15 insertions(+), 15 deletions(-) rename {drivers => include/linux}/irqchip/irq-msi-lib.h (84%) diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index be35c5349986a..db79ae622f3c4 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -26,7 +26,7 @@ #include #include -#include "irq-msi-lib.h" +#include /* * MSI_TYPER: diff --git a/drivers/irqchip/irq-gic-v3-its-msi-parent.c b/drivers/irqchip/irq-gic-v3-its-msi-parent.c index e150365fbe892..b4adee2a1aaae 100644 --- a/drivers/irqchip/irq-gic-v3-its-msi-parent.c +++ b/drivers/irqchip/irq-gic-v3-its-msi-parent.c @@ -8,7 +8,7 @@ #include #include "irq-gic-common.h" -#include "irq-msi-lib.h" +#include #define ITS_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ MSI_FLAG_USE_DEF_CHIP_OPS | \ diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 92244cfa04647..334fd15be1de1 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -41,7 +41,7 @@ #include #include "irq-gic-common.h" -#include "irq-msi-lib.h" +#include #define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0) #define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1) diff --git a/drivers/irqchip/irq-gic-v3-mbi.c b/drivers/irqchip/irq-gic-v3-mbi.c index 3fe870f8ee174..63c658375fd55 100644 --- a/drivers/irqchip/irq-gic-v3-mbi.c +++ b/drivers/irqchip/irq-gic-v3-mbi.c @@ -18,7 +18,7 @@ #include -#include "irq-msi-lib.h" +#include struct mbi_range { u32 spi_start; diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index 4342a21de1eb0..b3f656c6e7708 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -24,7 +24,7 @@ #include #include -#include "irq-msi-lib.h" +#include #define IMX_MU_CHANS 4 diff --git a/drivers/irqchip/irq-loongarch-avec.c b/drivers/irqchip/irq-loongarch-avec.c index 0f6e465dd3095..c95704707219d 100644 --- a/drivers/irqchip/irq-loongarch-avec.c +++ b/drivers/irqchip/irq-loongarch-avec.c @@ -18,7 +18,7 @@ #include #include -#include "irq-msi-lib.h" +#include #include "irq-loongson.h" #define VECTORS_PER_REG 64 diff --git a/drivers/irqchip/irq-loongson-pch-msi.c b/drivers/irqchip/irq-loongson-pch-msi.c index bd337ecddb409..3f6f4e9887c53 100644 --- a/drivers/irqchip/irq-loongson-pch-msi.c +++ b/drivers/irqchip/irq-loongson-pch-msi.c @@ -15,7 +15,7 @@ #include #include -#include "irq-msi-lib.h" +#include #include "irq-loongson.h" static int nr_pics; diff --git a/drivers/irqchip/irq-msi-lib.c b/drivers/irqchip/irq-msi-lib.c index d8e29fc0d4068..514b2616d9559 100644 --- a/drivers/irqchip/irq-msi-lib.c +++ b/drivers/irqchip/irq-msi-lib.c @@ -4,7 +4,7 @@ #include -#include "irq-msi-lib.h" +#include /** * msi_lib_init_dev_msi_info - Domain info setup for MSI domains diff --git a/drivers/irqchip/irq-mvebu-gicp.c b/drivers/irqchip/irq-mvebu-gicp.c index 2b6183919ea48..b206b7fe03f17 100644 --- a/drivers/irqchip/irq-mvebu-gicp.c +++ b/drivers/irqchip/irq-mvebu-gicp.c @@ -17,7 +17,7 @@ #include #include -#include "irq-msi-lib.h" +#include #include diff --git a/drivers/irqchip/irq-mvebu-icu.c b/drivers/irqchip/irq-mvebu-icu.c index b337f6c05f184..30d51a26ea05f 100644 --- a/drivers/irqchip/irq-mvebu-icu.c +++ b/drivers/irqchip/irq-mvebu-icu.c @@ -20,7 +20,7 @@ #include #include -#include "irq-msi-lib.h" +#include #include diff --git a/drivers/irqchip/irq-mvebu-odmi.c b/drivers/irqchip/irq-mvebu-odmi.c index ff19bfd258dce..0ba39fbdb451f 100644 --- a/drivers/irqchip/irq-mvebu-odmi.c +++ b/drivers/irqchip/irq-mvebu-odmi.c @@ -18,7 +18,7 @@ #include #include -#include "irq-msi-lib.h" +#include #include diff --git a/drivers/irqchip/irq-mvebu-sei.c b/drivers/irqchip/irq-mvebu-sei.c index 065166ab5dbc0..c12e650ae7c92 100644 --- a/drivers/irqchip/irq-mvebu-sei.c +++ b/drivers/irqchip/irq-mvebu-sei.c @@ -14,7 +14,7 @@ #include #include -#include "irq-msi-lib.h" +#include /* Cause register */ #define GICP_SECR(idx) (0x0 + ((idx) * 0x4)) diff --git a/drivers/irqchip/irq-msi-lib.h b/include/linux/irqchip/irq-msi-lib.h similarity index 84% rename from drivers/irqchip/irq-msi-lib.h rename to include/linux/irqchip/irq-msi-lib.h index 681ceabb7bc74..dd8d1d1385449 100644 --- a/drivers/irqchip/irq-msi-lib.h +++ b/include/linux/irqchip/irq-msi-lib.h @@ -2,8 +2,8 @@ // Copyright (C) 2022 Linutronix GmbH // Copyright (C) 2022 Intel -#ifndef _DRIVERS_IRQCHIP_IRQ_MSI_LIB_H -#define _DRIVERS_IRQCHIP_IRQ_MSI_LIB_H +#ifndef _IRQCHIP_IRQ_MSI_LIB_H +#define _IRQCHIP_IRQ_MSI_LIB_H #include #include @@ -24,4 +24,4 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain, struct irq_domain *real_parent, struct msi_domain_info *info); -#endif /* _DRIVERS_IRQCHIP_IRQ_MSI_LIB_H */ +#endif /* _IRQCHIP_IRQ_MSI_LIB_H */ From patchwork Wed Dec 4 12:45:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893725 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 84B35E77170 for ; Wed, 4 Dec 2024 12:58:30 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/i6+JOTbpNdjy8jM0ECNbKLI0ZaZTnTtdOTtCai+TVs=; b=ICMCn1FtDIkc7PPlKchlQFaBQG BouWxipSICpYB96zs1uBuqvBg5bE+3vLVw9uU5PEBXF0r+Oj7kcTsLudHQ1/Mn5oa1UnpKLCebQmL 78u4EXYAhNoBH2QeKFODoa5TbiShGrvCB5QQsdm1z7ic+uKP5CDucMqJ/BmoB6tqb14qln59UobGV 3HU5MsKLC4uotb2n9GQGb/+Em7Lv1MbKACY3ltMIprziOasfHkx4rsHCYjKOanPEInN6r0+/t5mdM iEgIyL/zedl3hPFGfxi4iNBRdueMfLEPSLruHyO+W6XauWLH951C0pKv734xvavKDG43lWHqbQIK5 UK/sIXyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxM-0000000Catg-0Fvx; Wed, 04 Dec 2024 12:58:16 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolc-0000000CYQs-1sRn; Wed, 04 Dec 2024 12:46:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1F7EEA4151A; Wed, 4 Dec 2024 12:44:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA878C4CEE4; Wed, 4 Dec 2024 12:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316366; bh=qwPg4vWceORrtj1oc93ZKHM01ZRkNO9H4Rht+pty/UI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IbsX5b4sS2duxSnQFRgweC+d/Bee9ibNyDCNoabkrmRvCqNOgOhoQ3ADrPSUOnM5U o+Nr3uW+TvyLMkm9CisvsQggJkZ1IVv0AuEY++SlZh8YAxNEtCV2fyxh0adj5UqEUu 317dZM5JQqEHNwvYjxNxX68nL8dmm6CK89JwY0cjORMOYC5uHDIral646J9slE02WH Q5LuzUp7Q2OAlbljEKOqQsLJv/JiWiaTgmkXpWut9mjJUTGbJhMXpwxbyHlo/P3Kai 8Xu0LlKRXaOW9eqH+W+47IDf5dDkvgc51bIKJsN/IGsAg93OKdvd6t4eCfMFL5a0jL 0i047dADaKKTA== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIolY-000RHy-Gv; Wed, 04 Dec 2024 12:46:04 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 02/11] genirq/msi: Add helper for creating MSI-parent irq domains Date: Wed, 4 Dec 2024 12:45:40 +0000 Message-Id: <20241204124549.607054-3-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044608_622025_65600FEC X-CRM114-Status: GOOD ( 14.86 ) 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 Creating an irq domain that serves as an MSI parent requires a substantial amount of esoteric boiler-plate code, some of which is often provided twice (such as the bus token). To make things a bit simpler for the unsuspecting MSI tinkerer, provide a helper that does it for them, and serves as documentation of what needs to be provided. Signed-off-by: Marc Zyngier --- include/linux/msi.h | 7 +++++++ kernel/irq/msi.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/include/linux/msi.h b/include/linux/msi.h index b10093c4d00ea..f08d14cf07103 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -594,6 +594,13 @@ struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode, struct msi_domain_info *info, struct irq_domain *parent); +struct irq_domain *msi_create_parent_irq_domain(struct fwnode_handle *fwnode, + const struct msi_parent_ops *msi_parent_ops, + const struct irq_domain_ops *ops, + unsigned long flags, unsigned long size, + void *host_data, + struct irq_domain *parent); + bool msi_create_device_irq_domain(struct device *dev, unsigned int domid, const struct msi_domain_template *template, unsigned int hwsize, void *domain_data, diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 396a067a8a56b..037d85cf0b21c 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -885,6 +885,46 @@ struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode, return __msi_create_irq_domain(fwnode, info, 0, parent); } +/** + * msi_create_parent_irq_domain - Create an MSI-parent interrupt domain + * @fwnode: Optional fwnode of the interrupt controller + * @msi_parent_ops: MSI parent callbacks and configuration + * @ops: Interrupt domain ballbacks + * @flags: Interrupt domain flags + * @size: Interrupt domain size (0 if arbitrarily large) + * @host_data: Interrupt domain private data + * @parent: Parent irq domain + * + * Return: pointer to the created &struct irq_domain or %NULL on failure + */ +struct irq_domain *msi_create_parent_irq_domain(struct fwnode_handle *fwnode, + const struct msi_parent_ops *msi_parent_ops, + const struct irq_domain_ops *ops, + unsigned long flags, unsigned long size, + void *host_data, + struct irq_domain *parent) +{ + struct irq_domain_info info = { + .fwnode = fwnode, + .size = size, + .hwirq_max = size, + .ops = ops, + .host_data = host_data, + .domain_flags = flags | IRQ_DOMAIN_FLAG_MSI_PARENT, + .parent = parent, + .bus_token = msi_parent_ops->bus_select_token, + }; + struct irq_domain *d; + + d = irq_domain_instantiate(&info); + if (IS_ERR(d)) + return NULL; + + d->msi_parent_ops = msi_parent_ops; + return d; +} +EXPORT_SYMBOL_GPL(msi_create_parent_irq_domain); + /** * msi_parent_init_dev_msi_info - Delegate initialization of device MSI info down * in the domain hierarchy From patchwork Wed Dec 4 12:45:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893726 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 0A6A7E77174 for ; Wed, 4 Dec 2024 12:58:32 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7J+2XZHF+cTylrJi6VEqpHl6T8YP1my+zkG0UJ92TUw=; b=cskVpWE71y02rB8QTgw0Qo6hJk Nr9cppba784HVSDg7gPvu4unzHIUIynejWwU6PozfKLCqr2PHjgWTM95tX+3RGmfuiosy+5qByDhU lG9eiOISxwe1It3arr7vU0N1XF/uINM6Oi9dT8lDqlpCSUkX3c0H/dRBZSzyo2MHFcKMPU0TuMgYu ivIMCjo15LsSkrSTE5CmrBZepEqWJKgqHh0A6TIwqhiEPIJSjRq5T/mmNNRY/h1EWz+XqJgfi7J6K PudftA7lO0yk8jPypDubLaT6aurfdazR8xLDI1imoS/h88QzRjB3M4DAqi1boZcG/jGcUemniKUoK PSnS0naw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxN-0000000CavB-1RfS; Wed, 04 Dec 2024 12:58:17 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolc-0000000CYRB-3Tsq; Wed, 04 Dec 2024 12:46:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1F4B8A414FD; Wed, 4 Dec 2024 12:44:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA059C4CEE1; Wed, 4 Dec 2024 12:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316366; bh=1V1FmvDMYnTWLajD7/gkCCe4tIOFd8A5mV3a3mgRPVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3iG8HnOi+ARtsWCUBL1CRJL9kMugczwqyYnB+XTeNHXx9L8y2GQ22sIoWSLtcxy6 QXIPGa+mIuBiymtO45sUfVk8J0kI5TmsKayPVHsiyrhY4M9tmzCYgno6vJsJJgfUpj u9revKLDf+dC0ACsldoFraFy3jZSqA5a20y1KsX7Wc/lJ3dsAEXpD+Lnu20YAVnyu5 9T4NwHb+gQenhY9XN1DvHJVLfUGJUkQbOcfpnLMFaXGoV1URNyDbP6vd8eXn55VWx/ 2/O3YOtPxLrX0Hwp0EmB8RWPAHQR6/6mg7t+SOeBxMApoznkpC2v9t6QEDVTQ9Nhvn KhMWJcvs1B++w== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIolY-000RHy-Uq; Wed, 04 Dec 2024 12:46:05 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 03/11] irqchip/gic: Convert to msi_create_parent_irq_domain() helper Date: Wed, 4 Dec 2024 12:45:41 +0000 Message-Id: <20241204124549.607054-4-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044608_996852_BBFB5338 X-CRM114-Status: GOOD ( 13.24 ) 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 Now that we have a concise helper to create an MSI parent domain, switch the GIC family over to that. Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-gic-v2m.c | 9 ++++----- drivers/irqchip/irq-gic-v3-its.c | 14 +++++--------- drivers/irqchip/irq-gic-v3-mbi.c | 9 ++++----- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index db79ae622f3c4..4916743aed314 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -270,16 +270,15 @@ static __init int gicv2m_allocate_domains(struct irq_domain *parent) if (!v2m) return 0; - inner_domain = irq_domain_create_hierarchy(parent, 0, 0, v2m->fwnode, - &gicv2m_domain_ops, v2m); + inner_domain = msi_create_parent_irq_domain(v2m->fwnode, + &gicv2m_msi_parent_ops, + &gicv2m_domain_ops, + 0, 0, v2m, parent); if (!inner_domain) { pr_err("Failed to create GICv2m domain\n"); return -ENOMEM; } - irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_NEXUS); - inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - inner_domain->msi_parent_ops = &gicv2m_msi_parent_ops; return 0; } diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 334fd15be1de1..6f61ee7c5d394 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -5114,20 +5114,16 @@ static int its_init_domain(struct its_node *its) info->ops = &its_msi_domain_ops; info->data = its; - inner_domain = irq_domain_create_hierarchy(its_parent, - its->msi_domain_flags, 0, - its->fwnode_handle, &its_domain_ops, - info); + inner_domain = msi_create_parent_irq_domain(its->fwnode_handle, + &gic_v3_its_msi_parent_ops, + &its_domain_ops, + its->msi_domain_flags, 0, + info, its_parent); if (!inner_domain) { kfree(info); return -ENOMEM; } - irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_NEXUS); - - inner_domain->msi_parent_ops = &gic_v3_its_msi_parent_ops; - inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - return 0; } diff --git a/drivers/irqchip/irq-gic-v3-mbi.c b/drivers/irqchip/irq-gic-v3-mbi.c index 63c658375fd55..e5f532f95148d 100644 --- a/drivers/irqchip/irq-gic-v3-mbi.c +++ b/drivers/irqchip/irq-gic-v3-mbi.c @@ -211,14 +211,13 @@ static int mbi_allocate_domain(struct irq_domain *parent) { struct irq_domain *nexus_domain; - nexus_domain = irq_domain_create_hierarchy(parent, 0, 0, parent->fwnode, - &mbi_domain_ops, NULL); + nexus_domain = msi_create_parent_irq_domain(parent->fwnode, + &gic_v3_mbi_msi_parent_ops, + &mbi_domain_ops, + 0, 0, NULL, parent); if (!nexus_domain) return -ENOMEM; - irq_domain_update_bus_token(nexus_domain, DOMAIN_BUS_NEXUS); - nexus_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - nexus_domain->msi_parent_ops = &gic_v3_mbi_msi_parent_ops; return 0; } From patchwork Wed Dec 4 12:45:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893727 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 5B752E7716B for ; Wed, 4 Dec 2024 12:58:31 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=N0yQ4SES0UeXrRVh46g5WO/n7xzm6NTj5XgBDEqDyc0=; b=qhKF+fThIx451lRCX4TAkvgUZf VrIDCzV/SF1QGtc+Gdh/KonSZJ/QqcJG/a97TXDuq9ijjUKiauMfzQl4903acC0H13evuqrpiaLE9 GQkZcxXZuosRqgP49CC9+jvCAjAbMILVnh8WhExDMSyT3Kjj/NvDPRgK4Zl+d5f4ceCcD4EObsVOC nHUVM44rUGovn2J4laVUblxoFy80pHhv+b+c6a4K8xtVPWDQLJOwonTyuWEfHUvKiT5/8ZPzX2iUY pCbULA/GHDClTIFr70UrUI6r/TSu8tmUwxhHPpxR/0vagBrdPhHhDzjXH5oP2z9CWEH+A0rgNDFRA BmSdzasg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxN-0000000Cavg-3u47; Wed, 04 Dec 2024 12:58:17 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolc-0000000CYRQ-3SK7; Wed, 04 Dec 2024 12:46:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1E93E5C6E30; Wed, 4 Dec 2024 12:45:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47D82C4AF0E; Wed, 4 Dec 2024 12:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316367; bh=cMEyrhut2oPOzp4WCdsADd6Mhl4M3N9+iIzR7Vo4fus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d7gJeuaANLlfILMnAH0xfcFXpharXfkDKqBCeIrQPfX5u+LfRez7d2wcyvxDZeEju NBebxjvJDBKpWoj/KFquYuXVSv7J6GOJWuTw7921VMgO+XDikjIsWLk8Wh5LjAM5xl +7YSN6trmPfmtrNcjg1yQT0at4g11nZEx6VOJikdElShAWglpzcAWNQcvg16pqsnAe xBYvV+unmzueB+5j0TeOMcu7wMyRbIPN37UOpU3Rhlgz4YDbb5z/JElCmwS3hMABF3 sOWXIaaZV/Ocpde/D3Cln9jWVW0Xn5TknjP/RCQ+kGMDKTU/yo+tApvxbeH/8NUeI+ 7i1zPiuWCJNTw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIolZ-000RHy-Aj; Wed, 04 Dec 2024 12:46:05 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 04/11] irqchip/mvebu: Convert to msi_create_parent_irq_domain() helper Date: Wed, 4 Dec 2024 12:45:42 +0000 Message-Id: <20241204124549.607054-5-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044608_942697_011B205A X-CRM114-Status: GOOD ( 14.05 ) 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 Now that we have a concise helper to create an MSI parent domain, switch the mvebu family of interrupt controllers over to that. Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-mvebu-gicp.c | 12 +++++------- drivers/irqchip/irq-mvebu-odmi.c | 13 +++++-------- drivers/irqchip/irq-mvebu-sei.c | 14 +++++--------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/drivers/irqchip/irq-mvebu-gicp.c b/drivers/irqchip/irq-mvebu-gicp.c index b206b7fe03f17..783bfc83c2607 100644 --- a/drivers/irqchip/irq-mvebu-gicp.c +++ b/drivers/irqchip/irq-mvebu-gicp.c @@ -229,16 +229,14 @@ static int mvebu_gicp_probe(struct platform_device *pdev) return -ENODEV; } - inner_domain = irq_domain_create_hierarchy(parent_domain, 0, - gicp->spi_cnt, - of_node_to_fwnode(node), - &gicp_domain_ops, gicp); + inner_domain = msi_create_parent_irq_domain(of_node_to_fwnode(node), + &gicp_msi_parent_ops, + &gicp_domain_ops, + 0, gicp->spi_cnt, gicp, + parent_domain); if (!inner_domain) return -ENOMEM; - irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI); - inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - inner_domain->msi_parent_ops = &gicp_msi_parent_ops; return 0; } diff --git a/drivers/irqchip/irq-mvebu-odmi.c b/drivers/irqchip/irq-mvebu-odmi.c index 0ba39fbdb451f..74308b1cc01f1 100644 --- a/drivers/irqchip/irq-mvebu-odmi.c +++ b/drivers/irqchip/irq-mvebu-odmi.c @@ -204,19 +204,16 @@ static int __init mvebu_odmi_init(struct device_node *node, parent_domain = irq_find_host(parent); - inner_domain = irq_domain_create_hierarchy(parent_domain, 0, - odmis_count * NODMIS_PER_FRAME, - of_node_to_fwnode(node), - &odmi_domain_ops, NULL); + inner_domain = msi_create_parent_irq_domain(of_node_to_fwnode(node), + &odmi_msi_parent_ops, + &odmi_domain_ops, 0, + odmis_count * NODMIS_PER_FRAME, + NULL, parent_domain); if (!inner_domain) { ret = -ENOMEM; goto err_unmap; } - irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI); - inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - inner_domain->msi_parent_ops = &odmi_msi_parent_ops; - return 0; err_unmap: diff --git a/drivers/irqchip/irq-mvebu-sei.c b/drivers/irqchip/irq-mvebu-sei.c index c12e650ae7c92..26e1a436af2d1 100644 --- a/drivers/irqchip/irq-mvebu-sei.c +++ b/drivers/irqchip/irq-mvebu-sei.c @@ -429,21 +429,17 @@ static int mvebu_sei_probe(struct platform_device *pdev) irq_domain_update_bus_token(sei->ap_domain, DOMAIN_BUS_WIRED); /* Create the 'MSI' domain */ - sei->cp_domain = irq_domain_create_hierarchy(sei->sei_domain, 0, - sei->caps->cp_range.size, - of_node_to_fwnode(node), - &mvebu_sei_cp_domain_ops, - sei); + sei->cp_domain = msi_create_parent_irq_domain(of_node_to_fwnode(node), + &sei_msi_parent_ops, + &mvebu_sei_cp_domain_ops, + 0, sei->caps->cp_range.size, + sei, sei->sei_domain); if (!sei->cp_domain) { pr_err("Failed to create CPs IRQ domain\n"); ret = -ENOMEM; goto remove_ap_domain; } - irq_domain_update_bus_token(sei->cp_domain, DOMAIN_BUS_GENERIC_MSI); - sei->cp_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - sei->cp_domain->msi_parent_ops = &sei_msi_parent_ops; - mvebu_sei_reset(sei); irq_set_chained_handler_and_data(parent_irq, mvebu_sei_handle_cascade_irq, sei); From patchwork Wed Dec 4 12:45:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893728 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 BBE1EE77175 for ; Wed, 4 Dec 2024 12:58:35 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=r8KqoANwl4plKk8WO/e+Pj38Wo9Eqz9zsbhcXm/cMdc=; b=w4zgIA2EXoTDMlYHCRTxWbjRAD kRMuZyg8EyGk0ohJCjQIGU8mHm4OjgUEir+W/yvuRdZa294S4/28dBNczaPXmbMMbmHaxJqIdjAoo P9pRe44S9Uy34aqmREV11DkQeRcskEbq2rdcNMEVlqtYDzmmp92YSCnefNIR9hi1+5I1W7N1Jty+9 gw20eUF0GYFUaPu0+yibqhe0AEbYU0rWVcZWCQhjjpopjXW470BT009QC+cmGifwhtfqm410W1jVs 0agw5YM4rHOODtIuuaAvPM0PdQ2v6vhW8ZqYj9hsVmazyT2vFIcRhXWV/Ik8BO3KbMebJdrMpA5Kz Ggrnra3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxP-0000000Cax4-3JUH; Wed, 04 Dec 2024 12:58:19 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIold-0000000CYRw-1Hao; Wed, 04 Dec 2024 12:46:11 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 57EB15C6E38; Wed, 4 Dec 2024 12:45:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B88DEC19422; Wed, 4 Dec 2024 12:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316367; bh=J2h79k3WbUC/sq2bIkNgbuUFrP/AJSlM4EuxmyTYCv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vr62k5+wqB1Fqc1D6aPCpoufZJluao/kLQZNfg84/LfpHrKbYN828AKSTqqKeQaCv 3qu8CJlgV0P0DphhuHV0RXZl4YlD5GanSbvvlMu2BizRaUa0Hiyflsbn0JCFsPYFlm P1gkyNmR285x7ujGi1/X7nvkGtakgj9ob+HawHpkN/gsJhbfR7sLIxfJqf6ilYEPbn 0z1kYl4YMoWLS5wILpt7MSOKNaSISK55Ihf7zQNlQF4KCFvvTCP1K5JjOoLEXJFQAh YqxtoRQYloKWZvBp/HFxKoEC7jmafjvBxIyDNWdKmnde0t3aJ5QRBubvIAF4uuPuwA pJo0WFkL1wwLw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIolZ-000RHy-MI; Wed, 04 Dec 2024 12:46:05 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 05/11] irqchip/riscv-imsic: Convert to msi_create_parent_irq_domain() helper Date: Wed, 4 Dec 2024 12:45:43 +0000 Message-Id: <20241204124549.607054-6-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044609_443196_249FDE3D X-CRM114-Status: GOOD ( 11.73 ) 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 Now that we have a concise helper to create an MSI parent domain, switch the RISC-V letter soup over to that. Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-riscv-imsic-platform.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/irq-riscv-imsic-platform.c index c708780e8760f..3fbc3a8eb3be8 100644 --- a/drivers/irqchip/irq-riscv-imsic-platform.c +++ b/drivers/irqchip/irq-riscv-imsic-platform.c @@ -325,16 +325,15 @@ int imsic_irqdomain_init(void) } /* Create Base IRQ domain */ - imsic->base_domain = irq_domain_create_tree(imsic->fwnode, - &imsic_base_domain_ops, imsic); + imsic->base_domain = msi_create_parent_irq_domain(imsic->fwnode, + &imsic_msi_parent_ops, + &imsic_base_domain_ops, + 0, 0, imsic, NULL); + if (!imsic->base_domain) { pr_err("%pfwP: failed to create IMSIC base domain\n", imsic->fwnode); return -ENOMEM; } - imsic->base_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - imsic->base_domain->msi_parent_ops = &imsic_msi_parent_ops; - - irq_domain_update_bus_token(imsic->base_domain, DOMAIN_BUS_NEXUS); global = &imsic->global; pr_info("%pfwP: hart-index-bits: %d, guest-index-bits: %d\n", From patchwork Wed Dec 4 12:45:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893731 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 CCA72E77173 for ; Wed, 4 Dec 2024 12:58:36 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j21wP0LfhQ7YOjGCSmlYJEDMoqPdFOsjrT0bIX8Avx0=; b=rKWgqpHhtlh/IIqo/aqjbodAIF HEtSOEBoPyHTp/Q6UJ+ydrsVxb0nNCvvMNyXUWWeyKc7tBmzh8xstZ1pMPkx/CVO2/tqJjB0dsVAj b2+PFQ2FMbLsH2D40PO30zJQ9m6yu6ZJ9BPwXwPBM8Y3UWU4hwZESjSQoV6NCXqLDM10Gze5XrYyT gNvGt5bL4Rix3/mbjJn+00/RvrxJTNgVyGRZfYUZjYl5ulfxrE0cYLk47M86YWjsHWGoxJTbGCDj8 pug4SqLQhLsGvMkdcmlN6DkGNGy2CYbLy4KT5UR5D273y1u6WUd3RkM2mFil2SKtwYE6dBM2Za/+B pTc6XQkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxR-0000000Caxw-0A1e; Wed, 04 Dec 2024 12:58:21 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIold-0000000CYSW-3APW; Wed, 04 Dec 2024 12:46:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 779C6A4165E; Wed, 4 Dec 2024 12:44:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31B93C4CEFA; Wed, 4 Dec 2024 12:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316368; bh=dBlxdtKKIDXUcPL3xGhsmTLyyToka/SogTL+AHvkSKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvvE2bmFyi4ii+jCYmLHcpmKKMRJEfg0hBoi+/2HyuZoB3HV1+mlNJeuh7g450CiD U03dL7MjZ4ID/ghfz07pzmH43kDP3IwFCEQJ3g2E+Zmp+Rum2T2sKaSLb0K7Cdb/6g 3mCZwrKf9V8Bm0i6PFcfQ61qerHrXkqy7vKoYNrrarzCxXvXm1lDfeQDmXPb62aho0 Q+6OnSJXvHtwl8+aexKkXpagX4X3QqMAKhp+8W2Qgo+Rg0mptwfEncNomGNxk1e4wv Kxl859SUjsHr2Gbff15WCbnodlWTwo0XDzN5gmPwAMuOmpzZQW2y9O/7ETlJzAKrn8 fy3lHnX61HaTQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIola-000RHy-3u; Wed, 04 Dec 2024 12:46:06 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 06/11] irqchip/imx-mu-msi: Convert to msi_create_parent_irq_domain() helper Date: Wed, 4 Dec 2024 12:45:44 +0000 Message-Id: <20241204124549.607054-7-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044609_926495_DD3320EE X-CRM114-Status: GOOD ( 12.67 ) 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 Now that we have a concise helper to create an MSI parent domain, switch the IMX letter soup over to that. Signed-off-by: Marc Zyngier Reviewed-by: Frank Li --- drivers/irqchip/irq-imx-mu-msi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index b3f656c6e7708..b73968423bb9f 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -226,17 +226,15 @@ static int imx_mu_msi_domains_init(struct imx_mu_msi *msi_data, struct device *d struct irq_domain *parent; /* Initialize MSI domain parent */ - parent = irq_domain_create_linear(fwnodes, IMX_MU_CHANS, - &imx_mu_msi_domain_ops, msi_data); + parent = msi_create_parent_irq_domain(fwnodes, &imx_mu_msi_parent_ops, + &imx_mu_msi_domain_ops, 0, + IMX_MU_CHANS, msi_data, NULL); if (!parent) { dev_err(dev, "failed to create IRQ domain\n"); return -ENOMEM; } - irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS); parent->dev = parent->pm_dev = dev; - parent->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - parent->msi_parent_ops = &imx_mu_msi_parent_ops; return 0; } From patchwork Wed Dec 4 12:45:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893730 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 808E7E7717A for ; Wed, 4 Dec 2024 12:58:36 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vRLIt5d1/A4ZOOeQUQzKPT0zGl3jGkVoWMEsQ7npGKQ=; b=1xBDVCyNqQ8kVMfcblABI1yleC hJ1DwREyNhEeXq5fdxgyG3Y8pcIX1alxeu43sqtfOYD7CBWKUrpGDcWcAJ3Kwpf82+i9JXL0i12HA knT4gYTMVDUOkADmdfNPQ4Lxxj/HQZwrKfD+yumqHVqXZi5osss2S7/wV8qyo2vzo9dCBObwAwipM VqyfjxybI9o/L3EpfnU12CEoAyx5PtZUGl6SL1HhvsoZK35QZbcdSPl6W16gmzSgiel8/TUxn7O2u WzD+DxWrLnD8BMxDI0j8T8QeZnq9HpxihMtnIIu6y/A3XCp0Q6IX2iyWvN2IxEn8BpVqPcEQ7Zw50 q5fz2KIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxU-0000000Cb4H-2tQE; Wed, 04 Dec 2024 12:58:24 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIole-0000000CYTl-0ej1; Wed, 04 Dec 2024 12:46:14 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id D71E9A414AB; Wed, 4 Dec 2024 12:44:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98BA8C4CEE6; Wed, 4 Dec 2024 12:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316368; bh=dzDLJ7+3sOK1+LLKU8zZ5pSubkCmnjrUQs+PsTqG8a8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LgS00sP6aZb9lBTEEMSsEXriSrvPibb7kwIbC2uh2yLKZ+ks+/sPakVinph2cf7yg ArtIt0FeWQmZnN4owZpv2/0sOv83fqNgBRU7l0dnCLxZC6XhG1FMqjUINjPo8SY4Ie QR5q83jiV6vll5jFqLjiTDnBLZMdlLQErFe39jn0M7Npu9kJb5nH5z4w1wR1ktJ16K 3GVn/83z+VygVRn7F6AEozLe3O2QGnZ8drfhoHNquC5AXDWNPtoyTgMEArlHb0E3m/ dof5S7+cu6eddgOhQC/fTIrwq79kUAiOgLg4LLID7Ip8W4vOk6zsDC0Z/ifx5R+WeD H2DEN6HIN+icw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIola-000RHy-HV; Wed, 04 Dec 2024 12:46:06 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 07/11] irqchip/loongson-pch-msi: Convert to msi_create_parent_irq_domain() helper Date: Wed, 4 Dec 2024 12:45:45 +0000 Message-Id: <20241204124549.607054-8-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044610_317864_F39DFBAF X-CRM114-Status: GOOD ( 12.88 ) 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 Now that we have a concise helper to create an MSI parent domain, switch the Loongson MSI stuff over to that. Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-loongson-pch-msi.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-loongson-pch-msi.c b/drivers/irqchip/irq-loongson-pch-msi.c index 3f6f4e9887c53..f15528f76a647 100644 --- a/drivers/irqchip/irq-loongson-pch-msi.c +++ b/drivers/irqchip/irq-loongson-pch-msi.c @@ -158,20 +158,15 @@ static int pch_msi_init_domains(struct pch_msi_data *priv, { struct irq_domain *middle_domain; - middle_domain = irq_domain_create_hierarchy(parent, 0, priv->num_irqs, - domain_handle, - &pch_msi_middle_domain_ops, - priv); + middle_domain = msi_create_parent_irq_domain(domain_handle, + &pch_msi_parent_ops, + &pch_msi_middle_domain_ops, 0, + priv->num_irqs, priv, parent); if (!middle_domain) { pr_err("Failed to create the MSI middle domain\n"); return -ENOMEM; } - irq_domain_update_bus_token(middle_domain, DOMAIN_BUS_NEXUS); - - middle_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - middle_domain->msi_parent_ops = &pch_msi_parent_ops; - return 0; } From patchwork Wed Dec 4 12:45:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893735 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 1DC10E77170 for ; Wed, 4 Dec 2024 12:58:43 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kdd8u5wjfE9hm8ngWpX4H/X2z68nPKRah5OeOMFt95M=; b=tb3JbxZiUj11ZdHYwAi6B6SHiu qvbPFoaa03H5USFYZDLszefEbSX9+mofdV+ZUtJNUUmZdk/oOYEtubmN6Pg9i+aTDfm0L0oOqAQVT xs6MjrGkOz4ROjVktgqHO82GveU0PJZLQGjsP+xeukzUIbgE5TKLlRNiCdiqoNzOC8YlZl6SSzwvl GOzsErL2pbKt/agENEWytpbiOVOFtl8njxTMlwKKPSe9QVlh6mDjtIM3M2yYO1lhGGsij3SjQhuB3 LuVdRC2e8hubZrYKe697Kl3dHZbsexHKAAWcTNB18GDOM2PbKs0gu7vezkbKhXLA/7E5OvqcNsox0 kYt+iHmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxY-0000000CbB2-1K0u; Wed, 04 Dec 2024 12:58:28 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolk-0000000CYaX-1xPk; Wed, 04 Dec 2024 12:46:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=kdd8u5wjfE9hm8ngWpX4H/X2z68nPKRah5OeOMFt95M=; b=F4M4FVmUywmsurrd4DRzffGPD2 YN3HAtmtVjDckHTwNUI95M9KR6C2qAZ8g4eBdM78RbLbfHhDzgUCg5qyH64it6QPXDZPwFss+ifqu JjulpdV1SPDh0xYQSn09WF33EszDA7q2gobSNj8p83pQ/D0nMVoQnwdXRvuz92u3LYb73ke78HcEB jJ7CyMRPxRGjJWUPX4JLs8OIZY/AEFqBl4PNwybqidm3YCtasjEc9JaQCqAlQtV3GWulydhvi7/CW DIoHPP3fTnqAlhOJIQxDrHpFncYAHIro0ixeE0zse+IlreEDOwOLn2F9jLA4857+Qgx6ARsvCRi48 ajArsHuA==; Received: from nyc.source.kernel.org ([147.75.193.91]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolh-00000002b0x-1QyL; Wed, 04 Dec 2024 12:46:15 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1AB83A4156E; Wed, 4 Dec 2024 12:44:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2D11C4CEF0; Wed, 4 Dec 2024 12:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316369; bh=fe7lcwYFLHBQlBhA2vl7mVVQ+yJKY96ww+J3jQMWUMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZ8F6XZ1jy1YAPBfD0GJUsQfKs6WAGdDjBmy3WMPnZtsAOCQ09o2+zJ5+/IDfupxX 1CvoqQzxawCkVsfT7HcPKGBI1tnwRDx85aq0+g+9EbLcAUUoWyCQ+bsZ0Z7sEmv5sk yJamHY22kaLLJUh3a2rWo8wAvoyHW9PIECOuzBN1R1evqkNSpfceaZvmBRQ6qUI7aG GBL7GPwGgWnPaSvBmW5idoJAlN7ZRIXpR+K05xjuskL4r4TORFFgtNrQu/80ZaS/y5 izlQSB47BVmpM2FhAtgm3J+7AX4EBTSqy8jlbkWiN9p00N1bHtROHf/8UKFDWnY8tB lPjqOGdodVZFg== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIola-000RHy-VH; Wed, 04 Dec 2024 12:46:07 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 08/11] iommu/amd: Convert to msi_create_parent_irq_domain() helper Date: Wed, 4 Dec 2024 12:45:46 +0000 Message-Id: <20241204124549.607054-9-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_124613_727762_B0A38DC6 X-CRM114-Status: GOOD ( 13.18 ) 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 Now that we have a concise helper to create an MSI parent domain, switch the AMD IOMMU remapping over to that. Signed-off-by: Marc Zyngier --- drivers/iommu/amd/iommu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 3f691e1fd22ce..8137674aca51d 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -3807,6 +3807,7 @@ static struct irq_chip amd_ir_chip = { static const struct msi_parent_ops amdvi_msi_parent_ops = { .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI, + .bus_token = DOMAIN_BUS_AMDVI, .prefix = "IR-", .init_dev_msi_info = msi_parent_init_dev_msi_info, }; @@ -3818,18 +3819,15 @@ int amd_iommu_create_irq_domain(struct amd_iommu *iommu) fn = irq_domain_alloc_named_id_fwnode("AMD-IR", iommu->index); if (!fn) return -ENOMEM; - iommu->ir_domain = irq_domain_create_hierarchy(arch_get_ir_parent_domain(), 0, 0, - fn, &amd_ir_domain_ops, iommu); + iommu->ir_domain = msi_create_parent_irq_domain(fn, &amdvi_msi_parent_ops, + &amd_ir_domain_ops, + IRQ_DOMAIN_FLAG_ISOLATED_MSI, 0, + iommu, arch_get_ir_parent_domain()); if (!iommu->ir_domain) { irq_domain_free_fwnode(fn); return -ENOMEM; } - irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_AMDVI); - iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT | - IRQ_DOMAIN_FLAG_ISOLATED_MSI; - iommu->ir_domain->msi_parent_ops = &amdvi_msi_parent_ops; - return 0; } From patchwork Wed Dec 4 12:45:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893729 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 F3304E7716B for ; Wed, 4 Dec 2024 12:58:35 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PGbg30tXac06ntau2vO84XHpNJ7dVxTwyx/ajo/s5pA=; b=wzIVUccvimpow/7YVTEhsrhyQz 9if7bUGu/5ReYa7kjuyOjv6ierPXgBnu4QlQhOIizsZaUK6V9mf7XYf+57NkNVeL2+ag+3P6N2TRb L3P/eePv29ajB3J98RBbqmCiES+g6CSyx1DntPzQCDMEfB4E5jyzNWIN8DCpS1fVVJnAE07IjEJX6 aOzcCAj3BpbCnkODQ/P1w0N/3RY7A7pRLKwDoQJfnpg+CGJjz17nktaG30OujDT9YXx+Hy9jjqxMv U/B934KMXORIc6nmWJlGD3SSWCN9Cuu2IiXohOWACdS34JqnJm3DJexaie0OeAyjIKnIzgT7JUzry c0Z2CvHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxT-0000000Cb18-021a; Wed, 04 Dec 2024 12:58:23 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIole-0000000CYVq-48fp; Wed, 04 Dec 2024 12:46:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 49C4BA4155E; Wed, 4 Dec 2024 12:44:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35A20C4CED1; Wed, 4 Dec 2024 12:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316369; bh=jTOd4yz8gsuLBweIwiSBdwKwzbJR5VQQ29Mpm+esKEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CULY6W2hnlcApn+/5dZASAOALgPuZhsI6jjUFBPT/KJ4ZfGZ8cg2cY0v2WPWXw6nj UEqSb8sUxBAWecBR7EgPWt8x6JmNdKSKaJ482+PLQOIbe6e6zESQlFhbfh7CNVGVvK sEgJAGLobF58pVXznkLg/CSHhKgTYqLHVRs297eOuTbEbhnl5rRYTHyTwLA7bCo8W2 08KIz3JsqETuv5CRfMHuLcVVYQujMbTCjqTnxFqwH7Aza2uyvJFK3v3LpYL7d5jPq8 kjrDyCmIO55v8pnz+xj/oPioY43885lOvqe/shfmGGL7/wUwpDCB/tsrnxjic4aflv Ll+SNoL+RA3wQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIolb-000RHy-BS; Wed, 04 Dec 2024 12:46:07 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 09/11] iommu/intel: Convert to msi_create_parent_irq_domain() helper Date: Wed, 4 Dec 2024 12:45:47 +0000 Message-Id: <20241204124549.607054-10-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044611_174266_53A924C3 X-CRM114-Status: GOOD ( 13.09 ) 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 Now that we have a concise helper to create an MSI parent domain, switch the Intel IOMMU remapping over to that. Signed-off-by: Marc Zyngier --- drivers/iommu/intel/irq_remapping.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c index 466c1412dd456..7ca3ee4c985c9 100644 --- a/drivers/iommu/intel/irq_remapping.c +++ b/drivers/iommu/intel/irq_remapping.c @@ -557,21 +557,16 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) if (!fn) goto out_free_bitmap; - iommu->ir_domain = - irq_domain_create_hierarchy(arch_get_ir_parent_domain(), - 0, INTR_REMAP_TABLE_ENTRIES, - fn, &intel_ir_domain_ops, - iommu); + iommu->ir_domain = msi_create_parent_irq_domain(fn, &dmar_msi_parent_ops, + &intel_ir_domain_ops, + IRQ_DOMAIN_FLAG_ISOLATED_MSI, + INTR_REMAP_TABLE_ENTRIES, + iommu, arch_get_ir_parent_domain()); if (!iommu->ir_domain) { pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id); goto out_free_fwnode; } - irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_DMAR); - iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT | - IRQ_DOMAIN_FLAG_ISOLATED_MSI; - iommu->ir_domain->msi_parent_ops = &dmar_msi_parent_ops; - ir_table->base = ir_table_base; ir_table->bitmap = bitmap; iommu->ir_table = ir_table; @@ -1522,6 +1517,7 @@ static const struct irq_domain_ops intel_ir_domain_ops = { static const struct msi_parent_ops dmar_msi_parent_ops = { .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI, + .bus_token = DOMAIN_BUS_DMAR, .prefix = "IR-", .init_dev_msi_info = msi_parent_init_dev_msi_info, }; From patchwork Wed Dec 4 12:45:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893732 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 90832E7717E for ; Wed, 4 Dec 2024 12:58:38 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dZznuEa7SCLFAxLSvSAQAvTLbiQ5H+LIpJoAJqYI68o=; b=cuHgZaChwCoUZB3LBhRSfVe8gq ZtCHbn04JOtFy440XSoevZT9rpjgoKNgg3JAejm6BQEuyOn9SZJpbCQA56lQMMPyKilSOLGkt/o7U QTTS7NV0uT0eyg5a02U0Ypau1M+xUeaFkTduzh5gXvYzdJzCESA4z07tWK3UacfVMOQ4d+MgNMDku 7Txd56RWvoAO397srS9ZNaoNNDOVo/iw48Zs44WKSnV4QI+tKn4nDsAwKSUGLFIliMLbhpX57k/+c OX9BuoaHGkdFBInKM1VMvoChucK9ZhrcVXdEEkvHtSlgQN7K03LB01BW4D/WYSnPkax1GGBGFHou1 TeYK8VjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxT-0000000Cb2w-3C7r; Wed, 04 Dec 2024 12:58:23 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolf-0000000CYW2-0s2v; Wed, 04 Dec 2024 12:46:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id DF5B1A41514; Wed, 4 Dec 2024 12:44:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1725C4CED1; Wed, 4 Dec 2024 12:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316369; bh=NPW6c3VDoAyeTY2GD72s1RHlrmv8mP4Sc8+nycqjNi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oH0f2cxu4cUugaMlPmlrMOH4WJ9Txnq2Om4S/PUMZ7gqWsBpfd31BNo2+D5CQPQEy dnTbWFfSmKjndLUMMfBStG1oIOjipJEk+6FHdC5prmrPjIyxsBIPJA6/PIXCx94QM9 CTQ1Nf63DOUSZyV1WuQWhgCQ06tgKDEueZ9Vqr9tUB7enSAtn1glTLM04gzGBRhJ8m y9zngyF4C03gp/uBeYetGUxCSxHPeHtAghHNYT8S4byu3a/DrXzxCBHLOMpO2fNmN6 7CDZmMIX2CqYDE4H0PvXsy8tp1IRWatyHOUo9xT4OdTYKBG0OC4lkK8naVHBWy3Tnu vkl/q66P9HunA== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIolb-000RHy-Ns; Wed, 04 Dec 2024 12:46:07 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 10/11] PCI: apple: Convert to MSI parent infrastructure Date: Wed, 4 Dec 2024 12:45:48 +0000 Message-Id: <20241204124549.607054-11-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_044611_385978_F9620FEC X-CRM114-Status: GOOD ( 20.02 ) 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 In an effort to move arm64 away from the legacy MSI setup, convert the apple PCIe driver to the MSI-parent infrastructure and let each device have its own MSI domain. Signed-off-by: Marc Zyngier --- drivers/pci/controller/Kconfig | 1 + drivers/pci/controller/pcie-apple.c | 57 ++++++++--------------------- 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig index 9800b76810540..98a62f4559dfd 100644 --- a/drivers/pci/controller/Kconfig +++ b/drivers/pci/controller/Kconfig @@ -40,6 +40,7 @@ config PCIE_APPLE depends on OF depends on PCI_MSI select PCI_HOST_COMMON + select IRQ_MSI_LIB help Say Y here if you want to enable PCIe controller support on Apple system-on-chips, like the Apple M1. This is required for the USB diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c index fefab2758a064..945070ac31cf8 100644 --- a/drivers/pci/controller/pcie-apple.c +++ b/drivers/pci/controller/pcie-apple.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -134,7 +135,6 @@ struct apple_pcie { struct mutex lock; struct device *dev; void __iomem *base; - struct irq_domain *domain; unsigned long *bitmap; struct list_head ports; struct completion event; @@ -163,27 +163,6 @@ static void rmw_clear(u32 clr, void __iomem *addr) writel_relaxed(readl_relaxed(addr) & ~clr, addr); } -static void apple_msi_top_irq_mask(struct irq_data *d) -{ - pci_msi_mask_irq(d); - irq_chip_mask_parent(d); -} - -static void apple_msi_top_irq_unmask(struct irq_data *d) -{ - pci_msi_unmask_irq(d); - irq_chip_unmask_parent(d); -} - -static struct irq_chip apple_msi_top_chip = { - .name = "PCIe MSI", - .irq_mask = apple_msi_top_irq_mask, - .irq_unmask = apple_msi_top_irq_unmask, - .irq_eoi = irq_chip_eoi_parent, - .irq_set_affinity = irq_chip_set_affinity_parent, - .irq_set_type = irq_chip_set_type_parent, -}; - static void apple_msi_compose_msg(struct irq_data *data, struct msi_msg *msg) { msg->address_hi = upper_32_bits(DOORBELL_ADDR); @@ -227,8 +206,7 @@ static int apple_msi_domain_alloc(struct irq_domain *domain, unsigned int virq, for (i = 0; i < nr_irqs; i++) { irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i, - &apple_msi_bottom_chip, - domain->host_data); + &apple_msi_bottom_chip, pcie); } return 0; @@ -252,12 +230,6 @@ static const struct irq_domain_ops apple_msi_domain_ops = { .free = apple_msi_domain_free, }; -static struct msi_domain_info apple_msi_info = { - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | - MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX), - .chip = &apple_msi_top_chip, -}; - static void apple_port_irq_mask(struct irq_data *data) { struct apple_pcie_port *port = irq_data_get_irq_chip_data(data); @@ -596,6 +568,17 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, return 0; } +static const struct msi_parent_ops apple_msi_parent_ops = { + .supported_flags = (MSI_GENERIC_FLAGS_MASK | + MSI_FLAG_PCI_MSIX | + MSI_FLAG_MULTI_PCI_MSI), + .required_flags = (MSI_FLAG_USE_DEF_DOM_OPS | + MSI_FLAG_USE_DEF_CHIP_OPS | + MSI_FLAG_PCI_MSI_MASK_PARENT), + .bus_select_token = DOMAIN_BUS_PCI_MSI, + .init_dev_msi_info = msi_lib_init_dev_msi_info, +}; + static int apple_msi_init(struct apple_pcie *pcie) { struct fwnode_handle *fwnode = dev_fwnode(pcie->dev); @@ -626,21 +609,13 @@ static int apple_msi_init(struct apple_pcie *pcie) return -ENXIO; } - parent = irq_domain_create_hierarchy(parent, 0, pcie->nvecs, fwnode, - &apple_msi_domain_ops, pcie); + parent = msi_create_parent_irq_domain(fwnode, &apple_msi_parent_ops, + &apple_msi_domain_ops, 0, + pcie->nvecs, pcie, parent); if (!parent) { dev_err(pcie->dev, "failed to create IRQ domain\n"); return -ENOMEM; } - irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS); - - pcie->domain = pci_msi_create_irq_domain(fwnode, &apple_msi_info, - parent); - if (!pcie->domain) { - dev_err(pcie->dev, "failed to create MSI domain\n"); - irq_domain_remove(parent); - return -ENOMEM; - } return 0; } From patchwork Wed Dec 4 12:45:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13893734 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 0E0F1E77173 for ; Wed, 4 Dec 2024 12:58:42 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KTlyoZd0Z8X3Ax+8OlWTkIefIPquaGyJJBQOFPH0lCo=; b=Lx081HhjDXoCbmK0nUTgVZg6xq oM5h0Ed35mhwY6vM3twQWwjXg02IcDyJUIRw7p1WR6fdc18dw8gkJ9U8CcUesFXQt1MKDE3Qz6HB+ 6ZEEJAWdPuY7ctG3tbR73D5yO0kXjmuA+SXQ6tSBkOFQmubIOuJBSGm3XU07MfW5ZjyDuVVyTUxo+ +FG/Tl0prw6B1acTJjvV2FRsLMfnMLy1tXb2P/UwBe34s0WHyzooLrhXfUPerooMdDP+iRftQBwsR XE1nQwT1eP/n2lK3cZlw1MSd/M4iEXVE/5xCVlsCncQ0i1vauSvgvcnreSghku3kzMyFqvxJ7gOzx 1BKiUaKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIoxa-0000000CbGs-36f9; Wed, 04 Dec 2024 12:58:30 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolk-0000000CYab-2qXx; Wed, 04 Dec 2024 12:46:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=KTlyoZd0Z8X3Ax+8OlWTkIefIPquaGyJJBQOFPH0lCo=; b=BiLilogvHdarUqJNzyyqKwPwMi aGFvMMjzpm0yDfXaXgrAh/464Ajo6ka+/LylWQ3wKtuAFi96U8GNOIn5ib61u2TcwjgPs51s/A2iA Kk1bkGQioSkqgFPA5Hvq7+xOEfAEr7XkOZA15JSCACRKcYGcvjrWdPu7ii1e1encl7krsdYTEPwrU 09J9lsCwh7blpzOZkvYY3QLEBJIPsXfggR8B2rotrVEcqXr+2FYIL2dHOkEsfJMW94E8yQlCGamiD KajVUKr35nJbVnpsGlPNy2qTj+vziuvS9TRI3ugjkO23VwgfP1z7KUGGE6e9ITp++IYU0E2jn7ezr yJ8OpWag==; Received: from nyc.source.kernel.org ([147.75.193.91]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIolh-00000002b10-353m; Wed, 04 Dec 2024 12:46:15 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1B9EEA416F5; Wed, 4 Dec 2024 12:44:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D740C4CEE4; Wed, 4 Dec 2024 12:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733316370; bh=WovDOhGvJI34dfRdwLOil5noAJ5CREZZX4oJMEsuV3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eUOAOGxDdJCpu9CKizY2dme6+QjXgFdhMgbIAtu+zIYKisA9lS0WvyerxS1fXCxPY t3j55q66bUY9eCYymATDsBvYYd+IqYHPtn1e7vQx3RJyDLiWiiZcmWyYHYRa/Yb0Ln MP23MO1U0GrTvYw679XpCjcEmsS67z6gvNhik4vdE+Epv3wWWPgKxGcKHztdtZTY8F N9Gp8NbO7A3+t5/Kz0j7J765cEhdqVSHzFEjI6t+yuOY4AYcZ2dLyldBbRb0UGDIw9 fuFJc9P29p0HnKXgUxtCjZp6djxgFRjuSXkSuWYGjCHcqcKpWMnMXvvqIlIh5EjUI1 7fYhjW87yzjFQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tIolc-000RHy-5S; Wed, 04 Dec 2024 12:46:08 +0000 From: Marc Zyngier To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Thomas Gleixner , Shawn Guo , Sascha Hauer , Fabio Estevam , Huacai Chen , WANG Xuerui , Jiaxun Yang , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Toan Le , Alyssa Rosenzweig Subject: [PATCH 11/11] PCI: xgene: Convert to MSI parent infrastructure Date: Wed, 4 Dec 2024 12:45:49 +0000 Message-Id: <20241204124549.607054-12-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241204124549.607054-1-maz@kernel.org> References: <20241204124549.607054-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, joro@8bytes.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, tglx@linutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, bhelgaas@google.com, toan@os.amperecomputing.com, alyssa@rosenzweig.io X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241204_124614_088860_CDFC33E4 X-CRM114-Status: GOOD ( 17.46 ) 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 In an effort to move arm64 away from the legacy MSI setup, convert the xgene PCIe driver to the MSI-parent infrastructure and let each device have its own MSI domain. Signed-off-by: Marc Zyngier --- drivers/pci/controller/Kconfig | 1 + drivers/pci/controller/pci-xgene-msi.c | 44 +++++++++----------------- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig index 98a62f4559dfd..205e0e365c6b1 100644 --- a/drivers/pci/controller/Kconfig +++ b/drivers/pci/controller/Kconfig @@ -304,6 +304,7 @@ config PCI_XGENE_MSI bool "X-Gene v1 PCIe MSI feature" depends on PCI_XGENE depends on PCI_MSI + select IRQ_MSI_LIB default y help Say Y here if you want PCIe MSI support for the APM X-Gene v1 SoC. diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c index 88c0977bc41a4..d9e4d1e136f77 100644 --- a/drivers/pci/controller/pci-xgene-msi.c +++ b/drivers/pci/controller/pci-xgene-msi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,6 @@ struct xgene_msi_group { struct xgene_msi { struct device_node *node; struct irq_domain *inner_domain; - struct irq_domain *msi_domain; u64 msi_addr; void __iomem *msi_regs; unsigned long *bitmap; @@ -44,20 +44,6 @@ struct xgene_msi { /* Global data */ static struct xgene_msi xgene_msi_ctrl; -static struct irq_chip xgene_msi_top_irq_chip = { - .name = "X-Gene1 MSI", - .irq_enable = pci_msi_unmask_irq, - .irq_disable = pci_msi_mask_irq, - .irq_mask = pci_msi_mask_irq, - .irq_unmask = pci_msi_unmask_irq, -}; - -static struct msi_domain_info xgene_msi_domain_info = { - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | - MSI_FLAG_PCI_MSIX), - .chip = &xgene_msi_top_irq_chip, -}; - /* * X-Gene v1 has 16 groups of MSI termination registers MSInIRx, where * n is group number (0..F), x is index of registers in each group (0..7) @@ -235,34 +221,34 @@ static void xgene_irq_domain_free(struct irq_domain *domain, irq_domain_free_irqs_parent(domain, virq, nr_irqs); } -static const struct irq_domain_ops msi_domain_ops = { +static const struct irq_domain_ops xgene_msi_domain_ops = { .alloc = xgene_irq_domain_alloc, .free = xgene_irq_domain_free, }; +static const struct msi_parent_ops xgene_msi_parent_ops = { + .supported_flags = (MSI_GENERIC_FLAGS_MASK | + MSI_FLAG_PCI_MSIX), + .required_flags = (MSI_FLAG_USE_DEF_DOM_OPS | + MSI_FLAG_USE_DEF_CHIP_OPS), + .bus_select_token = DOMAIN_BUS_PCI_MSI, + .init_dev_msi_info = msi_lib_init_dev_msi_info, +}; + static int xgene_allocate_domains(struct xgene_msi *msi) { - msi->inner_domain = irq_domain_add_linear(NULL, NR_MSI_VEC, - &msi_domain_ops, msi); + msi->inner_domain = msi_create_parent_irq_domain(of_node_to_fwnode(msi->node), + &xgene_msi_parent_ops, + &xgene_msi_domain_ops, + 0, NR_MSI_VEC, msi, NULL); if (!msi->inner_domain) return -ENOMEM; - msi->msi_domain = pci_msi_create_irq_domain(of_node_to_fwnode(msi->node), - &xgene_msi_domain_info, - msi->inner_domain); - - if (!msi->msi_domain) { - irq_domain_remove(msi->inner_domain); - return -ENOMEM; - } - return 0; } static void xgene_free_domains(struct xgene_msi *msi) { - if (msi->msi_domain) - irq_domain_remove(msi->msi_domain); if (msi->inner_domain) irq_domain_remove(msi->inner_domain); }