]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
irqchip/msi-lib: Add IRQ_DOMAIN_FLAG_FWNODE_PARENT handling
authorLorenzo Pieralisi <lpieralisi@kernel.org>
Thu, 3 Jul 2025 10:25:17 +0000 (12:25 +0200)
committerMarc Zyngier <maz@kernel.org>
Tue, 8 Jul 2025 17:35:52 +0000 (18:35 +0100)
In some irqchip implementations the fwnode representing the IRQdomain
and the MSI controller fwnode do not match; in particular the IRQdomain
fwnode is the MSI controller fwnode parent.

To support selecting such IRQ domains, add a flag in core IRQ domain
code that explicitly tells the MSI lib to use the parent fwnode while
carrying out IRQ domain selection.

Update the msi-lib select callback with the resulting logic.

Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250703-gicv5-host-v7-27-12e71f1b3528@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
drivers/irqchip/irq-msi-lib.c
include/linux/irqdomain.h

index 246c30205af40f7c296ed756d3add89015a0ec7d..454c7f16dd4d6fb4093ee3e5526555d944657b95 100644 (file)
@@ -133,11 +133,14 @@ int msi_lib_irq_domain_select(struct irq_domain *d, struct irq_fwspec *fwspec,
 {
        const struct msi_parent_ops *ops = d->msi_parent_ops;
        u32 busmask = BIT(bus_token);
+       struct fwnode_handle *fwh;
 
        if (!ops)
                return 0;
 
-       if (fwspec->fwnode != d->fwnode || fwspec->param_count != 0)
+       fwh = d->flags & IRQ_DOMAIN_FLAG_FWNODE_PARENT ? fwnode_get_parent(fwspec->fwnode)
+                                                      : fwspec->fwnode;
+       if (fwh != d->fwnode || fwspec->param_count != 0)
                return 0;
 
        /* Handle pure domain searches */
index 7387d183029b7b83486698249984b6adbb01a30f..25c7cbeed39368330f0d3bfdc7b253e13ced797a 100644 (file)
@@ -212,6 +212,9 @@ enum {
        /* Address and data pair is mutable when irq_set_affinity() */
        IRQ_DOMAIN_FLAG_MSI_IMMUTABLE   = (1 << 11),
 
+       /* IRQ domain requires parent fwnode matching */
+       IRQ_DOMAIN_FLAG_FWNODE_PARENT   = (1 << 12),
+
        /*
         * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
         * for implementation specific purposes and ignored by the