Skip to contentSkip to conversation

Preliminary kexec support for Linux/m68k

PATCH New Geert Uytterhoeven 3 participants 20 messages Sep 17, 2013 – Sep 20, 2013

Subsystems (4)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

This is a preliminary set of patches to add kexec support for m68k.

- Kexec only, no kdump support yet (do you have enough RAM to keep a crashdump kernel in memory at all times? ;-)

- Tested on ARAnyM only. No support for other CPU/MMUs than 68040.

- Although the code contains some phys/virt conversions, it will probably fail miserably on platforms where kernel virtual addresses are different from physical address.

- 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

KERNEL:

Patches:
- [PATCH 1/3] m68k: Add preliminary kexec support
- [PATCH 2/3] m68k: Add support to export bootinfo in procfs
- [PATCH 3/3] [RFC] m68k: Add System RAM to /proc/iomem

Notes:
- The bootinfo is now saved and exported to /proc/bootinfo, so kexec-tools can read it and pass it (possibly after modification) to the new kernel. This is similar to /proc/atags on ARM.

- We should create arch/m68k/include/uapi/asm/bootinfo.h (and probably a few more, e.g. machine-specific model IDs), as this is needed by both m68kboot and kexec-tools.

- I based [PATCH 3/3] on the PowerPC version, but it's no longer needed as we now get this information from the bootinfo.
Does anyone think this is nice to have anyway?

KEXEC-TOOLS:

Patches:
- [PATCH 1/2] kexec: Let slurp_file_len() return the number of bytes
- [PATCH 2/2] kexec: Add preliminary m68k support

Notes:
- Based on git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git

- Tagged bootinfo is read from /proc/bootinfo by default, but this can be overridden using --bootinfo. No bootinfo editor is provided. The kexec command will replace/delete command line and ramdisk tags in the bootinfo.

- The ramdisk is loaded at the top of memory minus 4096, unlike with m68boot (ataboot/amiboot), as locate_hole() seems to have a bug that it cannot reserve a block at the real top of memory.

- The first unused page of the kernel image (at address zero) is automatically removed, just like m68kboot does.
If I don't do this, relocate_new_kernel() fails with a "cannot handle kernel paging request at address NULL" exception, although the MMU is disabled at that point.
As m68kboot does this too, I guess this is OK?

- Do we want to check the struct bootversion at the start of the kernel, like m68kboot does?
Kexec may be used to load ELF files that are not Linux kernel images, and thus don't have a Linux-specific struct bootversion.

- Do we want to check the size of the kernel image + bootinfo, and warn the user if it's larger than 4 MiB?
This is a limitation of the current Linux/m68k kernel only.

All comments are welcome!
Have fun! ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#1 lore raw

PATCH 1/3 m68k: Add preliminary kexec support

---
 arch/m68k/Kconfig                  |   17 ++++++++
 arch/m68k/include/asm/kexec.h      |   29 +++++++++++++
 arch/m68k/kernel/Makefile          |    2 +
 arch/m68k/kernel/machine_kexec.c   |   71 ++++++++++++++++++++++++++++++++
 arch/m68k/kernel/relocate_kernel.S |   79 ++++++++++++++++++++++++++++++++++++
 include/uapi/linux/kexec.h         |    1 +
 6 files changed, 199 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
index 311a300..d60497f 100644
@@ -86,6 +86,23 @@ config MMU_SUN3
 	bool
 	depends on MMU && !MMU_MOTOROLA && !MMU_COLDFIRE
 
+config KEXEC
+	bool "kexec system call"
+	depends on MMU # FIXME
+	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
new file mode 100644
index 0000000..3df97ab
@@ -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
index 655347d..7ee5f00 100644
@@ -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/machine_kexec.c new file +71 -0

71 lines not on this page · raw message

arch/m68k/kernel/relocate_kernel.S new file +79 -0

79 lines not on this page · raw message

include/uapi/linux/kexec.h +1 -0
index 104838f..d6629d4 100644
@@ -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
author maintainer
#2 lore raw

PATCH 2/3 m68k: Add support to export bootinfo in procfs

In reply to Geert Uytterhoeven

Add 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.

---
 arch/m68k/Kconfig                |    7 ++++
 arch/m68k/include/asm/bootinfo.h |    6 +++
 arch/m68k/kernel/Makefile        |    1 +
 arch/m68k/kernel/bootinfo_proc.c |   78 ++++++++++++++++++++++++++++++++++++++
 arch/m68k/kernel/setup_mm.c      |    2 +
 5 files changed, 94 insertions(+)
 create mode 100644 arch/m68k/kernel/bootinfo_proc.c
arch/m68k/Kconfig +7 -0
index d60497f..edd40b0 100644
@@ -103,6 +103,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 +6 -0
index fdc6266..65f5cc6 100644
@@ -47,6 +47,12 @@ struct bi_record {
     unsigned long data[0];		/* data */
 };
 
+#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__ */
 
 
arch/m68k/kernel/Makefile +1 -0
index 7ee5f00..2d5d9be 100644
@@ -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 +78 -0

78 lines not on this page · raw message

arch/m68k/kernel/setup_mm.c +2 -0
index 1e3e2cb..cb7b0c9 100644
@@ -143,6 +143,8 @@ extern void paging_init(void);
 
 static void __init m68k_parse_bootinfo(const struct bi_record *record)
 {
+	save_bootinfo(record);
+
 	while (record->tag != BI_LAST) {
 		int unknown = 0;
 		const unsigned long *data = record->data;
Signature · 1 line
1.7.9.5
author maintainer
#3 lore raw

RFC PATCH 3/3 m68k: Add System RAM to /proc/iomem

In reply to Geert Uytterhoeven

We've resisted adding System RAM to /proc/iomem because it is the wrong place for it. Unfortunately we continue to find tools that rely on this behaviour (e.g. kdump) so give up and add it in.

As the ST-RAM Pool is now a child of the first System RAM resource, it must be switched from request_resource() to insert_resource().

Cfr. commit c40dd2f76644016ca7677545fc846ec2470d70a1 ("powerpc: Add System RAM to /proc/iomem").

---
 arch/m68k/atari/stram.c     |    2 +-
 arch/m68k/kernel/setup_mm.c |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
arch/m68k/atari/stram.c +1 -1
index 0810c8d..74eaed4 100644
@@ -102,7 +102,7 @@ void __init atari_stram_reserve_pages(void *start_mem)
 
 	stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size);
 	stram_pool.end = stram_pool.start + pool_size - 1;
-	request_resource(&iomem_resource, &stram_pool);
+	insert_resource(&iomem_resource, &stram_pool);
 
 	pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
 		 pool_size, &stram_pool);
arch/m68k/kernel/setup_mm.c +23 -0
index cb7b0c9..55d718a 100644
@@ -215,6 +215,27 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 #endif
 }
 
+/*
+ * System memory should not be in /proc/iomem but various tools expect it
+ * (e.g. kdump).
+ */
+static int __init add_system_ram_resources(void)
+{
+	int i;
+
+	for (i = 0; i < m68k_num_memory; i++) {
+		struct resource *res;
+		res = alloc_bootmem(sizeof(struct resource));
+		res->name = "System RAM";
+		res->start = m68k_memory[i].addr;
+		res->end = m68k_memory[i].addr + m68k_memory[i].size - 1;
+		res->flags = IORESOURCE_MEM;
+		WARN_ON(request_resource(&iomem_resource, res) < 0);
+	}
+
+	return 0;
+}
+
 void __init setup_arch(char **cmdline_p)
 {
 #ifndef CONFIG_SUN3
@@ -344,6 +365,8 @@ void __init setup_arch(char **cmdline_p)
 
 	paging_init();
 
+	add_system_ram_resources();
+
 #ifndef CONFIG_SUN3
 	for (i = 1; i < m68k_num_memory; i++)
 		free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,
Signature · 1 line
1.7.9.5
author maintainer
#4 lore raw

PATCH 1/2 kexec: Let slurp_file_len() return the number of bytes read

In reply to Geert Uytterhoeven

Add an optional output parameter to slurp_file_len() so it can return the actual number of bytes read.

---
 kexec/arch/i386/crashdump-x86.c |    5 ++---
 kexec/kexec.c                   |    4 +++-
 kexec/kexec.h                   |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
kexec/arch/i386/crashdump-x86.c +2 -3
index e44fceb..e2da50b 100644
@@ -121,7 +121,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
 	struct mem_ehdr ehdr;
 	struct mem_phdr *phdr, *end_phdr;
 	int align;
-	unsigned long size;
+	off_t size;
 	uint32_t elf_flags = 0;
 
 	if (elf_info->machine != EM_X86_64)
@@ -131,8 +131,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
 		return 0;
 
 	align = getpagesize();
-	size = KCORE_ELF_HEADERS_SIZE;
-	buf = slurp_file_len(kcore, size);
+	buf = slurp_file_len(kcore, KCORE_ELF_HEADERS_SIZE, &size);
 	if (!buf) {
 		fprintf(stderr, "Cannot read %s: %s\n", kcore, strerror(errno));
 		return -1;
kexec/kexec.c +3 -1
index b863d2a..2b98ef0 100644
@@ -537,7 +537,7 @@ char *slurp_file(const char *filename, off_t *r_size)
 /* This functions reads either specified number of bytes from the file or
    lesser if EOF is met. */
 
-char *slurp_file_len(const char *filename, off_t size)
+char *slurp_file_len(const char *filename, off_t size, off_t *nread)
 {
 	int fd;
 	char *buf;
@@ -575,6 +575,8 @@ char *slurp_file_len(const char *filename, off_t size)
 		die("Close of %s failed: %s\n",
 			filename, strerror(errno));
 	}
+	if (nread)
+		*nread = progress;
 	return buf;
 }
 
kexec/kexec.h +1 -1
index 715b568..5844b42 100644
@@ -237,7 +237,7 @@ extern void die(const char *fmt, ...)
 extern void *xmalloc(size_t size);
 extern void *xrealloc(void *ptr, size_t size);
 extern char *slurp_file(const char *filename, off_t *r_size);
-extern char *slurp_file_len(const char *filename, off_t size);
+extern char *slurp_file_len(const char *filename, off_t size, off_t *nread);
 extern char *slurp_decompress_file(const char *filename, off_t *r_size);
 extern unsigned long virt_to_phys(unsigned long addr);
 extern void add_segment(struct kexec_info *info,
Signature · 1 line
1.7.9.5
author maintainer
#5 lore raw

PATCH 1/2 kexec: Let slurp_file_len() return the number of bytes read

In reply to Geert Uytterhoeven

Add an optional output parameter to slurp_file_len() so it can return the actual number of bytes read.

---
 kexec/arch/i386/crashdump-x86.c |    5 ++---
 kexec/kexec.c                   |    4 +++-
 kexec/kexec.h                   |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
kexec/arch/i386/crashdump-x86.c +2 -3
index e44fceb..e2da50b 100644
@@ -121,7 +121,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
 	struct mem_ehdr ehdr;
 	struct mem_phdr *phdr, *end_phdr;
 	int align;
-	unsigned long size;
+	off_t size;
 	uint32_t elf_flags = 0;
 
 	if (elf_info->machine != EM_X86_64)
@@ -131,8 +131,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
 		return 0;
 
 	align = getpagesize();
-	size = KCORE_ELF_HEADERS_SIZE;
-	buf = slurp_file_len(kcore, size);
+	buf = slurp_file_len(kcore, KCORE_ELF_HEADERS_SIZE, &size);
 	if (!buf) {
 		fprintf(stderr, "Cannot read %s: %s\n", kcore, strerror(errno));
 		return -1;
kexec/kexec.c +3 -1
index b863d2a..2b98ef0 100644
@@ -537,7 +537,7 @@ char *slurp_file(const char *filename, off_t *r_size)
 /* This functions reads either specified number of bytes from the file or
    lesser if EOF is met. */
 
-char *slurp_file_len(const char *filename, off_t size)
+char *slurp_file_len(const char *filename, off_t size, off_t *nread)
 {
 	int fd;
 	char *buf;
@@ -575,6 +575,8 @@ char *slurp_file_len(const char *filename, off_t size)
 		die("Close of %s failed: %s\n",
 			filename, strerror(errno));
 	}
+	if (nread)
+		*nread = progress;
 	return buf;
 }
 
kexec/kexec.h +1 -1
index 715b568..5844b42 100644
@@ -237,7 +237,7 @@ extern void die(const char *fmt, ...)
 extern void *xmalloc(size_t size);
 extern void *xrealloc(void *ptr, size_t size);
 extern char *slurp_file(const char *filename, off_t *r_size);
-extern char *slurp_file_len(const char *filename, off_t size);
+extern char *slurp_file_len(const char *filename, off_t size, off_t *nread);
 extern char *slurp_decompress_file(const char *filename, off_t *r_size);
 extern unsigned long virt_to_phys(unsigned long addr);
 extern void add_segment(struct kexec_info *info,
Signature · 1 line
1.7.9.5
Acked-by on v1 1/2
#6 lore raw

Re: [PATCH 1/2] kexec: Let slurp_file_len() return the number of bytes read

Quoted 2 lines · Geert Uytterhoeven

Add an optional output parameter to slurp_file_len() so it can return the actual number of bytes read.

BTW, looking the slurp_file function, it would be better to call/reuse slurp_file_len in slurp_file, care to improve this as well?

Quoted 74 lines
---
 kexec/arch/i386/crashdump-x86.c |    5 ++---
 kexec/kexec.c                   |    4 +++-
 kexec/kexec.h                   |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
kexec/arch/i386/crashdump-x86.c +2 -3
index e44fceb..e2da50b 100644
@@ -121,7 +121,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
 	struct mem_ehdr ehdr;
 	struct mem_phdr *phdr, *end_phdr;
 	int align;
-	unsigned long size;
+	off_t size;
 	uint32_t elf_flags = 0;
 
 	if (elf_info->machine != EM_X86_64)
@@ -131,8 +131,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
 		return 0;
 
 	align = getpagesize();
-	size = KCORE_ELF_HEADERS_SIZE;
-	buf = slurp_file_len(kcore, size);
+	buf = slurp_file_len(kcore, KCORE_ELF_HEADERS_SIZE, &size);
 	if (!buf) {
 		fprintf(stderr, "Cannot read %s: %s\n", kcore, strerror(errno));
 		return -1;
kexec/kexec.c +3 -1
index b863d2a..2b98ef0 100644
@@ -537,7 +537,7 @@ char *slurp_file(const char *filename, off_t *r_size)
 /* This functions reads either specified number of bytes from the file or
    lesser if EOF is met. */
 
-char *slurp_file_len(const char *filename, off_t size)
+char *slurp_file_len(const char *filename, off_t size, off_t *nread)
 {
 	int fd;
 	char *buf;
@@ -575,6 +575,8 @@ char *slurp_file_len(const char *filename, off_t size)
 		die("Close of %s failed: %s\n",
 			filename, strerror(errno));
 	}
+	if (nread)
+		*nread = progress;
 	return buf;
 }
 
kexec/kexec.h +1 -1
index 715b568..5844b42 100644
@@ -237,7 +237,7 @@ extern void die(const char *fmt, ...)
 extern void *xmalloc(size_t size);
 extern void *xrealloc(void *ptr, size_t size);
 extern char *slurp_file(const char *filename, off_t *r_size);
-extern char *slurp_file_len(const char *filename, off_t size);
+extern char *slurp_file_len(const char *filename, off_t size, off_t *nread);
 extern char *slurp_decompress_file(const char *filename, off_t *r_size);
 extern unsigned long virt_to_phys(unsigned long addr);
 extern void add_segment(struct kexec_info *info,
Signature · 7 lines
1.7.9.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author maintainer
#7 lore raw

PATCH 2/2 kexec: Add preliminary m68k support

In reply to Geert Uytterhoeven
---
 configure.ac                           |    2 +-
 kexec/Makefile                         |    1 +
 kexec/arch/m68k/Makefile               |   15 +++
 kexec/arch/m68k/bootinfo.c             |  208 ++++++++++++++++++++++++++++++++
 kexec/arch/m68k/bootinfo.h             |   29 +++++
 kexec/arch/m68k/include/arch/options.h |   45 +++++++
 kexec/arch/m68k/kexec-elf-m68k.c       |  171 ++++++++++++++++++++++++++
 kexec/arch/m68k/kexec-elf-rel-m68k.c   |   41 +++++++
 kexec/arch/m68k/kexec-m68k.c           |  113 +++++++++++++++++
 kexec/arch/m68k/kexec-m68k.h           |    9 ++
 kexec/kexec-syscall.h                  |    7 ++
 11 files changed, 640 insertions(+), 1 deletion(-)
 create mode 100644 kexec/arch/m68k/Makefile
 create mode 100644 kexec/arch/m68k/bootinfo.c
 create mode 100644 kexec/arch/m68k/bootinfo.h
 create mode 100644 kexec/arch/m68k/include/arch/options.h
 create mode 100644 kexec/arch/m68k/kexec-elf-m68k.c
 create mode 100644 kexec/arch/m68k/kexec-elf-rel-m68k.c
 create mode 100644 kexec/arch/m68k/kexec-m68k.c
 create mode 100644 kexec/arch/m68k/kexec-m68k.h
configure.ac +1 -1
index 7b61dbf..704d4f9 100644
@@ -45,7 +45,7 @@ case $target_cpu in
 	cris|crisv32 )
 		ARCH="cris"
 		;;
-	ia64|x86_64|alpha )
+	ia64|x86_64|alpha|m68k )
 		ARCH="$target_cpu"
 		;;
 	* )
kexec/Makefile +1 -0
index 8a6138d..ceb33af 100644
@@ -72,6 +72,7 @@ include $(srcdir)/kexec/arch/alpha/Makefile
 include $(srcdir)/kexec/arch/arm/Makefile
 include $(srcdir)/kexec/arch/i386/Makefile
 include $(srcdir)/kexec/arch/ia64/Makefile
+include $(srcdir)/kexec/arch/m68k/Makefile
 include $(srcdir)/kexec/arch/mips/Makefile
 include $(srcdir)/kexec/arch/cris/Makefile
 include $(srcdir)/kexec/arch/ppc/Makefile
kexec/arch/m68k/Makefile new file +15 -0
new file mode 100644
index 0000000..4645894
@@ -0,0 +1,15 @@
+#
+# kexec m68k (linux booting linux)
+#
+m68k_KEXEC_SRCS =  kexec/arch/m68k/kexec-m68k.c
+m68k_KEXEC_SRCS += kexec/arch/m68k/kexec-elf-m68k.c
+m68k_KEXEC_SRCS += kexec/arch/m68k/kexec-elf-rel-m68k.c
+m68k_KEXEC_SRCS += kexec/arch/m68k/bootinfo.c
+
+m68k_ADD_BUFFER =
+m68k_ADD_SEGMENT =
+m68k_VIRT_TO_PHYS =
+
+dist += kexec/arch/m68k/Makefile $(m68k_KEXEC_SRCS)			\
+	kexec/arch/m68k/kexec-m68k.h					\
+	kexec/arch/m68k/include/arch/options.h
kexec/arch/m68k/bootinfo.c new file +208 -0

208 lines not on this page · raw message

kexec/arch/m68k/bootinfo.h new file +29 -0
new file mode 100644
index 0000000..90e2576
@@ -0,0 +1,29 @@
+#define DEFAULT_BOOTINFO_FILE	"/proc/bootinfo"
+#define MAX_BOOTINFO_SIZE	1536
+
+struct bi_records {
+	unsigned short tag;
+	unsigned short size;
+	union {
+		unsigned long generic[0];
+		struct {
+			unsigned long addr;
+			unsigned long size;
+		} mem_info;
+		char string[0];
+	};
+};
+
+#define BI_LAST		0x0000	// FIXME To be obtained from <asm/bootinfo.h>
+#define BI_MEMCHUNK	0x0005	// FIXME
+#define BI_RAMDISK	0x0006	// FIXME
+#define BI_COMMAND_LINE	0x0007	// FIXME
+
+extern const char *bootinfo_file;
+extern void bootinfo_load(void);
+extern void bootinfo_print(void);
+extern int bootinfo_get_memory_ranges(struct memory_range **range);
+extern void bootinfo_set_cmdline(const char *cmdline);
+extern void bootinfo_set_ramdisk(unsigned long ramdisk_addr,
+				 unsigned long ramdisk_size);
+extern void add_bootinfo(struct kexec_info *info, unsigned long addr);
kexec/arch/m68k/include/arch/options.h new file +45 -0

45 lines not on this page · raw message

kexec/arch/m68k/kexec-elf-m68k.c new file +171 -0

171 lines not on this page · raw message

kexec/arch/m68k/kexec-elf-rel-m68k.c new file +41 -0

41 lines not on this page · raw message

kexec/arch/m68k/kexec-m68k.c new file +113 -0

113 lines not on this page · raw message

kexec/arch/m68k/kexec-m68k.h new file +9 -0
new file mode 100644
index 0000000..99482c4
@@ -0,0 +1,9 @@
+#ifndef KEXEC_M68K_H
+#define KEXEC_M68K_H
+
+int elf_m68k_probe(const char *buf, off_t len);
+int elf_m68k_load(int argc, char **argv, const char *buf, off_t len,
+		  struct kexec_info *info);
+void elf_m68k_usage(void);
+
+#endif /* KEXEC_M68K_H */
kexec/kexec-syscall.h +7 -0
index b56cb00..6238044 100644
@@ -45,6 +45,9 @@
 #if defined(__mips__)
 #define __NR_kexec_load                4311
 #endif
+#ifdef __m68k__
+#define __NR_kexec_load                313
+#endif
 #ifndef __NR_kexec_load
 #error Unknown processor architecture.  Needs a kexec_load syscall number.
 #endif
@@ -67,6 +70,7 @@ static inline long kexec_load(void *entry, unsigned long nr_segments,
  */
 #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)
@@ -114,5 +118,8 @@ static inline long kexec_load(void *entry, unsigned long nr_segments,
 #if defined(__mips__)
 #define KEXEC_ARCH_NATIVE	KEXEC_ARCH_MIPS
 #endif
+#ifdef __m68k__
+#define KEXEC_ARCH_NATIVE	KEXEC_ARCH_68K
+#endif
 
 #endif /* KEXEC_SYSCALL_H */
Signature · 1 line
1.7.9.5
author maintainer
#8 lore raw

RFC PATCH 3/3 m68k: Add System RAM to /proc/iomem

In reply to Geert Uytterhoeven

We've resisted adding System RAM to /proc/iomem because it is the wrong place for it. Unfortunately we continue to find tools that rely on this behaviour (e.g. kdump) so give up and add it in.

As the ST-RAM Pool is now a child of the first System RAM resource, it must be switched from request_resource() to insert_resource().

Cfr. commit c40dd2f76644016ca7677545fc846ec2470d70a1 ("powerpc: Add System RAM to /proc/iomem").

---
 arch/m68k/atari/stram.c     |    2 +-
 arch/m68k/kernel/setup_mm.c |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
arch/m68k/atari/stram.c +1 -1
index 0810c8d..74eaed4 100644
@@ -102,7 +102,7 @@ void __init atari_stram_reserve_pages(void *start_mem)
 
 	stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size);
 	stram_pool.end = stram_pool.start + pool_size - 1;
-	request_resource(&iomem_resource, &stram_pool);
+	insert_resource(&iomem_resource, &stram_pool);
 
 	pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
 		 pool_size, &stram_pool);
arch/m68k/kernel/setup_mm.c +23 -0
index cb7b0c9..55d718a 100644
@@ -215,6 +215,27 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 #endif
 }
 
+/*
+ * System memory should not be in /proc/iomem but various tools expect it
+ * (e.g. kdump).
+ */
+static int __init add_system_ram_resources(void)
+{
+	int i;
+
+	for (i = 0; i < m68k_num_memory; i++) {
+		struct resource *res;
+		res = alloc_bootmem(sizeof(struct resource));
+		res->name = "System RAM";
+		res->start = m68k_memory[i].addr;
+		res->end = m68k_memory[i].addr + m68k_memory[i].size - 1;
+		res->flags = IORESOURCE_MEM;
+		WARN_ON(request_resource(&iomem_resource, res) < 0);
+	}
+
+	return 0;
+}
+
 void __init setup_arch(char **cmdline_p)
 {
 #ifndef CONFIG_SUN3
@@ -344,6 +365,8 @@ void __init setup_arch(char **cmdline_p)
 
 	paging_init();
 
+	add_system_ram_resources();
+
 #ifndef CONFIG_SUN3
 	for (i = 1; i < m68k_num_memory; i++)
 		free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,
Signature · 1 line
1.7.9.5
author maintainer
#9 lore raw

PATCH 2/3 m68k: Add support to export bootinfo in procfs

In reply to Geert Uytterhoeven

Add 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.

---
 arch/m68k/Kconfig                |    7 ++++
 arch/m68k/include/asm/bootinfo.h |    6 +++
 arch/m68k/kernel/Makefile        |    1 +
 arch/m68k/kernel/bootinfo_proc.c |   78 ++++++++++++++++++++++++++++++++++++++
 arch/m68k/kernel/setup_mm.c      |    2 +
 5 files changed, 94 insertions(+)
 create mode 100644 arch/m68k/kernel/bootinfo_proc.c
arch/m68k/Kconfig +7 -0
index d60497f..edd40b0 100644
@@ -103,6 +103,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 +6 -0
index fdc6266..65f5cc6 100644
@@ -47,6 +47,12 @@ struct bi_record {
     unsigned long data[0];		/* data */
 };
 
+#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__ */
 
 
arch/m68k/kernel/Makefile +1 -0
index 7ee5f00..2d5d9be 100644
@@ -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 +78 -0

78 lines not on this page · raw message

arch/m68k/kernel/setup_mm.c +2 -0
index 1e3e2cb..cb7b0c9 100644
@@ -143,6 +143,8 @@ extern void paging_init(void);
 
 static void __init m68k_parse_bootinfo(const struct bi_record *record)
 {
+	save_bootinfo(record);
+
 	while (record->tag != BI_LAST) {
 		int unknown = 0;
 		const unsigned long *data = record->data;
Signature · 7 lines
1.7.9.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author maintainer
#10 lore raw

PATCH 2/2 kexec: Add preliminary m68k support

In reply to Geert Uytterhoeven
---
 configure.ac                           |    2 +-
 kexec/Makefile                         |    1 +
 kexec/arch/m68k/Makefile               |   15 +++
 kexec/arch/m68k/bootinfo.c             |  208 ++++++++++++++++++++++++++++++++
 kexec/arch/m68k/bootinfo.h             |   29 +++++
 kexec/arch/m68k/include/arch/options.h |   45 +++++++
 kexec/arch/m68k/kexec-elf-m68k.c       |  171 ++++++++++++++++++++++++++
 kexec/arch/m68k/kexec-elf-rel-m68k.c   |   41 +++++++
 kexec/arch/m68k/kexec-m68k.c           |  113 +++++++++++++++++
 kexec/arch/m68k/kexec-m68k.h           |    9 ++
 kexec/kexec-syscall.h                  |    7 ++
 11 files changed, 640 insertions(+), 1 deletion(-)
 create mode 100644 kexec/arch/m68k/Makefile
 create mode 100644 kexec/arch/m68k/bootinfo.c
 create mode 100644 kexec/arch/m68k/bootinfo.h
 create mode 100644 kexec/arch/m68k/include/arch/options.h
 create mode 100644 kexec/arch/m68k/kexec-elf-m68k.c
 create mode 100644 kexec/arch/m68k/kexec-elf-rel-m68k.c
 create mode 100644 kexec/arch/m68k/kexec-m68k.c
 create mode 100644 kexec/arch/m68k/kexec-m68k.h
configure.ac +1 -1
index 7b61dbf..704d4f9 100644
@@ -45,7 +45,7 @@ case $target_cpu in
 	cris|crisv32 )
 		ARCH="cris"
 		;;
-	ia64|x86_64|alpha )
+	ia64|x86_64|alpha|m68k )
 		ARCH="$target_cpu"
 		;;
 	* )
kexec/Makefile +1 -0
index 8a6138d..ceb33af 100644
@@ -72,6 +72,7 @@ include $(srcdir)/kexec/arch/alpha/Makefile
 include $(srcdir)/kexec/arch/arm/Makefile
 include $(srcdir)/kexec/arch/i386/Makefile
 include $(srcdir)/kexec/arch/ia64/Makefile
+include $(srcdir)/kexec/arch/m68k/Makefile
 include $(srcdir)/kexec/arch/mips/Makefile
 include $(srcdir)/kexec/arch/cris/Makefile
 include $(srcdir)/kexec/arch/ppc/Makefile
kexec/arch/m68k/Makefile new file +15 -0
new file mode 100644
index 0000000..4645894
@@ -0,0 +1,15 @@
+#
+# kexec m68k (linux booting linux)
+#
+m68k_KEXEC_SRCS =  kexec/arch/m68k/kexec-m68k.c
+m68k_KEXEC_SRCS += kexec/arch/m68k/kexec-elf-m68k.c
+m68k_KEXEC_SRCS += kexec/arch/m68k/kexec-elf-rel-m68k.c
+m68k_KEXEC_SRCS += kexec/arch/m68k/bootinfo.c
+
+m68k_ADD_BUFFER =
+m68k_ADD_SEGMENT =
+m68k_VIRT_TO_PHYS =
+
+dist += kexec/arch/m68k/Makefile $(m68k_KEXEC_SRCS)			\
+	kexec/arch/m68k/kexec-m68k.h					\
+	kexec/arch/m68k/include/arch/options.h
kexec/arch/m68k/bootinfo.c new file +208 -0

208 lines not on this page · raw message

kexec/arch/m68k/bootinfo.h new file +29 -0
new file mode 100644
index 0000000..90e2576
@@ -0,0 +1,29 @@
+#define DEFAULT_BOOTINFO_FILE	"/proc/bootinfo"
+#define MAX_BOOTINFO_SIZE	1536
+
+struct bi_records {
+	unsigned short tag;
+	unsigned short size;
+	union {
+		unsigned long generic[0];
+		struct {
+			unsigned long addr;
+			unsigned long size;
+		} mem_info;
+		char string[0];
+	};
+};
+
+#define BI_LAST		0x0000	// FIXME To be obtained from <asm/bootinfo.h>
+#define BI_MEMCHUNK	0x0005	// FIXME
+#define BI_RAMDISK	0x0006	// FIXME
+#define BI_COMMAND_LINE	0x0007	// FIXME
+
+extern const char *bootinfo_file;
+extern void bootinfo_load(void);
+extern void bootinfo_print(void);
+extern int bootinfo_get_memory_ranges(struct memory_range **range);
+extern void bootinfo_set_cmdline(const char *cmdline);
+extern void bootinfo_set_ramdisk(unsigned long ramdisk_addr,
+				 unsigned long ramdisk_size);
+extern void add_bootinfo(struct kexec_info *info, unsigned long addr);
kexec/arch/m68k/include/arch/options.h new file +45 -0

45 lines not on this page · raw message

kexec/arch/m68k/kexec-elf-m68k.c new file +171 -0

171 lines not on this page · raw message

kexec/arch/m68k/kexec-elf-rel-m68k.c new file +41 -0

41 lines not on this page · raw message

kexec/arch/m68k/kexec-m68k.c new file +113 -0

113 lines not on this page · raw message

kexec/arch/m68k/kexec-m68k.h new file +9 -0
new file mode 100644
index 0000000..99482c4
@@ -0,0 +1,9 @@
+#ifndef KEXEC_M68K_H
+#define KEXEC_M68K_H
+
+int elf_m68k_probe(const char *buf, off_t len);
+int elf_m68k_load(int argc, char **argv, const char *buf, off_t len,
+		  struct kexec_info *info);
+void elf_m68k_usage(void);
+
+#endif /* KEXEC_M68K_H */
kexec/kexec-syscall.h +7 -0
index b56cb00..6238044 100644
@@ -45,6 +45,9 @@
 #if defined(__mips__)
 #define __NR_kexec_load                4311
 #endif
+#ifdef __m68k__
+#define __NR_kexec_load                313
+#endif
 #ifndef __NR_kexec_load
 #error Unknown processor architecture.  Needs a kexec_load syscall number.
 #endif
@@ -67,6 +70,7 @@ static inline long kexec_load(void *entry, unsigned long nr_segments,
  */
 #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)
@@ -114,5 +118,8 @@ static inline long kexec_load(void *entry, unsigned long nr_segments,
 #if defined(__mips__)
 #define KEXEC_ARCH_NATIVE	KEXEC_ARCH_MIPS
 #endif
+#ifdef __m68k__
+#define KEXEC_ARCH_NATIVE	KEXEC_ARCH_68K
+#endif
 
 #endif /* KEXEC_SYSCALL_H */
Signature · 7 lines
1.7.9.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author maintainer
#11 lore raw
In reply to Geert Uytterhoeven
Quoted 6 lines · Geert Uytterhoeven

This is a preliminary set of patches to add kexec support for m68k.

- [PATCH 1/3] m68k: Add preliminary kexec support
- [PATCH 2/3] m68k: Add support to export bootinfo in procfs
- [PATCH 3/3] [RFC] m68k: Add System RAM to /proc/iomem

Quoted 8 lines

Notes:
- The bootinfo is now saved and exported to /proc/bootinfo, so kexec-tools can read it and pass it (possibly after modification) to the new kernel. This is similar to /proc/atags on ARM.

- I based [PATCH 3/3] on the PowerPC version, but it's no longer needed as we now get this information from the bootinfo.
Does anyone think this is nice to have anyway?

It seems kexec/kdump on ppc don't use /proc/iomem anymore, and only rely on /proc/device-tree these days?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#12 lore raw
In reply to Geert Uytterhoeven
Quoted 6 lines · Geert Uytterhoeven

This is a preliminary set of patches to add kexec support for m68k.

- [PATCH 1/3] m68k: Add preliminary kexec support
- [PATCH 2/3] m68k: Add support to export bootinfo in procfs
- [PATCH 3/3] [RFC] m68k: Add System RAM to /proc/iomem

Quoted 8 lines

Notes:
- The bootinfo is now saved and exported to /proc/bootinfo, so kexec-tools can read it and pass it (possibly after modification) to the new kernel. This is similar to /proc/atags on ARM.

- I based [PATCH 3/3] on the PowerPC version, but it's no longer needed as we now get this information from the bootinfo.
Does anyone think this is nice to have anyway?

It seems kexec/kdump on ppc don't use /proc/iomem anymore, and only rely on /proc/device-tree these days?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#13 lore raw
Quoted 13 lines · Geert Uytterhoeven
Quoted 10 lines · Geert Uytterhoeven

This is a preliminary set of patches to add kexec support for m68k.

- [PATCH 1/3] m68k: Add preliminary kexec support
- [PATCH 2/3] m68k: Add support to export bootinfo in procfs
- [PATCH 3/3] [RFC] m68k: Add System RAM to /proc/iomem

Notes:
- The bootinfo is now saved and exported to /proc/bootinfo, so kexec-tools can read it and pass it (possibly after modification) to the new kernel. This is similar to /proc/atags on ARM.

Quoted 6 lines
Quoted 3 lines

- I based [PATCH 3/3] on the PowerPC version, but it's no longer needed as we now get this information from the bootinfo.
Does anyone think this is nice to have anyway?

It seems kexec/kdump on ppc don't use /proc/iomem anymore, and only rely on /proc/device-tree these days?

I think thats entirely a matter for the m68k kernel maintainers to decide. But my personal opinion is that it is nice not to add it if it isn't needed.

#14 lore raw
In reply to Geert Uytterhoeven
Quoted 13 lines · Geert Uytterhoeven
Quoted 10 lines · Geert Uytterhoeven

This is a preliminary set of patches to add kexec support for m68k.

- [PATCH 1/3] m68k: Add preliminary kexec support
- [PATCH 2/3] m68k: Add support to export bootinfo in procfs
- [PATCH 3/3] [RFC] m68k: Add System RAM to /proc/iomem

Notes:
- The bootinfo is now saved and exported to /proc/bootinfo, so kexec-tools can read it and pass it (possibly after modification) to the new kernel. This is similar to /proc/atags on ARM.

Quoted 6 lines
Quoted 3 lines

- I based [PATCH 3/3] on the PowerPC version, but it's no longer needed as we now get this information from the bootinfo.
Does anyone think this is nice to have anyway?

It seems kexec/kdump on ppc don't use /proc/iomem anymore, and only rely on /proc/device-tree these days?

I think thats entirely a matter for the m68k kernel maintainers to decide. But my personal opinion is that it is nice not to add it if it isn't needed.

#15 lore raw
In reply to Geert Uytterhoeven
Quoted 1 line · Geert Uytterhoeven

This is a preliminary set of patches to add kexec support for m68k.

Great, this has been a long time coming!

Quoted 34 lines

- Kexec only, no kdump support yet (do you have enough RAM to keep a crashdump kernel in memory at all times? ;-)

- Tested on ARAnyM only. No support for other CPU/MMUs than 68040.

- Although the code contains some phys/virt conversions, it will probably fail miserably on platforms where kernel virtual addresses are different from physical address.

- 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

KERNEL:

Patches:
- [PATCH 1/3] m68k: Add preliminary kexec support
- [PATCH 2/3] m68k: Add support to export bootinfo in procfs
- [PATCH 3/3] [RFC] m68k: Add System RAM to /proc/iomem

Notes:
- The bootinfo is now saved and exported to /proc/bootinfo, so kexec-tools can read it and pass it (possibly after modification) to the new kernel. This is similar to /proc/atags on ARM.

- We should create arch/m68k/include/uapi/asm/bootinfo.h (and probably a few more, e.g. machine-specific model IDs), as this is needed by both m68kboot and kexec-tools.

Quoted 6 lines

- I based [PATCH 3/3] on the PowerPC version, but it's no longer needed as we now get this information from the bootinfo.
Does anyone think this is nice to have anyway?

KEXEC-TOOLS:

Pasting two series in one was a bit confusing for me at first. Perhaps you could consider posting two separate series in future.

Quoted 6 lines

Patches:
- [PATCH 1/2] kexec: Let slurp_file_len() return the number of bytes
- [PATCH 2/2] kexec: Add preliminary m68k support

Notes:
- Based on git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git

A good choice.

Quoted 4 lines

- Tagged bootinfo is read from /proc/bootinfo by default, but this can be overridden using --bootinfo. No bootinfo editor is provided. The kexec command will replace/delete command line and ramdisk tags in the bootinfo.

This sounds good to me.

Quoted 3 lines

- The ramdisk is loaded at the top of memory minus 4096, unlike with m68boot (ataboot/amiboot), as locate_hole() seems to have a bug that it cannot reserve a block at the real top of memory.

Is this a bug that could be fixed?

Quoted 6 lines

- The first unused page of the kernel image (at address zero) is automatically removed, just like m68kboot does.
If I don't do this, relocate_new_kernel() fails with a "cannot handle kernel paging request at address NULL" exception, although the MMU is disabled at that point.
As m68kboot does this too, I guess this is OK?

It sounds sane to me. But I would appreciate some feedback from someone familiar with the m68k kernel.

Quoted 4 lines

- Do we want to check the struct bootversion at the start of the kernel, like m68kboot does?
Kexec may be used to load ELF files that are not Linux kernel images, and thus don't have a Linux-specific struct bootversion.

If the check can sanely be skipped for non Linux kernel images then this sounds like a reasonable idea to me. Otherwise I would lean towards omitting it. Either way, I don't feel strongly about this.

Quoted 4 lines

- Do we want to check the size of the kernel image + bootinfo, and warn the user if it's larger than 4 MiB?
This is a limitation of the current Linux/m68k kernel only.

I think that sounds like a good idea but I don't feel strongly about it.

Quoted 21 lines

All comments are welcome!
Have fun! ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#16 lore raw
In reply to Geert Uytterhoeven
Quoted 1 line · Geert Uytterhoeven

This is a preliminary set of patches to add kexec support for m68k.

Great, this has been a long time coming!

Quoted 34 lines

- Kexec only, no kdump support yet (do you have enough RAM to keep a crashdump kernel in memory at all times? ;-)

- Tested on ARAnyM only. No support for other CPU/MMUs than 68040.

- Although the code contains some phys/virt conversions, it will probably fail miserably on platforms where kernel virtual addresses are different from physical address.

- 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

KERNEL:

Patches:
- [PATCH 1/3] m68k: Add preliminary kexec support
- [PATCH 2/3] m68k: Add support to export bootinfo in procfs
- [PATCH 3/3] [RFC] m68k: Add System RAM to /proc/iomem

Notes:
- The bootinfo is now saved and exported to /proc/bootinfo, so kexec-tools can read it and pass it (possibly after modification) to the new kernel. This is similar to /proc/atags on ARM.

- We should create arch/m68k/include/uapi/asm/bootinfo.h (and probably a few more, e.g. machine-specific model IDs), as this is needed by both m68kboot and kexec-tools.

Quoted 6 lines

- I based [PATCH 3/3] on the PowerPC version, but it's no longer needed as we now get this information from the bootinfo.
Does anyone think this is nice to have anyway?

KEXEC-TOOLS:

Pasting two series in one was a bit confusing for me at first. Perhaps you could consider posting two separate series in future.

Quoted 6 lines

Patches:
- [PATCH 1/2] kexec: Let slurp_file_len() return the number of bytes
- [PATCH 2/2] kexec: Add preliminary m68k support

Notes:
- Based on git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git

A good choice.

Quoted 4 lines

- Tagged bootinfo is read from /proc/bootinfo by default, but this can be overridden using --bootinfo. No bootinfo editor is provided. The kexec command will replace/delete command line and ramdisk tags in the bootinfo.

This sounds good to me.

Quoted 3 lines

- The ramdisk is loaded at the top of memory minus 4096, unlike with m68boot (ataboot/amiboot), as locate_hole() seems to have a bug that it cannot reserve a block at the real top of memory.

Is this a bug that could be fixed?

Quoted 6 lines

- The first unused page of the kernel image (at address zero) is automatically removed, just like m68kboot does.
If I don't do this, relocate_new_kernel() fails with a "cannot handle kernel paging request at address NULL" exception, although the MMU is disabled at that point.
As m68kboot does this too, I guess this is OK?

It sounds sane to me. But I would appreciate some feedback from someone familiar with the m68k kernel.

Quoted 4 lines

- Do we want to check the struct bootversion at the start of the kernel, like m68kboot does?
Kexec may be used to load ELF files that are not Linux kernel images, and thus don't have a Linux-specific struct bootversion.

If the check can sanely be skipped for non Linux kernel images then this sounds like a reasonable idea to me. Otherwise I would lean towards omitting it. Either way, I don't feel strongly about this.

Quoted 4 lines

- Do we want to check the size of the kernel image + bootinfo, and warn the user if it's larger than 4 MiB?
This is a limitation of the current Linux/m68k kernel only.

I think that sounds like a good idea but I don't feel strongly about it.

Quoted 21 lines

All comments are welcome!
Have fun! ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author maintainer
#17 lore raw

Hi Simon,

Thanks for your comments!

Quoted 2 lines · Simon Horman

Pasting two series in one was a bit confusing for me at first. Perhaps you could consider posting two separate series in future.

Sorry, I wanted to have all information in one series for the first posting, to avoid people having to look around too much if they want to give it a try.

I'll post seperate series in the future.

Quoted 8 lines
Quoted 6 lines

Patches:
- [PATCH 1/2] kexec: Let slurp_file_len() return the number of bytes
- [PATCH 2/2] kexec: Add preliminary m68k support

Notes:
- Based on git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git

A good choice.

Is it normal I don't see much activity there?

Quoted 5 lines
Quoted 3 lines

- The ramdisk is loaded at the top of memory minus 4096, unlike with m68boot (ataboot/amiboot), as locate_hole() seems to have a bug that it cannot reserve a block at the real top of memory.

Is this a bug that could be fixed?

Possibly. I suspect an off-by-one bug somewhere, but I haven't looked deeply into it.

Quoted 9 lines
Quoted 4 lines

- Do we want to check the struct bootversion at the start of the kernel, like m68kboot does?
Kexec may be used to load ELF files that are not Linux kernel images, and thus don't have a Linux-specific struct bootversion.

If the check can sanely be skipped for non Linux kernel images then this sounds like a reasonable idea to me. Otherwise I would lean towards omitting it. Either way, I don't feel strongly about this.

Quoted 5 lines
Quoted 3 lines

- Do we want to check the size of the kernel image + bootinfo, and warn the user if it's larger than 4 MiB?
This is a limitation of the current Linux/m68k kernel only.

I think that sounds like a good idea but I don't feel strongly about it.

Currently I'm leaning towards just printing a warning for both (missing/incompatible
bootversion and image-too-large).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#18 lore raw
In reply to Simon Horman

Hi Simon,

Thanks for your comments!

Quoted 2 lines · Simon Horman

Pasting two series in one was a bit confusing for me at first. Perhaps you could consider posting two separate series in future.

Sorry, I wanted to have all information in one series for the first posting, to avoid people having to look around too much if they want to give it a try.

I'll post seperate series in the future.

Quoted 8 lines
Quoted 6 lines

Patches:
- [PATCH 1/2] kexec: Let slurp_file_len() return the number of bytes
- [PATCH 2/2] kexec: Add preliminary m68k support

Notes:
- Based on git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git

A good choice.

Is it normal I don't see much activity there?

Quoted 5 lines
Quoted 3 lines

- The ramdisk is loaded at the top of memory minus 4096, unlike with m68boot (ataboot/amiboot), as locate_hole() seems to have a bug that it cannot reserve a block at the real top of memory.

Is this a bug that could be fixed?

Possibly. I suspect an off-by-one bug somewhere, but I haven't looked deeply into it.

Quoted 9 lines
Quoted 4 lines

- Do we want to check the struct bootversion at the start of the kernel, like m68kboot does?
Kexec may be used to load ELF files that are not Linux kernel images, and thus don't have a Linux-specific struct bootversion.

If the check can sanely be skipped for non Linux kernel images then this sounds like a reasonable idea to me. Otherwise I would lean towards omitting it. Either way, I don't feel strongly about this.

Quoted 5 lines
Quoted 3 lines

- Do we want to check the size of the kernel image + bootinfo, and warn the user if it's larger than 4 MiB?
This is a limitation of the current Linux/m68k kernel only.

I think that sounds like a good idea but I don't feel strongly about it.

Currently I'm leaning towards just printing a warning for both (missing/incompatible
bootversion and image-too-large).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#19 lore raw
Quoted 4 lines · Geert Uytterhoeven

Hi Simon,

Thanks for your comments!

Quoted 8 lines
Quoted 2 lines · Simon Horman

Pasting two series in one was a bit confusing for me at first. Perhaps you could consider posting two separate series in future.

Sorry, I wanted to have all information in one series for the first posting, to avoid people having to look around too much if they want to give it a try.

I'll post seperate series in the future.

Thanks.

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines

Patches:
- [PATCH 1/2] kexec: Let slurp_file_len() return the number of bytes
- [PATCH 2/2] kexec: Add preliminary m68k support

Notes:
- Based on git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git

A good choice.

Is it normal I don't see much activity there?

Yes, that is normal.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

- The ramdisk is loaded at the top of memory minus 4096, unlike with m68boot (ataboot/amiboot), as locate_hole() seems to have a bug that it cannot reserve a block at the real top of memory.

Is this a bug that could be fixed?

Possibly. I suspect an off-by-one bug somewhere, but I haven't looked deeply into it.

My feeling is that if possible it would be better to fix the bug than add a work-around.

Quoted 13 lines
Quoted 13 lines
Quoted 4 lines

- Do we want to check the struct bootversion at the start of the kernel, like m68kboot does?
Kexec may be used to load ELF files that are not Linux kernel images, and thus don't have a Linux-specific struct bootversion.

If the check can sanely be skipped for non Linux kernel images then this sounds like a reasonable idea to me. Otherwise I would lean towards omitting it. Either way, I don't feel strongly about this.

Quoted 3 lines

- Do we want to check the size of the kernel image + bootinfo, and warn the user if it's larger than 4 MiB?
This is a limitation of the current Linux/m68k kernel only.

Quoted 5 lines
Quoted 1 line

I think that sounds like a good idea but I don't feel strongly about it.

Currently I'm leaning towards just printing a warning for both (missing/incompatible
bootversion and image-too-large).

That sounds fine to me.