Skip to content

Commit 8c41cce

Browse files
committed
irqchip/irq-msi-lib: Prepare for PCI MSI/MSIX
Add the bus tokens for DOMAIN_BUS_PCI_DEVICE_MSI and DOMAIN_BUS_PCI_DEVICE_MSIX to the common child init function. Provide the match mask which can be used by parent domain implementation so the bitmask based child bus token match works. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Anna-Maria Behnsen <[email protected]> Signed-off-by: Shivamurthy Shastri <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 48f71d5 commit 8c41cce

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

drivers/irqchip/irq-msi-lib.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
2828
struct msi_domain_info *info)
2929
{
3030
const struct msi_parent_ops *pops = real_parent->msi_parent_ops;
31+
u32 required_flags;
3132

3233
/* Parent ops available? */
3334
if (WARN_ON_ONCE(!pops))
@@ -46,8 +47,16 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
4647
return false;
4748
}
4849

50+
required_flags = pops->required_flags;
51+
4952
/* Is the target domain bus token supported? */
5053
switch(info->bus_token) {
54+
case DOMAIN_BUS_PCI_DEVICE_MSI:
55+
case DOMAIN_BUS_PCI_DEVICE_MSIX:
56+
if (WARN_ON_ONCE(!IS_ENABLED(CONFIG_PCI_MSI)))
57+
return false;
58+
59+
break;
5160
default:
5261
/*
5362
* This should never be reached. See
@@ -63,7 +72,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
6372
*/
6473
info->flags &= pops->supported_flags;
6574
/* Enforce the required flags */
66-
info->flags |= pops->required_flags;
75+
info->flags |= required_flags;
6776

6877
/* Chip updates for all child bus types */
6978
if (!info->chip->irq_eoi)

drivers/irqchip/irq-msi-lib.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
#include <linux/irqdomain.h>
1010
#include <linux/msi.h>
1111

12+
#ifdef CONFIG_PCI_MSI
13+
#define MATCH_PCI_MSI BIT(DOMAIN_BUS_PCI_MSI)
14+
#else
15+
#define MATCH_PCI_MSI (0)
16+
#endif
17+
1218
int msi_lib_irq_domain_select(struct irq_domain *d, struct irq_fwspec *fwspec,
1319
enum irq_domain_bus_token bus_token);
1420

0 commit comments

Comments
 (0)