]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
irqdomain: Add IRQ_DOMAIN_FLAG_MSI_IMMUTABLE and irq_domain_is_msi_immutable()
authorFrank Li <Frank.Li@nxp.com>
Mon, 14 Apr 2025 18:30:56 +0000 (14:30 -0400)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 7 May 2025 15:49:00 +0000 (17:49 +0200)
Add the flag IRQ_DOMAIN_FLAG_MSI_IMMUTABLE and the API function
irq_domain_is_msi_immutable() to check if the MSI controller retains an
immutable address/data pair during irq_set_affinity().

Ensure compatibility with MSI users like PCIe Endpoint Doorbell, which
require the address/data pair to remain unchanged after setup. Use this
function to verify if the MSI controller is immutable.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250414-ep-msi-v18-2-f69b49917464@nxp.com
include/linux/irqdomain.h

index bb7111105296ff4416c0875758a481eb510c9d7c..bccfff5bebe23249d00a75176b882ba5e56dc535 100644 (file)
@@ -231,6 +231,9 @@ enum {
        /* Irq domain must destroy generic chips when removed */
        IRQ_DOMAIN_FLAG_DESTROY_GC      = (1 << 10),
 
+       /* Address and data pair is mutable when irq_set_affinity() */
+       IRQ_DOMAIN_FLAG_MSI_IMMUTABLE   = (1 << 11),
+
        /*
         * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
         * for implementation specific purposes and ignored by the
@@ -691,6 +694,10 @@ static inline bool irq_domain_is_msi_device(struct irq_domain *domain)
        return domain->flags & IRQ_DOMAIN_FLAG_MSI_DEVICE;
 }
 
+static inline bool irq_domain_is_msi_immutable(struct irq_domain *domain)
+{
+       return domain->flags & IRQ_DOMAIN_FLAG_MSI_IMMUTABLE;
+}
 #else  /* CONFIG_IRQ_DOMAIN_HIERARCHY */
 static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
                        unsigned int nr_irqs, int node, void *arg)