kexec support for Linux/m68k (kernel part)
Subsystems (4)
Geert Uytterhoeven
maintainerv3 cover kexec support for Linux/m68k (kernel part)
This is a set of patches to add kexec support for m68k to the Linux kernel.
- Kexec only, no kdump support yet (do you have enough RAM to keep a crashdump kernel in memory at all times? ;-)
- Tested on ARAnyM, with emulated 68040 (Atari has identical virt/phys RAM mapping),
- Tested on Amiga 4000/040, with real 68040 (Amiga has non-identical virt/phys RAM mapping).
- Test results on machines with different CPUs would be welcome!
You can download a kexec binary from
http://users.telenet.be/geertu/Download/kexec-m68k-2013-10-15.tar.bz2
- To have automatic "kexec -e" on reboot, copy /etc/rc6.d/S85kexec from another system, and fix it up for kexec living in /usr/local/sbin instead of /sbin.
- Sample invocation:
kexec -d -l vmlinux --reuse-cmdline
rebootPatches:
- [PATCH 1/2] m68k: Add kexec support
- v2:
- KEXEC depends on M68KCLASSIC,
- Fix handling of virtual and physical addresses, for machines where memory doesn't start at zero,
- Support for other CPUs than 68040.
- v3:
- Clear '040/'060 transparent translation registers on MMU disable
- [PATCH 2/2] m68k: Add support to export bootinfo in procfs
- v2:
- No changes
- v3:
- Rebased on top of current m68k tree
- "m68k: Add System RAM to /proc/iomem" was dropped in v2.
- "kexec: Add debug printing of kimage table entries" was dropped in v3.
Have fun!
Geert Uytterhoeven
maintainerPATCH v3 1/2 m68k: Add kexec support
---
v2:
- KEXEC depends on M68KCLASSIC,
- Fix handling of virtual and physical addresses, for machines where memory doesn't start at zero,
- Support for other CPUs than 68040.
v3:
- Clear '040/'060 transparent translation registers on MMU disable
arch/m68k/Kconfig | 17 ++++ arch/m68k/include/asm/kexec.h | 29 +++++++ arch/m68k/kernel/Makefile | 2 + arch/m68k/kernel/asm-offsets.c | 3 + arch/m68k/kernel/machine_kexec.c | 58 +++++++++++++ arch/m68k/kernel/relocate_kernel.S | 159 ++++++++++++++++++++++++++++++++++++ include/uapi/linux/kexec.h | 1 + 7 files changed, 269 insertions(+) create mode 100644 arch/m68k/include/asm/kexec.h create mode 100644 arch/m68k/kernel/machine_kexec.c create mode 100644 arch/m68k/kernel/relocate_kernel.S
arch/m68k/Kconfig +17 -0
@@ -87,6 +87,23 @@ config MMU_SUN3 bool depends on MMU && !MMU_MOTOROLA && !MMU_COLDFIRE +config KEXEC + bool "kexec system call" + depends on M68KCLASSIC + help + kexec is a system call that implements the ability to shutdown your + current kernel, and to start another kernel. It is like a reboot + but it is independent of the system firmware. And like a reboot + you can start any kernel with it, not just Linux. + + The name comes from the similarity to the exec system call. + + It is an ongoing process to be certain the hardware in a machine + is properly shutdown, so do not be surprised if this code does not + initially work for you. As of this writing the exact hardware + interface is strongly in flux, so no good recommendation can be + made. + menu "Platform setup" source arch/m68k/Kconfig.cpu
arch/m68k/include/asm/kexec.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _ASM_M68K_KEXEC_H +#define _ASM_M68K_KEXEC_H + +#ifdef CONFIG_KEXEC + +/* Maximum physical address we can use pages from */ +#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) +/* Maximum address we can reach in physical address mode */ +#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) +/* Maximum address we can use for the control code buffer */ +#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) + +#define KEXEC_CONTROL_PAGE_SIZE 4096 + +#define KEXEC_ARCH KEXEC_ARCH_68K + +#ifndef __ASSEMBLY__ + +static inline void crash_setup_regs (struct pt_regs *newregs, +struct pt_regs *oldregs) +{ +/* Dummy implementation for now */ +} + +#endif /* __ASSEMBLY__ */ + +#endif /* CONFIG_KEXEC */ + +#endif /* _ASM_M68K_KEXEC_H */
arch/m68k/kernel/Makefile +2 -0
@@ -22,3 +22,5 @@ obj-$(CONFIG_PCI) += pcibios.o obj-$(CONFIG_HAS_DMA) += dma.o +obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o +
arch/m68k/kernel/asm-offsets.c +3 -0
@@ -98,6 +98,9 @@ int main(void)DEFINE (CIABBASE , &ciab);DEFINE (C_PRA , offsetof(struct CIA , pra));DEFINE (ZTWOBASE , zTwoBase); + +/* enum m68k_fixup_type */ +DEFINE (M68K_FIXUP_MEMOFFSET , m68k_fixup_memoffset);#endif return 0 ;
arch/m68k/kernel/machine_kexec.c new file +58 -0
58 lines not on this page · raw message
arch/m68k/kernel/relocate_kernel.S new file +159 -0
159 lines not on this page · raw message
include/uapi/linux/kexec.h +1 -0
@@ -18,6 +18,7 @@*/ #define KEXEC_ARCH_DEFAULT ( 0 << 16)#define KEXEC_ARCH_386 ( 3 << 16) +#define KEXEC_ARCH_68K ( 4 << 16)#define KEXEC_ARCH_X86_64 (62 << 16)#define KEXEC_ARCH_PPC (20 << 16)#define KEXEC_ARCH_PPC64 (21 << 16)
Signature · 1 line
1.7.9.5
Geert Uytterhoeven
maintainerPATCH v3 2/2 m68k: Add support to export bootinfo in procfs
In reply to Geert UytterhoevenAdd optional support to export the bootinfo used to boot the kernel in a "bootinfo" file in procfs. This is useful with kexec.
This is based on the similar feature for ATAGS on ARM.
---
v2:
- No changes
v3:
- Rebased on top of current m68k tree
arch/m68k/Kconfig | 7 ++++ arch/m68k/include/asm/bootinfo.h | 12 ++++++ arch/m68k/kernel/Makefile | 1 + arch/m68k/kernel/bootinfo_proc.c | 80 ++++++++++++++++++++++++++++++++++++++ arch/m68k/kernel/setup_mm.c | 2 + 5 files changed, 102 insertions(+) create mode 100644 arch/m68k/kernel/bootinfo_proc.c
arch/m68k/Kconfig +7 -0
@@ -104,6 +104,13 @@ config KEXEC interface is strongly in flux, so no good recommendation can be made. +config BOOTINFO_PROC + bool "Export bootinfo in procfs" + depends on KEXEC && M68KCLASSIC + help + Say Y to export the bootinfo used to boot the kernel in a + "bootinfo" file in procfs. This is useful with kexec. + menu "Platform setup" source arch/m68k/Kconfig.cpu
arch/m68k/include/asm/bootinfo.h +12 -0
@@ -13,4 +13,16 @@#include <uapi/asm/bootinfo.h> + +#ifndef __ASSEMBLY__ + +#ifdef CONFIG_BOOTINFO_PROC +extern void save_bootinfo (const struct bi_record *bi); +#else +static inline void save_bootinfo (const struct bi_record *bi) {} +#endif + +#endif /* __ASSEMBLY__ */ + +#endif /* _M68K_BOOTINFO_H */
arch/m68k/kernel/Makefile +1 -0
@@ -23,4 +23,5 @@ obj-$(CONFIG_PCI) += pcibios.o obj-$(CONFIG_HAS_DMA) += dma.o obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o +obj-$(CONFIG_BOOTINFO_PROC) += bootinfo_proc.o
arch/m68k/kernel/bootinfo_proc.c new file +80 -0
80 lines not on this page · raw message
arch/m68k/kernel/setup_mm.c +2 -0
@@ -146,6 +146,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record) {uint16_t tag; +save_bootinfo (record); +while ((tag =be16_to_cpu (record->tag)) !=BI_LAST ) {int unknown =0 ;const void *data = record->data;
Signature · 1 line
1.7.9.5