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: <20221002144409.102132-1-petlozup@nvidia.com>
Date:   Sun, 2 Oct 2022 14:44:09 +0000
From:   Petlozu Pravareshwar <petlozup@...dia.com>
To:     <thierry.reding@...il.com>, <jonathanh@...dia.com>,
        <p.zabel@...gutronix.de>, <dmitry.osipenko@...labora.com>,
        <ulf.hansson@...aro.org>, <kkartik@...dia.com>,
        <cai.huoqing@...ux.dev>, <spatra@...dia.com>,
        <linux-tegra@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC:     <petlozup@...dia.com>, Prathamesh Shete <pshete@...dia.com>
Subject: [PATCH v2] soc/tegra: pmc: Process wake events during resume

During system resume, translate tier2 SC7 wake sources back into
irqs and do generic_handle_irq() to invoke the interrupt handlers
for edge triggered wake events such as sw-wake.

Signed-off-by: Prathamesh Shete <pshete@...dia.com>
Signed-off-by: Petlozu Pravareshwar <petlozup@...dia.com>
---
 drivers/soc/tegra/pmc.c | 42 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 66f94c011528..d166048de83c 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -23,6 +23,7 @@
 #include <linux/err.h>
 #include <linux/export.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/irqdomain.h>
@@ -3151,6 +3152,46 @@ static void wke_clear_wake_status(void)
 	}
 }
 
+/* translate sc7 wake sources back into irqs to catch edge triggered wakeups */
+static void process_wake_event(unsigned int index, unsigned long status)
+{
+	unsigned int irq, wake;
+	irq_hw_number_t hwirq;
+	struct irq_desc *desc;
+
+	dev_dbg(pmc->dev, "Wake[%d:%d]  status=0x%x\n", (index * 32) + 31,
+		index * 32, (u32)status);
+
+	for_each_set_bit(wake, &status, 32) {
+		hwirq = wake + 32 * index;
+
+		irq = irq_find_mapping(pmc->domain, hwirq);
+
+		desc = irq_to_desc(irq);
+		if (!desc || !desc->action || !desc->action->name) {
+			dev_dbg(pmc->dev, "Resume caused by WAKE%d, irq %d\n",
+				(wake + 32 * index), irq);
+			continue;
+		}
+		dev_dbg(pmc->dev, "Resume caused by WAKE%d, %s\n",
+			(wake + 32 * index), desc->action->name);
+		generic_handle_irq(irq);
+	}
+}
+
+static void tegra186_pmc_wake_syscore_resume(void)
+{
+	unsigned int i;
+	u32 status;
+
+	for (i = 0; i < pmc->soc->max_wake_vectors; i++) {
+		status = readl(pmc->wake + WAKE_AOWAKE_STATUS_R(i));
+		status = status & readl(pmc->wake +
+				WAKE_AOWAKE_TIER2_ROUTING(i));
+		process_wake_event(i, status);
+	}
+}
+
 static int tegra186_pmc_wake_syscore_suspend(void)
 {
 	wke_read_sw_wake_status();
@@ -3828,6 +3869,7 @@ static const struct tegra_pmc_regs tegra186_pmc_regs = {
 
 static struct syscore_ops tegra186_pmc_wake_syscore_ops = {
 	.suspend = tegra186_pmc_wake_syscore_suspend,
+	.resume = tegra186_pmc_wake_syscore_resume,
 };
 
 static void tegra186_pmc_init(struct tegra_pmc *pmc)
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ