xref: /linux-6.15/include/linux/msi_api.h (revision 98043704)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef LINUX_MSI_API_H
3 #define LINUX_MSI_API_H
4 
5 /*
6  * APIs which are relevant for device driver code for allocating and
7  * freeing MSI interrupts and querying the associations between
8  * hardware/software MSI indices and the Linux interrupt number.
9  */
10 
11 struct device;
12 
13 /*
14  * Per device interrupt domain related constants.
15  */
16 enum msi_domain_ids {
17 	MSI_DEFAULT_DOMAIN,
18 	MSI_MAX_DEVICE_IRQDOMAINS,
19 };
20 
21 unsigned int msi_domain_get_virq(struct device *dev, unsigned int domid, unsigned int index);
22 
23 /**
24  * msi_get_virq - Lookup the Linux interrupt number for a MSI index on the default interrupt domain
25  * @dev:	Device for which the lookup happens
26  * @index:	The MSI index to lookup
27  *
28  * Return: The Linux interrupt number on success (> 0), 0 if not found
29  */
30 static inline unsigned int msi_get_virq(struct device *dev, unsigned int index)
31 {
32 	return msi_domain_get_virq(dev, MSI_DEFAULT_DOMAIN, index);
33 }
34 
35 #endif
36