From: Marc Zyngier <maz@kernel.org>
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" <joro@8bytes.org>,
"Suravee Suthikulpanit" <suravee.suthikulpanit@amd.com>,
"David Woodhouse" <dwmw2@infradead.org>,
"Lu Baolu" <baolu.lu@linux.intel.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
"WANG Xuerui" <kernel@xen0n.name>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
"Anup Patel" <anup@brainfault.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Toan Le" <toan@os.amperecomputing.com>,
"Alyssa Rosenzweig" <alyssa@rosenzweig.io>
Subject: [PATCH 11/11] PCI: xgene: Convert to MSI parent infrastructure
Date: Wed, 4 Dec 2024 12:45:49 +0000 [thread overview]
Message-ID: <20241204124549.607054-12-maz@kernel.org> (raw)
In-Reply-To: <20241204124549.607054-1-maz@kernel.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 <maz@kernel.org>
---
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 <linux/module.h>
#include <linux/msi.h>
#include <linux/irqchip/chained_irq.h>
+#include <linux/irqchip/irq-msi-lib.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/of_pci.h>
@@ -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);
}
--
2.39.2
prev parent reply other threads:[~2024-12-04 12:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 12:45 [PATCH 00/11] irqchip: MSI parent cleanup and PCI host driver conversion Marc Zyngier
2024-12-04 12:45 ` [PATCH 01/11] irqchip: Make irq-msi-lib.h globally available Marc Zyngier
2024-12-04 12:45 ` [PATCH 02/11] genirq/msi: Add helper for creating MSI-parent irq domains Marc Zyngier
2024-12-04 13:57 ` Thomas Gleixner
2024-12-04 12:45 ` [PATCH 03/11] irqchip/gic: Convert to msi_create_parent_irq_domain() helper Marc Zyngier
2024-12-04 12:45 ` [PATCH 04/11] irqchip/mvebu: " Marc Zyngier
2024-12-04 12:45 ` [PATCH 05/11] irqchip/riscv-imsic: " Marc Zyngier
2025-07-03 14:00 ` [tip: irq/drivers] " tip-bot2 for Marc Zyngier
2024-12-04 12:45 ` [PATCH 06/11] irqchip/imx-mu-msi: " Marc Zyngier
2024-12-04 22:58 ` Frank Li
2025-07-03 14:00 ` [tip: irq/drivers] " tip-bot2 for Marc Zyngier
2024-12-04 12:45 ` [PATCH 07/11] irqchip/loongson-pch-msi: " Marc Zyngier
2024-12-04 12:45 ` [PATCH 08/11] iommu/amd: " Marc Zyngier
2024-12-04 12:45 ` [PATCH 09/11] iommu/intel: " Marc Zyngier
2024-12-04 12:45 ` [PATCH 10/11] PCI: apple: Convert to MSI parent infrastructure Marc Zyngier
2024-12-04 12:45 ` Marc Zyngier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241204124549.607054-12-maz@kernel.org \
--to=maz@kernel.org \
--cc=alyssa@rosenzweig.io \
--cc=andrew@lunn.ch \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=chenhuacai@kernel.org \
--cc=dwmw2@infradead.org \
--cc=festevam@gmail.com \
--cc=gregory.clement@bootlin.com \
--cc=iommu@lists.linux.dev \
--cc=jiaxun.yang@flygoat.com \
--cc=joro@8bytes.org \
--cc=kernel@xen0n.name \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=loongarch@lists.linux.dev \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=s.hauer@pengutronix.de \
--cc=sebastian.hesselbarth@gmail.com \
--cc=shawnguo@kernel.org \
--cc=suravee.suthikulpanit@amd.com \
--cc=tglx@linutronix.de \
--cc=toan@os.amperecomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox