[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <167026472045.4906.13119084508984817791.tip-bot2@tip-bot2>
Date: Mon, 05 Dec 2022 18:25:20 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Kevin Tian <kevin.tian@...el.com>,
Marc Zyngier <maz@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: irq/core] genirq/msi: Add pointers for per device irq domains
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 64258eaa442b0b7d7eac8942cf27863ad9e6028e
Gitweb: https://git.kernel.org/tip/64258eaa442b0b7d7eac8942cf27863ad9e6028e
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Fri, 25 Nov 2022 00:24:22 +01:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Mon, 05 Dec 2022 19:20:59 +01:00
genirq/msi: Add pointers for per device irq domains
With the upcoming per device MSI interrupt domain support it is necessary
to store the domain pointers per device.
Instead of delegating that storage to device drivers or subsystems add a
domain pointer to the msi_dev_domain array in struct msi_device_data.
This pointer is also used to take care of tearing down the irq domains when
msi_device_data is cleaned up via devres.
The interfaces into the MSI core will be changed from irqdomain pointer
based interfaces to domain id based interfaces to support multiple MSI
domains on a single device (e.g. PCI/MSI[-X] and PCI/IMS.
Once the per device domain support is complete the irq domain pointer in
struct device::msi.domain will not longer contain a pointer to the "global"
MSI domain. It will contain a pointer to the MSI parent domain instead.
It would be a horrible maze of conditionals to evaluate all over the place
which domain pointer should be used, i.e. the "global" one in
device::msi::domain or one from the internal pointer array.
To avoid this evaluate in msi_setup_device_data() whether the irq domain
which is associated to a device is a "global" or a parent MSI domain. If it
is global then copy the pointer into the first entry of the msi_dev_domain
array.
This allows to convert interfaces and implementation to domain ids while
keeping everything existing working.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Kevin Tian <kevin.tian@...el.com>
Acked-by: Marc Zyngier <maz@...nel.org>
Link: https://lore.kernel.org/r/20221124230313.923860399@linutronix.de
---
include/linux/msi.h | 3 +++
kernel/irq/msi.c | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/include/linux/msi.h b/include/linux/msi.h
index f7b9c41..fdbc80d 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -77,6 +77,7 @@ struct msi_desc;
struct pci_dev;
struct platform_msi_priv_data;
struct device_attribute;
+struct irq_domain;
void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
#ifdef CONFIG_GENERIC_MSI_IRQ
@@ -177,9 +178,11 @@ enum msi_desc_filter {
/**
* struct msi_dev_domain - The internals of MSI domain info per device
* @store: Xarray for storing MSI descriptor pointers
+ * @irqdomain: Pointer to a per device interrupt domain
*/
struct msi_dev_domain {
struct xarray store;
+ struct irq_domain *domain;
};
/**
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index c2bc94e..de65acc 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -220,6 +220,15 @@ int msi_setup_device_data(struct device *dev)
for (i = 0; i < MSI_MAX_DEVICE_IRQDOMAINS; i++)
xa_init(&md->__domains[i].store);
+ /*
+ * If @dev::msi::domain is set and is a global MSI domain, copy the
+ * pointer into the domain array so all code can operate on domain
+ * ids. The NULL pointer check is required to keep the legacy
+ * architecture specific PCI/MSI support working.
+ */
+ if (dev->msi.domain && !irq_domain_is_msi_parent(dev->msi.domain))
+ md->__domains[MSI_DEFAULT_DOMAIN].domain = dev->msi.domain;
+
mutex_init(&md->mutex);
dev->msi.data = md;
devres_add(dev, md);
Powered by blists - more mailing lists