This patch implements the functionality of jumping between the kexeced
kernel and the original kernel.
To support jumping between two kernels, before jumping to (executing)
the new kernel and jumping back to the original kernel, the devices
are put into quiescent state, and the state of devices and CPU is
saved. After jumping back from kexeced kernel and jumping to the new
kernel, the state of devices and CPU are restored accordingly. The
devices/CPU state save/restore code of software suspend is called to
implement corresponding function.
To support jumping without reserving memory. One shadow backup page
(source page) is allocated for each page used by new (kexeced) kernel
(destination page). When do kexec_load, the image of new kernel is
loaded into source pages, and before executing, the destination pages
and the source pages are swapped, so the contents of destination pages
are backupped. Before jumping to the new (kexeced) kernel and after
jumping back to the original kernel, the destination pages and the
source pages are swapped too.
A jump back protocol for kexec is defined and documented. It is an
extension to ordinary function calling protocol. So, the facility
provided by this patch can be used to call ordinary C function in real
mode.
A set of flags for sys_kexec_load are added to control which state are
saved/restored before/after real mode code executing. Such as, you can
specify the device state and FPU state are saved/restored before/after
real mode code executing.
Signed-off-by: Huang Ying <ying.huang@intel.com>
---
Documentation/i386/jump_back_protocol.txt | 103 ++++++++++++++
arch/powerpc/kernel/machine_kexec.c | 2
arch/ppc/kernel/machine_kexec.c | 2
arch/sh/kernel/machine_kexec.c | 2
arch/x86/kernel/machine_kexec_32.c | 88 +++++++++---
arch/x86/kernel/machine_kexec_64.c | 2
arch/x86/kernel/relocate_kernel_32.S | 214 +++++++++++++++++++++++++++---
include/asm-x86/kexec_3...