diff mbox series

[PATCH/TEST] cpuidle: psci: Disable on R-Car H3 ES1.0 and R-Car S4-8 ES1.0

Message ID 7369c30e5b1c0d229a72be7df380653857496e66.1657620332.git.geert+renesas@glider.be (mailing list archive)
State RFC
Delegated to: Geert Uytterhoeven
Headers show
Series [PATCH/TEST] cpuidle: psci: Disable on R-Car H3 ES1.0 and R-Car S4-8 ES1.0 | expand

Commit Message

Geert Uytterhoeven July 12, 2022, 10:07 a.m. UTC
Some systems with early PSCI revisions have bugs in their CPUidle
implementations, causing lock-ups when CONFIG_ARM_PSCI_CPUIDLE is
enabled.

Add a quirk to detect them, and disable CPUidle accordingly:
  - On R-Car H3 ES1.0 with PSCI v1.0, enabling CPUidle causes RCU
    stalls, either during early boot, or while running the PSCI checker,
  - On R-Car S4-8 with early firmware stacks, enabling CPUidle causes
    Linux to lock up during early kernel boot.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Not intended for upstream merge.
Use only when needed.
---
 drivers/cpuidle/cpuidle-psci.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index 540105ca0781f1c3..ba0b90f96f7fe699 100644
--- a/drivers/cpuidle/cpuidle-psci.c
+++ b/drivers/cpuidle/cpuidle-psci.c
@@ -24,6 +24,7 @@ 
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/syscore_ops.h>
+#include <linux/sys_soc.h>
 
 #include <asm/cpuidle.h>
 
@@ -435,11 +436,22 @@  static struct platform_driver psci_cpuidle_driver = {
 	},
 };
 
+static const struct soc_device_attribute psci_cpuidle_broken[] = {
+	{ .soc_id = "r8a7795", .revision = "ES1.0", },	// PSCI v1.0
+	{ .soc_id = "r8a779f0", .revision = "ES1.0", },	// Early PSCI rev
+	{ /* sentinel */ }
+};
+
 static int __init psci_idle_init(void)
 {
 	struct platform_device *pdev;
 	int ret;
 
+	if (soc_device_match(psci_cpuidle_broken)) {
+		pr_info("Skipping %s\n", __func__);
+		return 0;
+	}
+
 	ret = platform_driver_register(&psci_cpuidle_driver);
 	if (ret)
 		return ret;