summaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorQais Yousef <qais.yousef@arm.com>2020-03-23 14:51:01 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-03-25 12:59:34 +0100
commitd720f98604391dab6aa3cb4c1bc005ed1aba4703 (patch)
tree4aa30be79a98f962c38b731a507add852860d9db /kernel/cpu.c
parentarm64: Use reboot_cpu instead of hardconding it to 0 (diff)
downloadlinux-d720f98604391dab6aa3cb4c1bc005ed1aba4703.tar.xz
linux-d720f98604391dab6aa3cb4c1bc005ed1aba4703.zip
cpu/hotplug: Provide bringup_hibernate_cpu()
arm64 uses cpu_up() in the resume from hibernation code to ensure that the CPU on which the system hibernated is online. Provide a core function for this. [ tglx: Split out from the combo arm64 patch ] Signed-off-by: Qais Yousef <qais.yousef@arm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lkml.kernel.org/r/20200323135110.30522-9-qais.yousef@arm.com
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 03c727195b65..f803678684e9 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1275,6 +1275,29 @@ int add_cpu(unsigned int cpu)
}
EXPORT_SYMBOL_GPL(add_cpu);
+/**
+ * bringup_hibernate_cpu - Bring up the CPU that we hibernated on
+ * @sleep_cpu: The cpu we hibernated on and should be brought up.
+ *
+ * On some architectures like arm64, we can hibernate on any CPU, but on
+ * wake up the CPU we hibernated on might be offline as a side effect of
+ * using maxcpus= for example.
+ */
+int bringup_hibernate_cpu(unsigned int sleep_cpu)
+{
+ int ret;
+
+ if (!cpu_online(sleep_cpu)) {
+ pr_info("Hibernated on a CPU that is offline! Bringing CPU up.\n");
+ ret = cpu_up(sleep_cpu);
+ if (ret) {
+ pr_err("Failed to bring hibernate-CPU up!\n");
+ return ret;
+ }
+ }
+ return 0;
+}
+
#ifdef CONFIG_PM_SLEEP_SMP
static cpumask_var_t frozen_cpus;