some kexec MIPS improvements
Subsystems (3)
PATCH 1/1 some kexec MIPS improvements
Hello folks,
Please find here MIPS crash and kdump patches. This is patch set of 3 patches:
1. generic MIPS changes (kernel);
2. MIPS Cavium Octeon board kexec/kdump code (kernel);
3. Kexec user space MIPS changes.
Patches were tested on the latest linux-mips@ git kernel and the latest kexec-tools git on Cavium Octeon 50xx board.
I also made the same code working on RMI XLR/XLS boards for both mips32 and mips64 kernels.
Best regards,
Maxim Uvarov.
From: Maxim Uvarov <[email protected]>
Changes are:
- using simple mips* ) in configure.ac to make it compilable on mips2
and mips64
- remove kexec/arch/mips/mips-setup-simple.S which prepares cmdline for new kernel, it is better to move this work to kernel code. BTW this code was compilable only on o32 because of t4 is not defined on 64-64 or n32 MIPS ABIs.
- simple put cmdline as string, kernel code should catch cmdline like this int board_kexec_prepare(struct kimage *image)
{
int i;
char *bootloader = "kexec";
board_boot_desc_ptr->argc = 0;
for(i=0;i<image->nr_segments;i++)
{
printk("segment %d
if (!strncmp(bootloader, (char*)image->segment[i].buf,
strlen(bootloader)))
{
/*
* convert command line string to array
* of parameters (as bootloader does).
*/
int argc = 0, offt;
char *str = (char *)image->segment[i].buf;
char *ptr = strchr(str, ' ');
while (ptr && (ARGV_MAX_ARGS > argc)) {
*ptr = '\0';
if (ptr[1] != ' ') {
offt = (int)(ptr - str + 1);
boot_desc_ptr->argv[argc] =
image->segment[i].mem + offt;
argc++;
}
ptr = strchr(ptr + 1, ' ');
}
boot_desc_ptr->argc = argc;
break;
}
} Keep it as string make code simple and more readable.
- add crashdump support
- do not redefine syscalls numbers if they defined in system remove fixups for /proc/iomem. If your board provides wrong /proc/iomem please fix kernel, or at least you local version of kexec. No need to support it in main line. At least add option --fake-iomem
- some minor fixes
---
configure.ac | 2 kexec/arch/mips/Makefile | 4 kexec/arch/mips/crashdump-mips.c | 377 +++++++++++++++++++++++++++++++++++ kexec/arch/mips/crashdump-mips.h | 27 +++ kexec/arch/mips/kexec-elf-mips.c | 141 +++++++------ kexec/arch/mips/kexec-mips.c | 51 +---- kexec/arch/mips/kexec-mips.h | 9 + kexec/arch/mips/mips-setup-simple.S | 110 ---------- kexec/crashdump.h | 2 kexec/kexec-syscall.h | 2 10 files changed, 510 insertions(+), 215 deletions(-) create mode 100644 kexec/arch/mips/crashdump-mips.c create mode 100644 kexec/arch/mips/crashdump-mips.h delete mode 100644 kexec/arch/mips/mips-setup-simple.S
configure.ac +1 -1
@@ -39,7 +39,7 @@ case $target_cpu in sh4|sh4a|sh3|sh ) ARCH="sh" ;; - mips|mipsel ) + mips* ) ARCH="mips" ;; cris|crisv32 )
kexec/arch/mips/Makefile +3 -1
@@ -4,7 +4,7 @@ mips_KEXEC_SRCS = kexec/arch/mips/kexec-mips.c mips_KEXEC_SRCS += kexec/arch/mips/kexec-elf-mips.c mips_KEXEC_SRCS += kexec/arch/mips/kexec-elf-rel-mips.c -mips_KEXEC_SRCS += kexec/arch/mips/mips-setup-simple.S +mips_KEXEC_SRCS += kexec/arch/mips/crashdump-mips.c mips_ADD_BUFFER = mips_ADD_SEGMENT =
@@ -12,5 +12,7 @@ mips_VIRT_TO_PHYS = dist += kexec/arch/mips/Makefile $(mips_KEXEC_SRCS) \ kexec/arch/mips/kexec-mips.h \ + kexec/arch/mips/crashdump-mips.h \ kexec/arch/mips/include/arch/options.h +CFLAGS +=-Wall -Werror
kexec/arch/mips/crashdump-mips.c new file +377 -0
377 lines not on this page · raw message
kexec/arch/mips/crashdump-mips.h new file +27 -0
@@ -0,0 +1,27 @@ +#ifndef CRASHDUMP_MIPS_H +#define CRASHDUMP_MIPS_H + +struct kexec_info ; +int load_crashdump_segments (struct kexec_info *info,char *mod_cmdline, +unsigned long max_addr,unsigned long min_base); +#ifdef __mips64 +#define PAGE_OFFSET 0xa800000000000000ULL +#else +#define PAGE_OFFSET 0x80000000 +#endif +#define __pa (x) ((unsigned long)(X) & 0x7fffffff) + +#define MAXMEM 0x80000000 + +#define CRASH_MAX_MEMMAP_NR (KEXEC_MAX_SEGMENTS + 1) +#define CRASH_MAX_MEMORY_RANGES (MAX_MEMORY_RANGES + 2) + +#define COMMAND_LINE_SIZE 512 + +/* Backup Region, First 1M of System RAM. */ +#define BACKUP_SRC_START 0x00000000 +#define BACKUP_SRC_END 0x000fffff +#define BACKUP_SRC_SIZE (BACKUP_SRC_END - BACKUP_SRC_START + 1) + +extern struct arch_options_t arch_options; +#endif /* CRASHDUMP_MIPS_H */
kexec/arch/mips/kexec-elf-mips.c +75 -66
184 lines not on this page · raw message
kexec/arch/mips/kexec-mips.c +15 -36
115 lines not on this page · raw message
kexec/arch/mips/kexec-mips.h +9 -0
@@ -1,6 +1,11 @@#ifndef KEXEC_MIPS_H #define KEXEC_MIPS_H +#define MAX_MEMORY_RANGES 64 +#define MAX_LINE 160 + +#define CORE_TYPE_ELF32 1 +#define CORE_TYPE_ELF64 2extern unsigned char setup_simple_start[];extern uint32_t setup_simple_size;
@@ -14,4 +19,8 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len, struct kexec_info *info);void elf_mips_usage (void ); +struct arch_options_t { +int core_header_type; +}; +#endif /* KEXEC_MIPS_H */
kexec/arch/mips/mips-setup-simple.S deleted +0 -110
110 lines not on this page · raw message
kexec/crashdump.h +1 -1
@@ -26,7 +26,7 @@ struct crash_elf_info {unsigned long backup_src_start;unsigned long backup_src_end; -unsigned long page_offset; +unsigned long long page_offset;unsigned long lowmem_limit;int (*get_note_info)(int cpu,uint64_t *addr,uint64_t *len);
kexec/kexec-syscall.h +2 -0
@@ -22,6 +22,7 @@#define LINUX_REBOOT_CMD_KEXEC_OLD2 0x18263645#define LINUX_REBOOT_CMD_KEXEC 0x45584543 +#ifndef __NR_kexec_load#ifdef __i386__#define __NR_kexec_load 283#endif
@@ -60,6 +61,7 @@#ifndef __NR_kexec_load#error Unknown processor architecture. Needs a kexec_load syscall number.#endif +#endif /*ifndef __NR_kexec_load*/ struct kexec_segment ;
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec