[PATCH 1/2] ARM: mvebu: Disable CPU Hotplug if PMSU is not available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The CPU hotplug needs accessing the PMSU register through the CPU Idle
functions. If we fail accessing these registers we need disabling
the CPU hotplug.

Cc: <stable@xxxxxxxxxxxxxxx> # v3.17+
Signed-off-by: Gregory CLEMENT <gregory.clement@xxxxxxxxxxxxxxxxxx>
---
 arch/arm/mach-mvebu/pmsu.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index d8ab605a44fa..0a8e2f548466 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -159,6 +159,11 @@ int mvebu_setup_boot_addr_wa(unsigned int crypto_eng_target,
 	return 0;
 }
 
+/*
+ * The CPU hotplug needs to access the PMSU register through the CPU
+ * Idle functions, if we fail to access these registers we need to
+ * disable the CPU hotplug.
+ */
 static int __init mvebu_v7_pmsu_init(void)
 {
 	struct device_node *np;
@@ -166,8 +171,10 @@ static int __init mvebu_v7_pmsu_init(void)
 	int ret = 0;
 
 	np = of_find_matching_node(NULL, of_pmsu_table);
-	if (!np)
+	if (!np) {
+		cpu_hotplug_disable();
 		return 0;
+	}
 
 	pr_info("Initializing Power Management Service Unit\n");
 
@@ -202,6 +209,8 @@ static int __init mvebu_v7_pmsu_init(void)
 
  out:
 	of_node_put(np);
+	if (ret)
+		cpu_hotplug_disable();
 	return ret;
 }
 
@@ -466,10 +475,15 @@ static __init int armada_xp_cpuidle_init(void)
 	return 0;
 }
 
+/*
+ * The CPU hotplug needs to access the PMSU register through the CPU
+ * Idle functions, if we fail to access these registers we need to
+ * disable the CPU hotplug.
+ */
 static int __init mvebu_v7_cpu_pm_init(void)
 {
 	struct device_node *np;
-	int ret;
+	int ret = 0;
 
 	np = of_find_matching_node(NULL, of_pmsu_table);
 	if (!np)
@@ -483,16 +497,20 @@ static int __init mvebu_v7_cpu_pm_init(void)
 	else if (of_machine_is_compatible("marvell,armada380"))
 		ret = armada_38x_cpuidle_init();
 	else
-		return 0;
+		goto pm_init_failed;
 
 	if (ret)
-		return ret;
+		goto pm_init_failed;
 
 	mvebu_v7_pmsu_enable_l2_powerdown_onidle();
 	platform_device_register(&mvebu_v7_cpuidle_device);
 	cpu_pm_register_notifier(&mvebu_v7_cpu_pm_notifier);
 
 	return 0;
+
+pm_init_failed:
+	cpu_hotplug_disable();
+	return ret;
 }
 
 arch_initcall(mvebu_v7_cpu_pm_init);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]