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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 27 Jun 2022 17:31:14 +0200
From:   Geert Uytterhoeven <geert+renesas@...der.be>
To:     Vignesh Raghavendra <vigneshr@...com>,
        Sergey Shtylyov <s.shtylyov@....ru>,
        Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Richard Weinberger <richard@....at>
Cc:     Mark Brown <broonie@...nel.org>, linux-mtd@...ts.infradead.org,
        linux-renesas-soc@...r.kernel.org, linux-spi@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH 7/7] memory: renesas-rpc-if: Reinitialize registers during system resume

During PSCI system suspend, R-Car Gen3 SoCs may be powered down, and
thus the RPC-IF register state may be lost.  Consequently, when using
the RPC-IF after system resume, data corruption may happen.

Fix this by reinitializing the hardware state during system resume.
As this requires resuming the RPC-IF core device, this can only be done
when the device is under active control of the HyperBus or SPI child
driver.

Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
---
 drivers/memory/renesas-rpc-if.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index ec76e603ad24d214..2a49d4511c8296c5 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -757,6 +757,20 @@ static int rpcif_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static int rpcif_resume(struct device *dev)
+{
+	struct rpcif_priv *rpc = dev_get_drvdata(dev);
+
+	if (!pm_runtime_enabled(dev)) {
+		/* Not yet activated or deactivated by child device */
+		return 0;
+	}
+
+	return rpcif_hw_init(dev, rpc->bus_size == 2);
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(rpcif_pm_ops, NULL, rpcif_resume);
+
 static const struct of_device_id rpcif_of_match[] = {
 	{ .compatible = "renesas,rcar-gen3-rpc-if", .data = (void *)RPCIF_RCAR_GEN3 },
 	{ .compatible = "renesas,rzg2l-rpc-if", .data = (void *)RPCIF_RZ_G2L },
@@ -770,6 +784,7 @@ static struct platform_driver rpcif_driver = {
 	.driver = {
 		.name =	"rpc-if",
 		.of_match_table = rpcif_of_match,
+		.pm = pm_sleep_ptr(&rpcif_pm_ops),
 	},
 };
 module_platform_driver(rpcif_driver);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ