Skip to content

Commit 06fe8fd

Browse files
nipung87awilliam
authored andcommitted
genirq/msi: Add MSI allocation helper and export MSI functions
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]>
1 parent 82b951e commit 06fe8fd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/linux/msi.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,12 @@ int platform_device_msi_init_and_alloc_irqs(struct device *dev, unsigned int nve
676676
void platform_device_msi_free_irqs_all(struct device *dev);
677677

678678
bool msi_device_has_isolated_msi(struct device *dev);
679+
680+
static inline int msi_domain_alloc_irqs(struct device *dev, unsigned int domid, int nirqs)
681+
{
682+
return msi_domain_alloc_irqs_range(dev, domid, 0, nirqs - 1);
683+
}
684+
679685
#else /* CONFIG_GENERIC_MSI_IRQ */
680686
static inline bool msi_device_has_isolated_msi(struct device *dev)
681687
{

kernel/irq/msi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,7 @@ int msi_domain_alloc_irqs_range(struct device *dev, unsigned int domid,
14341434
msi_unlock_descs(dev);
14351435
return ret;
14361436
}
1437+
EXPORT_SYMBOL_GPL(msi_domain_alloc_irqs_range);
14371438

14381439
/**
14391440
* 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,
16801681
msi_domain_free_irqs_range_locked(dev, domid, first, last);
16811682
msi_unlock_descs(dev);
16821683
}
1684+
EXPORT_SYMBOL_GPL(msi_domain_free_irqs_all);
16831685

16841686
/**
16851687
* msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain

0 commit comments

Comments
 (0)