arm64: hibernate: Resume when hibernate image created on non-boot CPU
authorJames Morse <james.morse@arm.com>
Wed, 17 Aug 2016 12:50:26 +0000 (13:50 +0100)
committerWill Deacon <will.deacon@arm.com>
Fri, 26 Aug 2016 10:21:25 +0000 (11:21 +0100)
commit8ec058fd2710da1df463c19a4e0ee55ac4530f09
tree6a51a11935fd0741b4bad360432a79a6953d89be
parentd391e552293399396c131544f5b1c2f9b1fb0baa
arm64: hibernate: Resume when hibernate image created on non-boot CPU

disable_nonboot_cpus() assumes that the lowest numbered online CPU is
the boot CPU, and that this is the correct CPU to run any power
management code on.

On arm64 CPU0 can be taken offline. For hibernate/resume this means we
may hibernate on a CPU other than CPU0. If the system is rebooted with
kexec 'CPU0' will be assigned to a different CPU. This complicates
hibernate/resume as now we can't trust the CPU numbers.

We currently forbid hibernate if CPU0 has been hotplugged out to avoid
this situation without kexec.

Save the MPIDR of the CPU we hibernated on in the hibernate arch-header,
use hibernate_resume_nonboot_cpu_disable() to direct which CPU we should
resume on based on the MPIDR of the CPU we hibernated on. This allows us to
hibernate/resume on any CPU, even if the logical numbers have been
shuffled by kexec.

Signed-off-by: James Morse <james.morse@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/suspend.h
arch/arm64/kernel/hibernate.c