aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2005-06-25 17:58:07 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:24:51 -0400
commit70765aa4bdb8862a49fcf5b28f3deaf561cf5ae7 (patch)
tree602d7801848e2599f1f3d0d53253e30f85794514 /include
parent5f5609df0c943b005847d3b2765d6dd47b624011 (diff)
[PATCH] kexec: kexec ppc support
I have tweaked this patch slightly to handle an empty list of pages to relocate passed to relocate_new_kernel. And I have added ppc_md.machine_crash_shutdown. To keep up with the changes in the generic kexec infrastructure. From: Albert Herranz <albert_herranz@yahoo.es> The following patch adds support for kexec on the ppc32 platform. Non-OpenFirmware based platforms are likely to work directly without additional changes on the kernel side. The kexec-tools userland package may need to be slightly updated, though. For OpenFirmware based machines, additional work is still needed on the kernel side before kexec support is ready. Benjamin Herrenschmidt is kindly working on that part. In order for a ppc platform to use the kexec kernel services it must implement some ppc_md hooks. Otherwise, kexec will be explicitly disabled, as suggested by benh. There are 3+1 new ppc_md hooks that a platform supporting kexec may implement. Two of them are mandatory for kexec to work. See include/asm-ppc/machdep.h for details. - machine_kexec_prepare(image) This function is called to make any arrangements to the image before it is loaded. This hook _MUST_ be provided by a platform in order to activate kexec support for that platform. Otherwise, the platform is considered to not support kexec and the kexec_load system call will fail (that makes all existing platforms by default non-kexec'able). - machine_kexec_cleanup(image) This function is called to make any cleanups on image after the loaded image data it is freed. This hook is optional. A platform may or may not provide this hook. - machine_kexec(image) This function is called to perform the _actual_ kexec. This hook _MUST_ be provided by a platform in order to activate kexec support for that platform. If a platform provides machine_kexec_prepare but forgets to provide machine_kexec, a kexec will fall back to a reboot. A ready-to-use machine_kexec_simple() generic function is provided to, hopefully, simplify kexec adoption for embedded platforms. A platform may call this function from its specific machine_kexec hook, like this: void myplatform_kexec(struct kimage *image) { machine_kexec_simple(image); } - machine_shutdown() This function is called to perform any machine specific shutdowns, not already done by drivers. This hook is optional. A platform may or may not provide this hook. An example (trimmed) platform specific module for a platform supporting kexec through the existing machine_kexec_simple follows: /* ... */ #ifdef CONFIG_KEXEC int myplatform_kexec_prepare(struct kimage *image) { /* here, we can place additional preparations */ return 0; /* yes, we support kexec */ } void myplatform_kexec(struct kimage *image) { machine_kexec_simple(image); } #endif /* CONFIG_KEXEC */ /* ... */ void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { /* ... */ #ifdef CONFIG_KEXEC ppc_md.machine_kexec_prepare = myplatform_kexec_prepare; ppc_md.machine_kexec = myplatform_kexec; #endif /* CONFIG_KEXEC */ /* ... */ } The kexec ppc kernel support has been heavily tested on the GameCube Linux port, and, as reported in the fastboot mailing list, it has been tested too on a Moto 82xx ppc by Rick Richardson. Signed-off-by: Albert Herranz <albert_herranz@yahoo.es> Signed-off-by: Eric Biederman <ebiederm@xmission.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.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-ppc/kexec.h38
-rw-r--r--include/asm-ppc/machdep.h31
2 files changed, 69 insertions, 0 deletions
diff --git a/include/asm-ppc/kexec.h b/include/asm-ppc/kexec.h
new file mode 100644
index 000000000000..73191310d8db
--- /dev/null
+++ b/include/asm-ppc/kexec.h
@@ -0,0 +1,38 @@
1#ifndef _PPC_KEXEC_H
2#define _PPC_KEXEC_H
3
4#ifdef CONFIG_KEXEC
5
6/*
7 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
8 * I.e. Maximum page that is mapped directly into kernel memory,
9 * and kmap is not required.
10 *
11 * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct
12 * calculation for the amount of memory directly mappable into the
13 * kernel memory space.
14 */
15
16/* Maximum physical address we can use pages from */
17#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
18/* Maximum address we can reach in physical address mode */
19#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
20/* Maximum address we can use for the control code buffer */
21#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
22
23#define KEXEC_CONTROL_CODE_SIZE 4096
24
25/* The native architecture */
26#define KEXEC_ARCH KEXEC_ARCH_PPC
27
28#ifndef __ASSEMBLY__
29
30struct kimage;
31
32extern void machine_kexec_simple(struct kimage *image);
33
34#endif /* __ASSEMBLY__ */
35
36#endif /* CONFIG_KEXEC */
37
38#endif /* _PPC_KEXEC_H */
diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h
index b78d40870c95..1d4ab70a56f3 100644
--- a/include/asm-ppc/machdep.h
+++ b/include/asm-ppc/machdep.h
@@ -4,6 +4,7 @@
4 4
5#include <linux/config.h> 5#include <linux/config.h>
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/kexec.h>
7 8
8#include <asm/setup.h> 9#include <asm/setup.h>
9#include <asm/page.h> 10#include <asm/page.h>
@@ -114,6 +115,36 @@ struct machdep_calls {
114 /* functions for dealing with other cpus */ 115 /* functions for dealing with other cpus */
115 struct smp_ops_t *smp_ops; 116 struct smp_ops_t *smp_ops;
116#endif /* CONFIG_SMP */ 117#endif /* CONFIG_SMP */
118
119#ifdef CONFIG_KEXEC
120 /* Called to shutdown machine specific hardware not already controlled
121 * by other drivers.
122 * XXX Should we move this one out of kexec scope?
123 */
124 void (*machine_shutdown)(void);
125
126 /* Called to do the minimal shutdown needed to run a kexec'd kernel
127 * to run successfully.
128 * XXX Should we move this one out of kexec scope?
129 */
130 void (*machine_crash_shutdown)(void);
131
132 /* Called to do what every setup is needed on image and the
133 * reboot code buffer. Returns 0 on success.
134 * Provide your own (maybe dummy) implementation if your platform
135 * claims to support kexec.
136 */
137 int (*machine_kexec_prepare)(struct kimage *image);
138
139 /* Called to handle any machine specific cleanup on image */
140 void (*machine_kexec_cleanup)(struct kimage *image);
141
142 /* Called to perform the _real_ kexec.
143 * Do NOT allocate memory or fail here. We are past the point of
144 * no return.
145 */
146 void (*machine_kexec)(struct kimage *image);
147#endif /* CONFIG_KEXEC */
117}; 148};
118 149
119extern struct machdep_calls ppc_md; 150extern struct machdep_calls ppc_md;