lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220119143211.633399-1-nikita.yoush@cogentembedded.com>
Date:   Wed, 19 Jan 2022 17:32:11 +0300
From:   Nikita Yushchenko <nikita.yoush@...entembedded.com>
To:     Thomas Gleixner <tglx@...utronix.de>, Marc Zyngier <maz@...nel.org>
Cc:     linux-kernel@...r.kernel.org,
        Nikita Yushchenko <nikita.yoush@...entembedded.com>
Subject: [PATCH] irq: manage power of chip hierarchy

In case of hierarchical irq domains, it can be not enough to enable
power of the topmost chip at irq request time. Need to handle entire
chip hierarchy.

This patch updates irq_chip_pm_(get|put) to do so.

Signed-off-by: Nikita Yushchenko <nikita.yoush@...entembedded.com>
---
 kernel/irq/chip.c | 43 +++++++++++++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 6 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index f895265d7548..d1b786f29d30 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1569,15 +1569,30 @@ int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
  */
 int irq_chip_pm_get(struct irq_data *data)
 {
+#if IS_ENABLED(CONFIG_PM)
+	struct device *dev = data->chip->parent_device;
 	int retval;
 
-	if (IS_ENABLED(CONFIG_PM) && data->chip->parent_device) {
-		retval = pm_runtime_get_sync(data->chip->parent_device);
+#if IS_ENABLED(CONFIG_IRQ_DOMAIN_HIERARCHY)
+	if (data->parent_data) {
+		retval = irq_chip_pm_get(data->parent_data);
+		if (retval < 0)
+			return retval;
+	}
+#endif
+
+	if (dev) {
+		retval = pm_runtime_get_sync(dev);
 		if (retval < 0) {
-			pm_runtime_put_noidle(data->chip->parent_device);
+			pm_runtime_put_noidle(dev);
+#if IS_ENABLED(CONFIG_IRQ_DOMAIN_HIERARCHY)
+			if (data->parent_data)
+				irq_chip_pm_put(data->parent_data);
+#endif
 			return retval;
 		}
 	}
+#endif	/* CONFIG_PM */
 
 	return 0;
 }
@@ -1594,8 +1609,24 @@ int irq_chip_pm_put(struct irq_data *data)
 {
 	int retval = 0;
 
-	if (IS_ENABLED(CONFIG_PM) && data->chip->parent_device)
-		retval = pm_runtime_put(data->chip->parent_device);
+#if IS_ENABLED(CONFIG_PM)
+	do {
+		struct device *dev = data->chip->parent_device;
+		int retval2;
+
+		if (dev) {
+			retval2 = pm_runtime_put(dev);
+			if (retval == 0 && retval2 < 0)
+				retval = retval2;
+		}
+
+#if IS_ENABLED(CONFIG_IRQ_DOMAIN_HIERARCHY)
+		data = data->parent_data;
+#else
+		data = NULL;
+#endif
+	} while (data);
+#endif	/* CONFIG_PM */
 
-	return (retval < 0) ? retval : 0;
+	return retval;
 }
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ