kernel-hacking-2024-linux-s.../arch/powerpc/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
..
vdso32 powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
vdso64 powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
align.c powerpc: Add VSX load/store alignment exception handler 2008-07-15 12:29:25 +10:00
asm-offsets.c powerpc: Introduce VSX thread_struct and CONFIG_VSX 2008-07-01 11:28:46 +10:00
audit.c
btext.c
clock.c
compat_audit.c
cpu_setup_6xx.S
cpu_setup_44x.S Revert "[POWERPC] 4xx: Fix 460GT support to not enable FPU" 2008-06-11 07:52:40 -04:00
cpu_setup_pa6t.S
cpu_setup_ppc970.S
cputable.c powerpc: Fix boot problem due to AT_BASE_PLATFORM change 2008-07-26 09:02:43 +10:00
crash.c powerpc: Increase CRASH_HANDLER_MAX 2008-06-30 22:31:00 +10:00
crash_dump.c powerpc: Add PPC_NOP_INSTR, a hash define for the preferred nop instruction 2008-07-01 11:28:23 +10:00
dma_64.c powerpc: move device_to_mask() to dma-mapping.h 2008-07-09 16:30:44 +10:00
entry_32.S powerpc: BookE hardware watchpoint support 2008-07-25 15:44:39 +10:00
entry_64.S Merge commit '85082fd7cbe3173198aac0eb5e85ab1edcc6352c' into test-build 2008-07-15 15:44:51 +10:00
firmware.c
fpu.S powerpc: Add VSX context save/restore, ptrace and signal support 2008-07-01 11:28:50 +10:00
ftrace.c ftrace: store mcount address in rec->ip 2008-06-23 22:10:56 +02:00
head_8xx.S
head_32.S powerpc: Make load_up_fpu and load_up_altivec callable 2008-07-01 11:28:45 +10:00
head_40x.S [POWERPC] 40x/Book-E: Save/restore volatile exception registers 2008-06-02 14:56:35 -05:00
head_44x.S powerpc: rework 4xx PTE access and TLB miss 2008-07-09 13:36:17 -04:00
head_64.S powerpc: Don't spin on sync instruction at boot time 2008-07-15 12:29:28 +10:00
head_booke.h powerpc: rework 4xx PTE access and TLB miss 2008-07-09 13:36:17 -04:00
head_fsl_booke.S powerpc/fsl: Minor TLBSYNC cleanup for FSL Book-E 2008-07-16 17:57:52 -05:00
ibmebus.c powerpc/ibmebus: more meaningful variable name 2008-07-09 16:30:46 +10:00
idle.c nohz: prevent tick stop outside of the idle loop 2008-07-18 18:10:28 +02:00
idle_6xx.S powerpc/85xx: add DOZE/NAP support for e500 core 2008-06-26 01:48:56 -05:00
idle_e500.S powerpc/e500mc: flush L2 on NAP for e500mc 2008-06-26 01:49:03 -05:00
idle_power4.S
init_task.c [PATCH] take init_files to fs/file.c 2008-05-16 17:22:20 -04:00
io.c ftrace: support for PowerPC 2008-05-23 22:43:11 +02:00
iomap.c
iommu.c powerpc/pseries: iommu enablement for CMO 2008-07-25 15:44:43 +10:00
irq.c Merge commit '85082fd7cbe3173198aac0eb5e85ab1edcc6352c' into test-build 2008-07-15 15:44:51 +10:00
isa-bridge.c
kgdb.c kgdb, powerpc: arch specific powerpc kgdb support 2008-07-23 11:30:15 -05:00
kprobes.c kprobes: improve kretprobe scalability with hashed locking 2008-07-25 10:53:30 -07:00
l2cr_6xx.S
legacy_serial.c powerpc: Fix unterminated of_device_id array in legacy_serial.c 2008-07-07 08:53:49 -07:00
lparcfg.c powerpc/pseries: Remove kmalloc call in handling writes to lparcfg 2008-07-25 15:44:45 +10:00
machine_kexec.c kexec jump 2008-07-26 12:00:04 -07:00
machine_kexec_32.c
machine_kexec_64.c Merge commit 'origin/master' 2008-07-16 11:07:59 +10:00
Makefile kgdb, powerpc: arch specific powerpc kgdb support 2008-07-23 11:30:15 -05:00
misc.S powerpc: Add cputable entry for POWER7 2008-06-30 22:31:11 +10:00
misc_32.S powerpc/kprobes: Some minor fixes 2008-06-26 03:35:33 -05:00
misc_64.S powerpc: fix giveup_vsx to save registers correctly 2008-07-15 12:29:23 +10:00
module.c powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
module_32.c powerpc: Move common module code into its own file 2008-07-01 11:28:05 +10:00
module_64.c powerpc: Add PPC_NOP_INSTR, a hash define for the preferred nop instruction 2008-07-01 11:28:23 +10:00
msi.c [POWERPC] Fix sparse warnings in arch/powerpc/kernel 2008-05-14 22:31:59 +10:00
nvram_64.c
of_device.c [POWERPC] Move of_device_get_modalias to drivers/of 2008-05-16 23:22:28 +10:00
of_platform.c powerpc: Add missing reference to coherent_dma_mask 2008-07-08 21:06:35 -07:00
paca.c
pci-common.c powerpc: Fix OF parsing of 64 bits PCI addresses 2008-07-22 10:39:34 +10:00
pci_32.c
pci_64.c [POWERPC] Use dev_set_name in pci_64.c 2008-06-09 11:32:40 +10:00
pci_dn.c
pmc.c
ppc32.h powerpc: Add VSX context save/restore, ptrace and signal support 2008-07-01 11:28:50 +10:00
ppc_ksyms.c Merge commit '85082fd7cbe3173198aac0eb5e85ab1edcc6352c' into test-build 2008-07-15 15:44:51 +10:00
proc_ppc64.c
process.c powerpc: BookE hardware watchpoint support 2008-07-25 15:44:39 +10:00
prom.c powerpc: Add VSX CPU feature 2008-07-01 11:28:47 +10:00
prom_init.c powerpc/pseries: Update arch vector to indicate support for CMO 2008-07-25 15:44:45 +10:00
prom_init_check.sh [POWERPC] Fix -Os kernel builds with newer gcc versions 2008-06-16 15:00:54 +10:00
prom_parse.c powerpc: Fix OF parsing of 64 bits PCI addresses 2008-07-22 10:39:34 +10:00
ptrace.c powerpc: BookE hardware watchpoint support 2008-07-25 15:44:39 +10:00
ptrace32.c powerpc: Add macros to access floating point registers in thread_struct. 2008-07-01 11:28:43 +10:00
rtas-proc.c [POWERPC] Fix sparse warnings in arch/powerpc/kernel 2008-05-14 22:31:59 +10:00
rtas-rtc.c
rtas.c Merge commit 'origin/master' 2008-07-16 11:07:59 +10:00
rtas_flash.c [POWERPC] Fix sparse warnings in arch/powerpc/kernel 2008-05-14 22:31:59 +10:00
rtas_pci.c [POWERPC] Fix sparse warnings in arch/powerpc/kernel 2008-05-14 22:31:59 +10:00
setup-common.c powerpc: Add the PC speaker only when requested 2008-06-09 13:42:30 +10:00
setup.h
setup_32.c kgdb, powerpc: arch specific powerpc kgdb support 2008-07-23 11:30:15 -05:00
setup_64.c powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
signal.c powerpc: BookE hardware watchpoint support 2008-07-25 15:44:39 +10:00
signal.h powerpc: Clean up copy_to/from_user for vsx and fpr 2008-07-03 16:58:11 +10:00
signal_32.c powerpc: fix giveup_vsx to save registers correctly 2008-07-15 12:29:23 +10:00
signal_64.c powerpc: fix giveup_vsx to save registers correctly 2008-07-15 12:29:23 +10:00
smp-tbsync.c
smp.c Merge commit 'origin/master' 2008-07-16 11:07:59 +10:00
softemu8xx.c powerpc: Add macros to access floating point registers in thread_struct. 2008-07-01 11:28:43 +10:00
stacktrace.c powerpc: Fix support for latencytop 2008-07-22 10:39:33 +10:00
suspend.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
swsusp.c
swsusp_32.S
swsusp_64.c
swsusp_asm64.S
sys_ppc32.c
syscalls.c powerpc/mm: Add Strong Access Ordering support 2008-07-09 16:30:45 +10:00
sysfs.c powerpc: Fallout from sysdev API changes 2008-07-25 15:44:39 +10:00
systbl.S
systbl_chk.c
systbl_chk.sh
tau_6xx.c on_each_cpu(): kill unused 'retry' parameter 2008-06-26 11:24:38 +02:00
time.c Merge commit 'origin/master' 2008-07-16 11:07:59 +10:00
traps.c powerpc: BookE hardware watchpoint support 2008-07-25 15:44:39 +10:00
udbg.c
udbg_16550.c
vdso.c powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
vecemu.c
vector.S
vio.c powerpc/pseries: vio bus support for CMO 2008-07-25 15:44:43 +10:00
vmlinux.lds.S powerpc: Fix compile error with binutils 2.15 2008-07-25 15:44:40 +10:00