android_kernel_xiaomi_sm8350/arch/sh/kernel
Huang Ying 3ab8352137 kexec jump
This patch provides an enhancement to kexec/kdump.  It implements the
following features:

- Backup/restore memory used by the original kernel before/after
  kexec.

- Save/restore CPU state before/after kexec.

The features of this patch can be used as a general method to call program in
physical mode (paging turning off).  This can be used to call BIOS code under
Linux.

kexec-tools needs to be patched to support kexec jump. The patches and
the precompiled kexec can be download from the following URL:

       source: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-src_git_kh10.tar.bz2
       patches: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-patches_git_kh10.tar.bz2
       binary: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec_git_kh10

Usage example of calling some physical mode code and return:

1. Compile and install patched kernel with following options selected:

CONFIG_X86_32=y
CONFIG_KEXEC=y
CONFIG_PM=y
CONFIG_KEXEC_JUMP=y

2. Build patched kexec-tool or download the pre-built one.

3. Build some physical mode executable named such as "phy_mode"

4. Boot kernel compiled in step 1.

5. Load physical mode executable with /sbin/kexec. The shell command
   line can be as follow:

   /sbin/kexec --load-preserve-context --args-none phy_mode

6. Call physical mode executable with following shell command line:

   /sbin/kexec -e

Implementation point:

To support jumping without reserving memory.  One shadow backup page (source
page) is allocated for each page used by kexeced code image (destination
page).  When do kexec_load, the image of kexeced code 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 kexeced code image and after jumping back to the original kernel, the
destination pages and the source pages are swapped too.

C ABI (calling convention) is used as communication protocol between
kernel and called code.

A flag named KEXEC_PRESERVE_CONTEXT for sys_kexec_load is added to
indicate that the loaded kernel image is used for jumping back.

Now, only the i386 architecture is supported.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-26 12:00:04 -07:00
..
cpu sh: add resource of USB host for SH7723 2008-06-09 16:04:13 +09:00
timers sh: replace remaining __FUNCTION__ occurrences 2008-03-06 11:18:22 +09:00
vsyscall
asm-offsets.c sh: use kbuild.h instead of defining macros in asm-offsets.c 2008-04-29 08:06:30 -07:00
cf-enabler.c sh: Add support for Solution Engine SH7721 board 2008-04-18 09:50:02 -07:00
cpufreq.c
crash_dump.c
debugtraps.S
dump_task.c sh: Fix occasional FPU register corruption under preempt. 2008-03-26 19:02:47 +09:00
early_printk.c sh: reset hardware from early printk 2008-05-08 19:51:54 +09:00
entry-common.S sh: Fix up restorer in debug_trap exception return path. 2008-05-19 19:39:33 +09:00
head_32.S sh: disable initrd defaults in .empty_zero_page. 2008-05-16 14:55:07 +09:00
head_64.S
init_task.c [PATCH] take init_files to fs/file.c 2008-05-16 17:22:20 -04:00
io_generic.c
io_trapped.c sh: Fix up section mismatches. 2008-03-06 12:43:38 +09:00
io.c
irq.c proper __do_softirq() prototype 2008-04-29 08:06:02 -07:00
kgdb_jmp.S
kgdb_stub.c sh: use the common ascii hex helpers 2008-05-16 15:09:08 +09:00
machine_kexec.c kexec jump 2008-07-26 12:00:04 -07:00
machvec.c
Makefile
Makefile_32 Generic semaphore implementation 2008-04-17 10:42:34 -04:00
Makefile_64 Generic semaphore implementation 2008-04-17 10:42:34 -04:00
module.c sh: module.c use kernel unaligned helpers 2008-06-02 12:30:00 +09:00
pm.c
process_32.c nohz: prevent tick stop outside of the idle loop 2008-07-18 18:10:28 +02:00
process_64.c sh64: add missing #include <asm/fpu.h>'s 2008-04-16 02:00:09 +09:00
ptrace_32.c
ptrace_64.c sh64: add missing #include <asm/fpu.h>'s 2008-04-16 02:00:09 +09:00
relocate_kernel.S
setup.c sh: display boot params by default on entry. 2008-05-16 14:55:06 +09:00
sh_bios.c
sh_ksyms_32.c sh64: Some symbol exports to make the allmodconfig happier. 2008-05-08 19:51:41 +09:00
sh_ksyms_64.c sh64: Some symbol exports to make the allmodconfig happier. 2008-05-08 19:51:41 +09:00
signal_32.c sh: Fix occasional FPU register corruption under preempt. 2008-03-26 19:02:47 +09:00
signal_64.c sh64: add missing #include <asm/fpu.h>'s 2008-04-16 02:00:09 +09:00
smp.c on_each_cpu(): kill unused 'retry' parameter 2008-06-26 11:24:38 +02:00
stacktrace.c fix core/stacktrace changes on avr32, mips, sh 2008-07-18 14:42:35 +02:00
sys_sh32.c flag parameters: pipe 2008-07-24 10:47:28 -07:00
sys_sh64.c unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
sys_sh.c
syscalls_32.S
syscalls_64.S
time_32.c
time_64.c sh64: Some symbol exports to make the allmodconfig happier. 2008-05-08 19:51:41 +09:00
topology.c sh: replace remaining __FUNCTION__ occurrences 2008-03-06 11:18:22 +09:00
traps_32.c sh: arch/sh/kernel/traps_32.c needs asm/fpu.h 2008-04-16 02:03:51 +09:00
traps_64.c sh64: add missing #include <asm/fpu.h>'s 2008-04-16 02:00:09 +09:00
traps.c sh: Make is_valid_bugaddr() more intelligent on nommu. 2008-05-19 19:32:07 +09:00
vmlinux_32.lds.S move BUG_TABLE into RODATA 2008-05-25 07:06:08 +02:00
vmlinux_64.lds.S move BUG_TABLE into RODATA 2008-05-25 07:06:08 +02:00
vmlinux.lds.S