Commit 8c41ccec authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAnna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: default avatarShivamurthy Shastri <shivamurthy.shastri@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240623142234.964056815@linutronix.de

parent 48f71d56
...@@ -28,6 +28,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain, ...@@ -28,6 +28,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
struct msi_domain_info *info) struct msi_domain_info *info)
{ {
const struct msi_parent_ops *pops = real_parent->msi_parent_ops; const struct msi_parent_ops *pops = real_parent->msi_parent_ops;
u32 required_flags;
/* Parent ops available? */ /* Parent ops available? */
if (WARN_ON_ONCE(!pops)) if (WARN_ON_ONCE(!pops))
...@@ -46,8 +47,16 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain, ...@@ -46,8 +47,16 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
return false; return false;
} }
required_flags = pops->required_flags;
/* Is the target domain bus token supported? */ /* Is the target domain bus token supported? */
switch(info->bus_token) { switch(info->bus_token) {
case DOMAIN_BUS_PCI_DEVICE_MSI:
case DOMAIN_BUS_PCI_DEVICE_MSIX:
if (WARN_ON_ONCE(!IS_ENABLED(CONFIG_PCI_MSI)))
return false;
break;
default: default:
/* /*
* This should never be reached. See * This should never be reached. See
...@@ -63,7 +72,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain, ...@@ -63,7 +72,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
*/ */
info->flags &= pops->supported_flags; info->flags &= pops->supported_flags;
/* Enforce the required flags */ /* Enforce the required flags */
info->flags |= pops->required_flags; info->flags |= required_flags;
/* Chip updates for all child bus types */ /* Chip updates for all child bus types */
if (!info->chip->irq_eoi) if (!info->chip->irq_eoi)
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include <linux/msi.h> #include <linux/msi.h>
#ifdef CONFIG_PCI_MSI
#define MATCH_PCI_MSI BIT(DOMAIN_BUS_PCI_MSI)
#else
#define MATCH_PCI_MSI (0)
#endif
int msi_lib_irq_domain_select(struct irq_domain *d, struct irq_fwspec *fwspec, int msi_lib_irq_domain_select(struct irq_domain *d, struct irq_fwspec *fwspec,
enum irq_domain_bus_token bus_token); enum irq_domain_bus_token bus_token);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment