aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/kernel/machine_kexec.c
AgeCommit message (Collapse)AuthorFilesLines
2013-11-30ARM: 7897/1: kexec: Use the right ISA for relocate_new_kernelDave Martin1-7/+10
Copying a function with memcpy() and then trying to execute the result isn't trivially portable to Thumb. This patch modifies the kexec soft restart code to copy its assembler trampoline relocate_new_kernel() using fncpy() instead, so that relocate_new_kernel can be in the same ISA as the rest of the kernel without problems. Signed-off-by: Dave Martin <[email protected]> Acked-by: Will Deacon <[email protected]> Reported-by: Taras Kondratiuk <[email protected]> Tested-by: Taras Kondratiuk <[email protected]> Signed-off-by: Russell King <[email protected]>
2013-08-20ARM: 7815/1: kexec: offline non panic CPUs on Kdump panicVijaya Kumar K1-0/+1
In case of normal kexec kernel load, all cpu's are offlined before calling machine_kexec().But in case crash panic cpus are relaxed in machine_crash_nonpanic_core() SMP function but not offlined. When crash kernel is loaded with kexec and on panic trigger machine_kexec() checks for number of cpus online. If more than one cpu is online machine_kexec() fails to load with below error kexec: error: multiple CPUs still online In machine_crash_nonpanic_core() SMP function, offline CPU before cpu_relax Signed-off-by: Vijaya Kumar K <[email protected]> Acked-by: Stephen Warren <[email protected]> Acked-by: Will Deacon <[email protected]> Signed-off-by: Russell King <[email protected]>
2013-08-13ARM: 7807/1: kexec: validate CPU hotplug supportStephen Warren1-4/+16
Architectures should fully validate whether kexec is possible as part of machine_kexec_prepare(), so that user-space's kexec_load() operation can report any problems. Performing validation in machine_kexec() itself is too late, since it is not allowed to return. Prior to this patch, ARM's machine_kexec() was testing after-the-fact whether machine_kexec_prepare() was able to disable all but one CPU. Instead, modify machine_kexec_prepare() to validate all conditions necessary for machine_kexec_prepare()'s to succeed. BUG if the validation succeeded, yet disabling the CPUs didn't actually work. Signed-off-by: Stephen Warren <[email protected]> Acked-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Russell King <[email protected]>
2013-06-17ARM: 7759/1: decouple CPU offlining from reboot/shutdownStephen Warren1-0/+4
Add comments to machine_shutdown()/halt()/power_off()/restart() that describe their purpose and/or requirements re: CPUs being active/not. In machine_shutdown(), replace the call to smp_send_stop() with a call to disable_nonboot_cpus(). This completely disables all but one CPU, thus satisfying the requirement that only a single CPU be active for kexec. Adjust Kconfig dependencies for this change. In machine_halt()/power_off()/restart(), call smp_send_stop() directly, rather than via machine_shutdown(); these functions don't need to completely de-activate all CPUs using hotplug, but rather just quiesce them. Remove smp_kill_cpus(), and its call from smp_send_stop(). smp_kill_cpus() was indirectly calling smp_ops.cpu_kill() without calling smp_ops.cpu_die() on the target CPUs first. At least some implementations of smp_ops had issues with this; it caused cpu_kill() to hang on Tegra, for example. Since smp_send_stop() is only used for shutdown, halt, and power-off, there is no need to attempt any kind of CPU hotplug here. Adjust Kconfig to reflect that machine_shutdown() (and hence kexec) relies upon disable_nonboot_cpus(). However, this alone doesn't guarantee that hotplug will work, or even that hotplug is implemented for a particular piece of HW that a multi-platform zImage runs on. Hence, add error-checking to machine_kexec() to determine whether it did work. Suggested-by: Russell King <[email protected]> Signed-off-by: Stephen Warren <[email protected]> Acked-by: Will Deacon <[email protected]> Tested-by: Zhangfei Gao <[email protected]> Signed-off-by: Russell King <[email protected]>
2012-10-18ARM: 7555/1: kexec: fix segment memory addresses checkAaro Koskinen1-4/+3
Commit c564df4db85aac8d1d65a56176a0a25f46138064 (ARM: 7540/1: kexec: Check segment memory addresses) added a safety check with accidentally reversed condition, and broke kexec functionality on ARM. Fix this. Acked-by: Will Deacon <[email protected]> Signed-off-by: Aaro Koskinen <[email protected]> Signed-off-by: Russell King <[email protected]>
2012-09-26ARM: 7540/1: kexec: Check segment memory addressesMatthew Leach1-0/+6
Ensure that the memory regions that are set within the segments correspond to physical contiguous memory regions. Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Will Deacon <[email protected]> Signed-off-by: Matthew Leach <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Russell King <[email protected]>
2012-09-26ARM: 7539/1: kexec: scan for dtb magic in segmentsMatthew Leach1-1/+22
This patch allows a dtb to be passed to a new kernel using the kexec mechinism. When loading segments from userspace, scan each segment's first four bytes for the dtb magic. If this is found set the kexec_boot_atags parameter to the relocate_kernel code to the phyical address of this segment. Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Will Deacon <[email protected]> Signed-off-by: Matthew Leach <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Russell King <[email protected]>
2012-03-29Merge branch 'for-linus' of git://git.linaro.org/people/rmk/linux-armLinus Torvalds1-0/+25
Pull more ARM updates from Russell King. This got a fair number of conflicts with the <asm/system.h> split, but also with some other sparse-irq and header file include cleanups. They all looked pretty trivial, though. * 'for-linus' of git://git.linaro.org/people/rmk/linux-arm: (59 commits) ARM: fix Kconfig warning for HAVE_BPF_JIT ARM: 7361/1: provide XIP_VIRT_ADDR for no-MMU builds ARM: 7349/1: integrator: convert to sparse irqs ARM: 7259/3: net: JIT compiler for packet filters ARM: 7334/1: add jump label support ARM: 7333/2: jump label: detect %c support for ARM ARM: 7338/1: add support for early console output via semihosting ARM: use set_current_blocked() and block_sigmask() ARM: exec: remove redundant set_fs(USER_DS) ARM: 7332/1: extract out code patch function from kprobes ARM: 7331/1: extract out insn generation code from ftrace ARM: 7330/1: ftrace: use canonical Thumb-2 wide instruction format ARM: 7351/1: ftrace: remove useless memory checks ARM: 7316/1: kexec: EOI active and mask all interrupts in kexec crash path ARM: Versatile Express: add NO_IOPORT ARM: get rid of asm/irq.h in asm/prom.h ARM: 7319/1: Print debug info for SIGBUS in user faults ARM: 7318/1: gic: refactor irq_start assignment ARM: 7317/1: irq: avoid NULL check in for_each_irq_desc loop ARM: 7315/1: perf: add support for the Cortex-A7 PMU ...
2012-03-28Disintegrate asm/system.h for ARMDavid Howells1-1/+1
Disintegrate asm/system.h for ARM. Signed-off-by: David Howells <[email protected]> cc: Russell King <[email protected]> cc: [email protected]
2012-03-24ARM: 7316/1: kexec: EOI active and mask all interrupts in kexec crash pathWill Deacon1-0/+25
The kexec machine crash code can be called in interrupt context via a sysrq trigger made using the magic key combination. If the irq chip dealing with the serial interrupt is using the fasteoi flow handler, then we will never EOI the interrupt because the interrupt handler will be fatal. In the case of a GIC, this results in the crash kernel not receiving interrupts on that CPU interface. This patch adds code (based on the PowerPC implementation) to EOI any pending interrupts on the crash CPU before masking and disabling all interrupts. Secondary cores are not a problem since they are placed into a cpu_relax() loop via an IPI. Reported-by: Lei Wen <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Russell King <[email protected]>
2011-12-12ARM: kexec: use soft_restart for branching to the reboot bufferWill Deacon1-12/+3
Now that there is a common way to reset the machine, let's use it instead of reinventing the wheel in the kexec backend. Signed-off-by: Will Deacon <[email protected]>
2011-12-05Merge branch 'for-rmk' of ↵Russell King1-18/+17
git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into devel-stable Conflicts: arch/arm/common/gic.c arch/arm/plat-omap/include/plat/common.h
2011-11-10ARM: restart: remove argument to setup_mm_for_reboot()Russell King1-2/+2
setup_mm_for_reboot() doesn't make use of its argument, so remove it. Acked-by: Nicolas Pitre <[email protected]> Acked-by: Will Deacon <[email protected]> Acked-by: H Hartley Sweeten <[email protected]> Acked-by: Tony Lindgren <[email protected]> Signed-off-by: Russell King <[email protected]>
2011-11-07Revert "ARM: 7098/1: kdump: copy kernel relocation code at the kexec prepare ↵Russell King1-18/+17
stage" This reverts commit 2b034922af2caa19df86f0c502e76cb6f6e910f9. Will Deacon reports: This is causing kexec to fail. The symptoms are that the .init.text section is not loaded as part of the new kernel image, so when we try to do the SMP/UP fixups we hit a whole sea of poison left there by the previous kernel. So my guess is that machine_kexec_prepare *is* too early for preparing the reboot_code_buffer and, unless anybody has a good reason not to, I'd like to revert the patch causing these problems. Reported-by: Will Deacon <[email protected]>
2011-10-17ARM: 7098/1: kdump: copy kernel relocation code at the kexec prepare stageLei Wen1-17/+18
This copy really don't need to do at the very second before the kernel would crash. Signed-off-by: Lei Wen <[email protected]> Acked-by: Simon Horman <[email protected]> Signed-off-by: Russell King <[email protected]>
2011-03-03[ARM] add machine-specific hook to machine_kexecEric Cooper1-0/+7
Provide the option to call a machine-specific function before kexec'ing a new kernel. Signed-off-by: Eric Cooper <[email protected]> Signed-off-by: Nicolas Pitre <[email protected]>
2010-12-04ARM: 6522/1: kexec: Add call to non-crashing cores through IPIPer Fransson1-0/+30
When kexec is used to start a crash kernel the other cores are notified. These non-crashing cores will save their state in the crash notes and then do nothing. Signed-off-by: Per Fransson <[email protected]> Signed-off-by: Russell King <[email protected]>
2010-10-26arm: Disable outer (L2) cache in kexecThomas Gleixner1-0/+3
kexec does not disable the outer cache before disabling the inner caches in cpu_proc_fin(). So L2 is enabled across the kexec jump. When the new kernel enables chaches again, it randomly crashes. Disabling L2 before calling cpu_proc_fin() cures the problem. Disabling L2 requires the following new functions: flush_all(), inv_all() and disable(). Add them to outer_cache_fns and call them from the kexec code. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Catalin Marinas <[email protected]> Acked-by: Linus Walleij <[email protected]>
2010-07-31Merge branch 'misc' into develRussell King1-5/+5
Conflicts: arch/arm/mm/init.c
2010-07-27ARM: call machine_shutdown() from machine_halt(), etcRussell King1-4/+0
x86 calls machine_shutdown() from the various machine_*() calls which take the machine down ready for halting, restarting, etc, and uses this to bring the system safely to a point where those actions can be performed. Such actions are stopping the secondary CPUs. So, change the ARM implementation of these to reflect what x86 does. This solves kexec problems on ARM SMP platforms, where the secondary CPUs were left running across the kexec call. Signed-off-by: Russell King <[email protected]>
2010-07-27ARM: Factor out common code from cpu_proc_fin()Russell King1-1/+5
All implementations of cpu_proc_fin() start by disabling interrupts and then flush caches. Rather than have every processors proc_fin() implementation do this, move it out into generic code - and move the cache flush past setup_mm_for_reboot() (so it can benefit from having caches still enabled.) This allows cpu_proc_fin() to become independent of the L1/L2 cache types, and eventually move the L2 cache flushing into the L2 support code. Signed-off-by: Russell King <[email protected]>
2010-07-09ARM: 6118/1: kdump: implement machine_crash_shutdown()Mika Westerberg1-0/+4
Implement function machine_crash_shutdown() which disables IRQs and saves machine state to ELF notes structure. Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Russell King <[email protected]>
2009-02-10[ARM] Storage class should be before const qualifierTobias Klauser1-2/+2
The C99 specification states in section 6.11.5: The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature. Signed-off-by: Tobias Klauser <[email protected]> Signed-off-by: Russell King <[email protected]>
2008-09-06[ARM] Convert asm/io.h to linux/io.hRussell King1-1/+1
Signed-off-by: Russell King <[email protected]>
2008-08-15kexec jump: rename KEXEC_CONTROL_CODE_SIZE to KEXEC_CONTROL_PAGE_SIZEHuang Ying1-1/+1
Rename KEXEC_CONTROL_CODE_SIZE to KEXEC_CONTROL_PAGE_SIZE, because control page is used for not only code on some platform. For example in kexec jump, it is used for data and stack too. [[email protected]: unbreak powerpc and arm, finish conversion] Signed-off-by: Huang Ying <[email protected]> Cc: Pavel Machek <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Russell King <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-02-04[ARM] 4736/1: Export atags to userspace and allow kexec to use customised atagsRichard Purdie1-0/+2
Currently, the atags used by kexec are fixed to the ones originally used to boot the kernel. This is less than ideal as changing the commandline, initrd and other options would be a useful feature. This patch exports the atags used for the current kernel to userspace through an "atags" file in procfs. The presence of the file is controlled by its own Kconfig option and cleans up several ifdef blocks into a separate file. The tags for the new kernel are assumed to be at a fixed location before the kernel image itself. The location of the tags used to boot the original kernel is unimportant and no longer saved. Based on a patch from Uli Luckas <[email protected]> Signed-off-by: Richard Purdie <[email protected]> Acked-by: Uli Luckas <[email protected]> Signed-off-by: Russell King <[email protected]>
2007-02-16[ARM] 4137/1: Add kexec supportRichard Purdie1-0/+78
Add kexec support to ARM. Improvements like commandline handling could be made but this patch gives basic functional support. It uses the next available syscall number, 347. Once the syscall number is known, userspace support will be finalised/submitted to kexec-tools, various patches already exist. Originally based on a patch by Maxim Syrchin but updated and forward ported by various people. Signed-off-by: Richard Purdie <[email protected]> Signed-off-by: Russell King <[email protected]>