[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <159534736176.28840.5547007059232964457.stgit@djiang5-desk3.ch.intel.com>
Date: Tue, 21 Jul 2020 09:02:41 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: vkoul@...nel.org, megha.dey@...el.com, maz@...nel.org,
bhelgaas@...gle.com, rafael@...nel.org, gregkh@...uxfoundation.org,
tglx@...utronix.de, hpa@...or.com, alex.williamson@...hat.com,
jacob.jun.pan@...el.com, ashok.raj@...el.com, jgg@...lanox.com,
yi.l.liu@...el.com, baolu.lu@...el.com, kevin.tian@...el.com,
sanjay.k.kumar@...el.com, tony.luck@...el.com, jing.lin@...el.com,
dan.j.williams@...el.com, kwankhede@...dia.com,
eric.auger@...hat.com, parav@...lanox.com, jgg@...lanox.com,
rafael@...nel.org, dave.hansen@...el.com, netanelg@...lanox.com,
shahafs@...lanox.com, yan.y.zhao@...ux.intel.com,
pbonzini@...hat.com, samuel.ortiz@...el.com, mona.hossain@...el.com
Cc: dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
x86@...nel.org, linux-pci@...r.kernel.org, kvm@...r.kernel.org
Subject: [PATCH RFC v2 04/18] irq/dev-msi: Introduce APIs to allocate/free
dev-msi interrupts
From: Megha Dey <megha.dey@...el.com>
The dev-msi interrupts are to be allocated/freed only for custom devices,
not standard PCI-MSIX devices.
These interrupts are device-defined and they are distinct from the already
existing msi interrupts:
pci-msi: Standard PCI MSI/MSI-X setup format
platform-msi: Platform custom, but device-driver opaque MSI setup/control
arch-msi: fallback for devices not assigned to the generic PCI domain
dev-msi: device defined IRQ domain for ancillary devices. For e.g. DSA
portal devices use device specific IMS(Interrupt message store) interrupts.
dev-msi interrupts are represented by their own device-type. That means
dev->msi_list is never contended for different interrupt types. It
will either be all PCI-MSI or all device-defined.
Reviewed-by: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Megha Dey <megha.dey@...el.com>
Signed-off-by: Dave Jiang <dave.jiang@...el.com>
---
drivers/base/dev-msi.c | 23 +++++++++++++++++++++++
include/linux/msi.h | 4 ++++
2 files changed, 27 insertions(+)
diff --git a/drivers/base/dev-msi.c b/drivers/base/dev-msi.c
index 43d6ed3ba10f..4cc75bfd62da 100644
--- a/drivers/base/dev-msi.c
+++ b/drivers/base/dev-msi.c
@@ -145,3 +145,26 @@ struct irq_domain *create_remap_dev_msi_irq_domain(struct irq_domain *parent,
return domain;
}
#endif
+
+int dev_msi_domain_alloc_irqs(struct device *dev, unsigned int nvec,
+ const struct platform_msi_ops *platform_ops)
+{
+ if (!dev->msi_domain) {
+ dev->msi_domain = dev_msi_default_domain;
+ } else if (dev->msi_domain != dev_msi_default_domain) {
+ dev_WARN_ONCE(dev, 1, "already registered to another irq domain?\n");
+ return -ENXIO;
+ }
+
+ return platform_msi_domain_alloc_irqs(dev, nvec, platform_ops);
+}
+EXPORT_SYMBOL_GPL(dev_msi_domain_alloc_irqs);
+
+void dev_msi_domain_free_irqs(struct device *dev)
+{
+ if (dev->msi_domain != dev_msi_default_domain)
+ dev_WARN_ONCE(dev, 1, "registered to incorrect irq domain?\n");
+
+ platform_msi_domain_free_irqs(dev);
+}
+EXPORT_SYMBOL_GPL(dev_msi_domain_free_irqs);
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 7098ba566bcd..9dde8a43a0f7 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -381,6 +381,10 @@ void platform_msi_mask_irq(struct irq_data *data);
int dev_msi_prepare(struct irq_domain *domain, struct device *dev,
int nvec, msi_alloc_info_t *arg);
+
+int dev_msi_domain_alloc_irqs(struct device *dev, unsigned int nvec,
+ const struct platform_msi_ops *platform_ops);
+void dev_msi_domain_free_irqs(struct device *dev);
#endif /* CONFIG_GENERIC_MSI_IRQ_DOMAIN */
#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
Powered by blists - more mailing lists