diff options
author | R Sharada <sharada@in.ibm.com> | 2005-06-25 17:58:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:51 -0400 |
commit | fce0d5740322b98b863f9e609f5a9bd4c06703af (patch) | |
tree | 658f5aca95d62c8e35f938a435d9f512c21921df /include | |
parent | f4c82d5132b0592f5d6befc5b652cbd4b08f12ff (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 'include')
-rw-r--r-- | include/asm-ppc64/kexec.h | 41 | ||||
-rw-r--r-- | include/asm-ppc64/machdep.h | 1 | ||||
-rw-r--r-- | include/asm-ppc64/xics.h | 1 |
3 files changed, 43 insertions, 0 deletions
diff --git a/include/asm-ppc64/kexec.h b/include/asm-ppc64/kexec.h new file mode 100644 index 000000000000..511908afaeeb --- /dev/null +++ b/include/asm-ppc64/kexec.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef _PPC64_KEXEC_H | ||
2 | #define _PPC64_KEXEC_H | ||
3 | |||
4 | /* | ||
5 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | ||
6 | * I.e. Maximum page that is mapped directly into kernel memory, | ||
7 | * and kmap is not required. | ||
8 | */ | ||
9 | |||
10 | /* Maximum physical address we can use pages from */ | ||
11 | /* XXX: since we copy virt we can use any page we allocate */ | ||
12 | #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) | ||
13 | |||
14 | /* Maximum address we can reach in physical address mode */ | ||
15 | /* XXX: I want to allow initrd in highmem. otherwise set to rmo on lpar */ | ||
16 | #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) | ||
17 | |||
18 | /* Maximum address we can use for the control code buffer */ | ||
19 | /* XXX: unused today, ppc32 uses TASK_SIZE, probably left over from use_mm */ | ||
20 | #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) | ||
21 | |||
22 | /* XXX: today we don't use this at all, althogh we have a static stack */ | ||
23 | #define KEXEC_CONTROL_CODE_SIZE 4096 | ||
24 | |||
25 | /* The native architecture */ | ||
26 | #define KEXEC_ARCH KEXEC_ARCH_PPC64 | ||
27 | |||
28 | #define MAX_NOTE_BYTES 1024 | ||
29 | |||
30 | #ifndef __ASSEMBLY__ | ||
31 | |||
32 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
33 | |||
34 | extern note_buf_t crash_notes[]; | ||
35 | |||
36 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for | ||
37 | master to copy new code to 0 */ | ||
38 | |||
39 | #endif /* __ASSEMBLY__ */ | ||
40 | #endif /* _PPC_KEXEC_H */ | ||
41 | |||
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index 553b2ea23bed..9cdad3ed1526 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h | |||
@@ -86,6 +86,7 @@ struct machdep_calls { | |||
86 | 86 | ||
87 | void (*init_IRQ)(void); | 87 | void (*init_IRQ)(void); |
88 | int (*get_irq)(struct pt_regs *); | 88 | int (*get_irq)(struct pt_regs *); |
89 | void (*cpu_irq_down)(void); | ||
89 | 90 | ||
90 | /* PCI stuff */ | 91 | /* PCI stuff */ |
91 | void (*pcibios_fixup)(void); | 92 | void (*pcibios_fixup)(void); |
diff --git a/include/asm-ppc64/xics.h b/include/asm-ppc64/xics.h index fdec5e7a7af6..0c45e14e26ca 100644 --- a/include/asm-ppc64/xics.h +++ b/include/asm-ppc64/xics.h | |||
@@ -17,6 +17,7 @@ | |||
17 | void xics_init_IRQ(void); | 17 | void xics_init_IRQ(void); |
18 | int xics_get_irq(struct pt_regs *); | 18 | int xics_get_irq(struct pt_regs *); |
19 | void xics_setup_cpu(void); | 19 | void xics_setup_cpu(void); |
20 | void xics_teardown_cpu(void); | ||
20 | void xics_cause_IPI(int cpu); | 21 | void xics_cause_IPI(int cpu); |
21 | void xics_request_IPIs(void); | 22 | void xics_request_IPIs(void); |
22 | void xics_migrate_irqs_away(void); | 23 | void xics_migrate_irqs_away(void); |