summaryrefslogtreecommitdiff
path: root/kexec/arch
AgeCommit message (Collapse)Author
2010-08-20Prevent initrd-start and initrd-end from appearing multiple timesMatthew McClintock
We always remove the old entry, and add it back if it is needed on for the kexec'ed kernel Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-08-20Prevent multiple reservations for cpu-release-addrMatthew McClintock
Currently, we can add a lot of reservations over a small range, this does a simple check to verify the previous entry is not the same as the current one and skips it if so Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-08-20Ramdisk address was not copied correctly on kexec'ed kernelMatthew McClintock
Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-29Add support for reworking flat device tree supportMatthew McClintock
Currently, the device tree is passed as is. You can optionally update the command line and specifically listed nodes but nothing is updated automatically. This patch updates the memreserve regions, memory node, initrd nodes and attempts to make the device tree look as it should. Some code is borrowed from the u-boot routines which do similiar things Also, now if no flat device tree is passed to kexec it will attempt to rebuild one from the /proc/device-tree file system to use for the kexec'ed kernel for both uImage and elf formats [ horms@verge.net.au: kernel_addr is now outside #ifdef WITH_GAMECUBE ] Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-29Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppcMatthew McClintock
This fixes --reuseinitrd and --ramdisk option for ppc32 on uImage-ppc and Elf. It works for normal kexec as well as for kdump. When using --reuseinitrd you need to specifify retain_initrd on the command line. Also, if you are doing kdump you need to make sure your initrd lives in the crashdump region otherwise the kdump kernel will not be able to access it. The --ramdisk option should always work. [ horms@verge.net.au: minor up-port ] Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-29Update Elf-ppc to support crash kernel and misc fixesMatthew McClintock
Use current command line if none given, specifically useful for when arguments are added causing the use of the current cmdline to not occur We also try to load the dtb above the kernel, this is useful for relocatable kernels where they device tree needs to reside just above the kernel base address Set the kernel entry address in the relocatable purgatory code so we jump to the correct start address if not the default. Useful for relocatable kernels [ horms@verge.net.au: moved kernel_addr declaration to outside #ifdef WITH_GAMECUBE ] Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-29Update uImage to support crash kernel and misc fixesMatthew McClintock
Use current command line if none given, specifically useful for when arguments are added causing the use of the current cmdline to not occur. We also try to load the dtb above the kernel, this is useful for relocatable kernels where they device tree needs to reside just above the kernel base address. Only allocate 1 MiB extra for bss space after kernel as it appears to be more than adequate. Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-29Fix case where phys_addr_t != unsigned long when reading proc entriesMatthew McClintock
On some actitectures the physical memory can be 64 bits, therefore the code that reads proc entries needs to take into account it could read either a 32 bit or 64bit value for the physical addresses. Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-29Restore kexec uImage-ppc to working stateMatthew McClintock
Booting with uImage-ppc was broken by previous work, this patch should restore it to working order Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-29kexec: fix /sys/firmware/memmap memory range overlapsCliff Wickman
The memory ranges derived from /sys/firmware/memmap may overlap, causing the kexec command to fail to load the crash kernel. The typical failure reports 'Overlapping memory segments at 0x...'. The preferred remedy might be to fix the BIOS or the kernel, but given that they may at times generate overlaps, a check in the kexec command will prevent crash dumps from being effectively disabled. Diffed against git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools.git Signed-off-by: Cliff Wickman <cpw@sgi.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-13build: Include missing files in tarballSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-06-17kexec: extend for large cpu count and memoryCliff Wickman
The MAX_MEMORY_RANGES of 64 is too small for a very large NUMA machine. (A 512 processor SGI UV, for example.) And fix a temporary workaround (hack) in load_crashdump_segments() that assumes that 16k is sufficient for the size of the crashdump elf header. This is too small for a machine with a large cpu count. A PT_NOTE is created in the elf header for each cpu. Signed-off-by: Cliff Wickman <cpw@sgi.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-19kexec-tools: Fix option/argument parsingMatt Evans
The argument parsing is currently a bit broken as main()'s getopt_long() knows nothing about either the architecture-specific options or, even more specifically, the architecture-and-loader-specific options. This patch introduces new #defines for all architectures, KEXEC_ALL_OPTIONS and KEXEC_ALL_OPT_STR. These contain all possible options for a given build, and the getopt_long() passes in main() and arch_process_options() will now recognise arch- and loader-specific options; these will not be re-ordered in argv[], there is no confusion over which argv[] entry is the kernel filename, and using '--opt=foo' and '--opt foo' both work. All architectures have command line options (and #define OPT_BLAHs) consolidated into their include/arch/option.h files. x86_64 builds parts of i386/ as well, so now both share a single option.h file (with a symlink). Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-19kexec: implement ARM crashdump supportMika Westerberg
Implement support for loading dump capture kernels for ARM architecture. ARM doesn't need any backup memory regions so only elfcore header is allocated from the top of the reserved memory region. Only zImages are supported. The dump capture kernel needs to be loaded to physical address corresponding to the memory region reserved with 'crashkernel=size@start' kernel command line parameter. Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-19ppc: Fix gamecube buildSimon Horman
This fixes the kexec-build on ppc32 when the --game-cube option is supplied to ./configure. It seems to have bit-rotted a little. Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Cc: Maxim Uvarov <muvarov@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-19kexec-tools, ppc64: Fix segfault parsing DR memory propertyMatt Evans
add_dyn_reconf_usable_mem_property() iterates over memory spans in /ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory and intersects these with usablemem_rgns ranges. In doing so it used an unchecked fixed-size array which will overrun on machines with lots of LMBs. This patch removes the fixed-sized arrays from add_dyn_reconf_usable_mem_property() and add_usable_mem_property(), in lieu of malloc/realloc/free. Signed-off-by: Matt Evans <matt@ozlabs.org> Michael Neuling <mikey@neuling.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-13Fix kexec on powerpc32Maxim Uvarov
Signed-off-by: Maxim Uvarov <muvarov@gmail.com> Signed-off-by: Maxim Uvarov <muvarov@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-13kexec-tools: remove unused code from arch_process_options (arm, cris, ia64, ↵Matt Evans
mips, ppc) These architectures don't have any architecture-specific options (note: distinct from loader options, which are more specific), yet their arch_process_options() functions contain getopts_long() calls followed by no argument processing. The code doesn't do anything, so this patch removes it. Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-12build: Don't modify CFLAGS in kexec/arch/mips/MakefileSimon Horman
Revert this portion of recent MIPS changes as it actually effects the CFLAGS for all architectures. Moreover I'm somewhat dubious about defaulting to -Werror for any architecture. Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-11arm: place initrd to safer place according to zImage lengthEric Miao
The original fixed address of 0x800000 may be overwritten after the kernel is decompressed. Assume a maximum decompression ratio of 4 and place initrd right after that, just to be safer. Signed-off-by: Eric Miao <eric.miao@canonical.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-10kexec-tools, ppc64: Fix segfault on parsing of large device trees.Matt Evans
ppc64's fs2dt used to use a fixed-size array into which the device tree was parsed. There was no bounds checking, so with a large device tree other heap data ended up getting stomped -- SIGSEGV time. This patch adds a function, 'dt_reserve', to check whether there's enough space left prior to writing data to the array. If not, the array is realloced. Signed-off-by: Matt Evans <matt@ozlabs.org> Ack-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-05kexec-tools, ppc64: fix build error on ppc64Michael Neuling
6adc05c6e3fdbc8b9f5d915af78ca05d0a09cb17 "some kexec MIPS improvements" broke pp64 as it turned on -Werror for all archs. This fixes the warning and hence ppc64 building. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-04-01Merge branch 'ppc32' of git://git.breakpoint.cc/bigeasy/kexec-toolsSimon Horman
2010-03-31Let SH adn ARM use common uImage probe codeSebastian Andrzej Siewior
The now generic probe function is more complete than the currently used. It seems that ARM's and SH's uImage are always uncompressed so it might be good to check for this. Cc: Paul Mundt <lethal@linux-sh.org> Cc: Marc Andre Tanner <mat@brain-dump.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2010-03-31Split Powerpc's uImage codeSebastian Andrzej Siewior
The check and uncompress code could be split and recycled by other arch. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2010-03-24kexec-tools: Fix unused return value warning for freadAmeya Palande
Signed-off-by: Ameya Palande <ameya.palande@nokia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-03-11x86: Fix biarch crashdump setup.Eric W. Biederman
Generate the correct crashdump header for x86_64 kernels when a 32bit kernel is used. Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-03-08some kexec MIPS improvementsMaxim Uvarov
- 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 Signed-off-by: Maxim Uvarov <muvarov@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-03-07powerpc32: add support for uImageSebastian Andrzej Siewior
On PowerPC the uImage usually contains the compressed "final" kernel and not a tiny wrapper which relocates itself und uncomprosses the final kernel to its final position. Instead we uncompress the gzip image and put it the its final position. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2010-03-07powerpc32: add support to fixup the dtbSebastian Andrzej Siewior
A few device nodes are dynamically determined by the bootloader (MAC address, memory size, ..) and are not part of the device tree. The kernel command line is also read from dtb and usually not part of the device tree. With the libfdt it is now easy to add/replace nodes in the device tree. The user may specify "--reuse-node=/memory/reg" to update the memory/reg node to what ever is now. This requires the kernel to export the device tree via the procfs in /proc/device-tree. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2010-03-07powerpc32: pull in libfdtSebastian Andrzej Siewior
This is v1.2.0 of libfdt from the dtc project which is available at git://www.jdl.com/software/dtc.git The other files - include/page.h - include/types.h - libfdt-wrapper.c - ops.h are part of the glue code which is used the powerpc boot wrapper code is comming from the Linux kernel v2.6.27-rc6 and has been modified a little to fit. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2010-03-07powerpc: dtb and purgatory support for ppc32Sebastian Andrzej Siewior
Some code dtb scanning & filling has been borrowed from ppc64. The old behavior is still available if compiled with GameCube, other PowerPC platform use the can purgatory and specify a new dtb. Booting a self contained elf image (incl. dtb / without the need for a bd sturct or the like) can be booted. The dtb support is currently optional. That means if the elf image does not contain a dtb file then the user has to supply a complete dtb (including mem size, command line, bus freq., mac addr, ...) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2010-03-03kexec/kdump: RMO region does not exist in drconf memoryChandru
The RMO region can only exist in '/memory@0' node in the device tree. While adding support for '/ibm,dynamic-reconfiguration-memory' in kexec-tools, I incorrectly extended the code of '/memory@' nodes to drconf memory with the assumption that what applies to '/memory@' nodes would also apply to drconf memory. This is incorrect and hence removing the code from kexec-tools now. With this code in place, kexec on kexec fails. The first kexec works because '/memory@0' node is read after drconf memory and that correctly sets rmo_base and rmo_top from '/memory@0' node. While in the kexec'ed kernel, '/ibm,dynamic-reconfiguration-memory' is read after '/memory@xxx' nodes and this incorrectly sets both rmo_base and rmo_top from drconf memory. Sorry for introducing this bug. Signed-off-by: Chandru Siddalingappa <chandru@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-18x86_64: use correct PAGE_OFFSETSimon Horman
This fixes a bug when using gdb with vmcore as explained by Dave Anderson: The kexec/arch/x86_64/crashdump-x86_64.h file contains a stale PAGE_OFFSET value. In 2.6.27 it was changed from 0xffff810000000000UL to 0xffff880000000000UL. This is only a problem when using gdb with the vmlinux/vmcore pair, because gdb relies upon the PT_LOAD segment's p_vaddr values in the ELF header to be correct. Cc: Dave Anderson <anderson@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02cris: cast trampoline_baseSimon Horman
# crisv32-axis-linux-gnu-gcc --version crisv32-axis-linux-gnu-gcc (GCC) 3.2.1 Axis release R64/1.64 Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # make kexec/arch/cris/kexec-elf-cris.c: In function `elf_cris_load': kexec/arch/cris/kexec-elf-cris.c:134: warning: assignment makes pointer from integer without a cast Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02arm: Initialise initrd_start in zImage_arm_load()Simon Horman
Although the following compiler warning is bogus it seems harmless to initialise initrd_start to NULL. # arm-unknown-linux-gnu-gcc --version arm-unknown-linux-gnu-gcc (GCC) 4.1.1 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # make kexec/arch/arm/kexec-zImage-arm.c: In function 'zImage_arm_load': kexec/arch/arm/kexec-zImage-arm.c:135: warning: 'initrd_start' may be used uninitialized in this function Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02arm: Include unistd.h for getpagesize()Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02sh: netbsd_booter extern qualifier should come firstSimon Horman
# sh4-unknown-linux-gnu-gcc --version sh4-unknown-linux-gnu-gcc (GCC) 4.1.1 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # make kexec/arch/sh/kexec-netbsd-sh.c:29: warning: 'extern' is not at beginning of declaration Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02sh: Use size_t for zero_page_size parameter of kexec_sh_setup_zero_page()Simon Horman
This avoids comparisons between signed and unsigned integers. Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Don't discard the const qualifier of proc_iomem()Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02ia64: move_loaded_segments: handle no matching regionSimon Horman
Apparently this never happens, but the current code seems excessively loose. 1) die if it does happen 2) initialise offset to make gcc happy. # ia64-unknown-linux-gnu-gcc --version ia64-unknown-linux-gnu-gcc (GCC) 3.4.5 Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # make kexec/arch/ia64/kexec-elf-ia64.c: In function `move_loaded_segments': kexec/arch/ia64/kexec-elf-ia64.c:102: warning: 'offset' might be used uninitialized in this function Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Cast 64bit pointer to a 64bit int then a 32bit intSimon Horman
The two-stage cast is because we really do want a 32bit integer value from a 64bit pointer, and gcc assumes that we're making a mistake if there is just one cast. # powerpc64-unknown-linux-gnu-gcc --version powerpc64-unknown-linux-gnu-gcc (GCC) 4.1.1 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # make kexec/arch/ppc64/kexec-elf-rel-ppc64.c: In function 'machine_apply_elf_rel': kexec/arch/ppc64/kexec-elf-rel-ppc64.c:66: warning: cast from pointer to integer of different size Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Consistently use signed char buffers throughoutSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Make purgatory a signed char bufferSimon Horman
The consumer of the purgatory buffer, elf_rel_build_load() expects a signed char buffer. Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02x86_64: initialise temp_region in exclude_region() and delete_memmap()Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Use C99 initialisersSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02unsigned values are always at least 0Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Use casts to avoid ambiguity when comparing off_t and size_tSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Avoid possible overflows from signed/unsigned comparisonsSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02ppc: memory_range global is only used in conjunction with WITH_GAMECUBESimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>