aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/setup.c
diff options
context:
space:
mode:
authorR Sharada <sharada@in.ibm.com>2005-06-25 17:58:10 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:24:51 -0400
commitfce0d5740322b98b863f9e609f5a9bd4c06703af (patch)
tree658f5aca95d62c8e35f938a435d9f512c21921df /arch/ppc64/kernel/setup.c
parentf4c82d5132b0592f5d6befc5b652cbd4b08f12ff (diff)
[PATCH] ppc64: kexec support for ppc64
This patch implements the kexec support for ppc64 platforms. A couple of notes: 1) We copy the pages in virtual mode, using the full base kernel and a statically allocated stack. At kexec_prepare time we scan the pages and if any overlap our (0, _end[]) range we return -ETXTBSY. On PowerPC 64 systems running in LPAR (logical partitioning) mode, only a small region of memory, referred to as the RMO, can be accessed in real mode. Since Linux runs with only one zone of memory in the memory allocator, and it can be orders of magnitude more memory than the RMO, looping until we allocate pages in the source region is not feasible. Copying in virtual means we don't have to write a hash table generation and call hypervisor to insert translations, instead we rely on the pinned kernel linear mapping. The kernel already has move to linked location built in, so there is no requirement to load it at 0. If we want to load something other than a kernel, then a stub can be written to copy a linear chunk in real mode. 2) The start entry point gets passed parameters from the kernel. Slaves are started at a fixed address after copying code from the entry point. All CPUs get passed their firmware assigned physical id in r3 (most calling conventions use this register for the first argument). This is used to distinguish each CPU from all other CPUs. Since firmware is not around, there is no other way to obtain this information other than to pass it somewhere. A single CPU, referred to here as the master and the one executing the kexec call, branches to start with the address of start in r4. While this can be calculated, we have to load it through a gpr to branch to this point so defining the register this is contained in is free. A stack of unspecified size is available at r1 (also common calling convention). All remaining running CPUs are sent to start at absolute address 0x60 after copying the first 0x100 bytes from start to address 0. This convention was chosen because it matches what the kernel has been doing itself. (only gpr3 is defined). Note: This is not quite the convention of the kexec bootblock v2 in the kernel. A stub has been written to convert between them, and we may adjust the kernel in the future to allow this directly without any stub. 3) Destination pages can be placed anywhere, even where they would not be accessible in real mode. This will allow us to place ram disks above the RMO if we choose. Signed-off-by: Milton Miller <miltonm@bga.com> Signed-off-by: R Sharada <sharada@in.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc64/kernel/setup.c')
-rw-r--r--arch/ppc64/kernel/setup.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index 0a47a5ef428d..d5e4866e9ac2 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -677,11 +677,16 @@ void __init setup_system(void)
677 DBG(" <- setup_system()\n"); 677 DBG(" <- setup_system()\n");
678} 678}
679 679
680 680/* also used by kexec */
681void machine_restart(char *cmd) 681void machine_shutdown(void)
682{ 682{
683 if (ppc_md.nvram_sync) 683 if (ppc_md.nvram_sync)
684 ppc_md.nvram_sync(); 684 ppc_md.nvram_sync();
685}
686
687void machine_restart(char *cmd)
688{
689 machine_shutdown();
685 ppc_md.restart(cmd); 690 ppc_md.restart(cmd);
686#ifdef CONFIG_SMP 691#ifdef CONFIG_SMP
687 smp_send_stop(); 692 smp_send_stop();
@@ -690,13 +695,11 @@ void machine_restart(char *cmd)
690 local_irq_disable(); 695 local_irq_disable();
691 while (1) ; 696 while (1) ;
692} 697}
693
694EXPORT_SYMBOL(machine_restart); 698EXPORT_SYMBOL(machine_restart);
695 699
696void machine_power_off(void) 700void machine_power_off(void)
697{ 701{
698 if (ppc_md.nvram_sync) 702 machine_shutdown();
699 ppc_md.nvram_sync();
700 ppc_md.power_off(); 703 ppc_md.power_off();
701#ifdef CONFIG_SMP 704#ifdef CONFIG_SMP
702 smp_send_stop(); 705 smp_send_stop();
@@ -705,13 +708,11 @@ void machine_power_off(void)
705 local_irq_disable(); 708 local_irq_disable();
706 while (1) ; 709 while (1) ;
707} 710}
708
709EXPORT_SYMBOL(machine_power_off); 711EXPORT_SYMBOL(machine_power_off);
710 712
711void machine_halt(void) 713void machine_halt(void)
712{ 714{
713 if (ppc_md.nvram_sync) 715 machine_shutdown();
714 ppc_md.nvram_sync();
715 ppc_md.halt(); 716 ppc_md.halt();
716#ifdef CONFIG_SMP 717#ifdef CONFIG_SMP
717 smp_send_stop(); 718 smp_send_stop();
@@ -720,7 +721,6 @@ void machine_halt(void)
720 local_irq_disable(); 721 local_irq_disable();
721 while (1) ; 722 while (1) ;
722} 723}
723
724EXPORT_SYMBOL(machine_halt); 724EXPORT_SYMBOL(machine_halt);
725 725
726static int ppc64_panic_event(struct notifier_block *this, 726static int ppc64_panic_event(struct notifier_block *this,