]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
genirq/msi: Provide MSI_FLAG_PARENT_PM_DEV
authorThomas Gleixner <tglx@linutronix.de>
Sat, 27 Jan 2024 16:17:41 +0000 (21:47 +0530)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 15 Feb 2024 16:55:41 +0000 (17:55 +0100)
Some platform-MSI implementations require that power management is
redirected to the underlying interrupt chip device. To make this work
with per device MSI domains provide a new feature flag and let the
core code handle the setup of dev->pm_dev when set during device MSI
domain creation.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240127161753.114685-14-apatel@ventanamicro.com
include/linux/msi.h
kernel/irq/msi.c

index 36ba6a0852ea422bfb1602c2788d973da46af635..26d07e23052e05d26ca3ca9deaca219e173577d5 100644 (file)
@@ -554,6 +554,8 @@ enum {
        MSI_FLAG_FREE_MSI_DESCS         = (1 << 6),
        /* Use dev->fwnode for MSI device domain creation */
        MSI_FLAG_USE_DEV_FWNODE         = (1 << 7),
+       /* Set parent->dev into domain->pm_dev on device domain creation */
+       MSI_FLAG_PARENT_PM_DEV          = (1 << 8),
 
        /* Mask for the generic functionality */
        MSI_GENERIC_FLAGS_MASK          = GENMASK(15, 0),
index 07e9daaf065725426aa6d556b5931031981ac4f0..f90952ebc494111ca5bedea2e4951da84618c2fa 100644 (file)
@@ -845,8 +845,11 @@ static struct irq_domain *__msi_create_irq_domain(struct fwnode_handle *fwnode,
        domain = irq_domain_create_hierarchy(parent, flags | IRQ_DOMAIN_FLAG_MSI, 0,
                                             fwnode, &msi_domain_ops, info);
 
-       if (domain)
+       if (domain) {
                irq_domain_update_bus_token(domain, info->bus_token);
+               if (info->flags & MSI_FLAG_PARENT_PM_DEV)
+                       domain->pm_dev = parent->pm_dev;
+       }
 
        return domain;
 }