[patch V2 32/40] genirq/msi: Provide MSI_FLAG_PARENT_PM_DEV

From: Thomas Gleixner
Date: Mon Nov 21 2022 - 09:51:29 EST


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@xxxxxxxxxxxxx>
---
include/linux/msi.h | 2 ++
kernel/irq/msi.c | 2 ++
2 files changed, 4 insertions(+)

--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -538,6 +538,8 @@ enum {
MSI_FLAG_NOMASK_QUIRK = (1 << 7),
/* Use dev->fwnode for MSI device domain creation */
MSI_FLAG_USE_DEV_FWNODE = (1 << 8),
+ /* Set parent->dev into domain->pm_dev on device domain creation */
+ MSI_FLAG_PARENT_PM_DEV = (1 << 9),

/* Mask for the generic functionality */
MSI_GENERIC_FLAGS_MASK = GENMASK(15, 0),
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -884,6 +884,8 @@ static struct irq_domain *__msi_create_i
if (!domain->name && info->chip)
domain->name = info->chip->name;
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;