]> Git Repo - J-linux.git/commitdiff
genirq/msi: Add MSI allocation helper and export MSI functions
authorNipun Gupta <[email protected]>
Tue, 23 Apr 2024 11:10:20 +0000 (16:40 +0530)
committerAlex Williamson <[email protected]>
Tue, 23 Apr 2024 20:27:52 +0000 (14:27 -0600)
MSI functions for allocation and free can be directly used by
the device drivers without any wrapper provided by bus drivers.
So export these MSI functions.

Also, add a wrapper API to allocate MSIs providing only the
number of interrupts rather than range for simpler driver usage.

Signed-off-by: Nipun Gupta <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
include/linux/msi.h
kernel/irq/msi.c

index 26d07e23052e05d26ca3ca9deaca219e173577d5..765a65581a662e50507497c03f554ad13c530d3f 100644 (file)
@@ -676,6 +676,12 @@ int platform_device_msi_init_and_alloc_irqs(struct device *dev, unsigned int nve
 void platform_device_msi_free_irqs_all(struct device *dev);
 
 bool msi_device_has_isolated_msi(struct device *dev);
+
+static inline int msi_domain_alloc_irqs(struct device *dev, unsigned int domid, int nirqs)
+{
+       return msi_domain_alloc_irqs_range(dev, domid, 0, nirqs - 1);
+}
+
 #else /* CONFIG_GENERIC_MSI_IRQ */
 static inline bool msi_device_has_isolated_msi(struct device *dev)
 {
index f90952ebc494111ca5bedea2e4951da84618c2fa..2024f89baea4bfe1dc4131139be4ea479049d460 100644 (file)
@@ -1434,6 +1434,7 @@ int msi_domain_alloc_irqs_range(struct device *dev, unsigned int domid,
        msi_unlock_descs(dev);
        return ret;
 }
+EXPORT_SYMBOL_GPL(msi_domain_alloc_irqs_range);
 
 /**
  * msi_domain_alloc_irqs_all_locked - Allocate all interrupts from a MSI interrupt domain
@@ -1680,6 +1681,7 @@ void msi_domain_free_irqs_range(struct device *dev, unsigned int domid,
        msi_domain_free_irqs_range_locked(dev, domid, first, last);
        msi_unlock_descs(dev);
 }
+EXPORT_SYMBOL_GPL(msi_domain_free_irqs_all);
 
 /**
  * msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain
This page took 0.051647 seconds and 4 git commands to generate.