diff options
author | Per Fransson <per.xx.fransson@stericsson.com> | 2011-09-23 14:11:24 +0200 |
---|---|---|
committer | Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | 2011-10-03 06:49:44 +0200 |
commit | 160cebfb0d9fcaa4fc9b5ee615a4923990072fca (patch) | |
tree | e302b9542e6c228e613d32ee0ccb170590192736 | |
parent | 920346c71e3def3760ad1b9d1ff2078b9d44a442 (diff) |
ux500: Start crash dump through SW reset
When using kexec/kdump without an crash kernel image loaded:
* clean the caches and write the crash_notes
* perform a restart
ST-Ericsson ID: 340331
Change-Id: I1ae34ed2b5e43da4849650a8a7d2f1e453dcbe93
Signed-off-by: Per Fransson <per.xx.fransson@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32678
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r-- | arch/arm/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/kernel/machine_kexec.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-ux500/reboot_reasons.c | 12 | ||||
-rw-r--r-- | include/linux/kexec.h | 1 | ||||
-rw-r--r-- | kernel/kexec.c | 10 |
5 files changed, 36 insertions, 4 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d40d2599269..3b1c685136f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1859,6 +1859,13 @@ config KEXEC initially work for you. It may help to enable device hotplugging support. +config CRASH_SWRESET + bool "Perform a software reset at a panic (EXPERIMENTAL)" + depends on EXPERIMENTAL + depends on KEXEC + help + If no crash kernel has been loaded, perform a SW reset as plan B. + config ATAGS_PROC bool "Export atags in procfs" depends on KEXEC diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index ae1d73a15d3..2a9c3430115 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c @@ -123,3 +123,13 @@ void machine_kexec(struct kimage *image) flush_cache_all(); cpu_reset(reboot_code_buffer_phys); } + +void machine_crash_swreset(void) +{ + printk(KERN_INFO "Software reset on panic!\n"); + + flush_cache_all(); + outer_flush_all(); + outer_disable(); + arm_pm_restart(0, NULL); +} diff --git a/arch/arm/mach-ux500/reboot_reasons.c b/arch/arm/mach-ux500/reboot_reasons.c index c78a11c21ea..93afab59537 100644 --- a/arch/arm/mach-ux500/reboot_reasons.c +++ b/arch/arm/mach-ux500/reboot_reasons.c @@ -35,9 +35,15 @@ u16 reboot_reason_code(const char *cmd) { int i; - if (cmd == NULL) - /* normal reboot w/o argument */ - return SW_RESET_NO_ARGUMENT; + if (cmd == NULL) { + if (oops_in_progress) { + /* if we're in an oops assume it's a crash */ + return SW_RESET_CRASH; + } else { + /* normal reboot w/o argument */ + return SW_RESET_NO_ARGUMENT; + } + } /* Search through reboot reason list */ for (i = 0; i < reboot_reasons_size; i++) { diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 76b4db78ec1..f36d95a8223 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -110,6 +110,7 @@ struct kimage { /* kexec interface functions */ extern void machine_kexec(struct kimage *image); +extern void machine_crash_swreset(void); extern int machine_kexec_prepare(struct kimage *image); extern void machine_kexec_cleanup(struct kimage *image); extern asmlinkage long sys_kexec_load(unsigned long entry, diff --git a/kernel/kexec.c b/kernel/kexec.c index cf5f9ad2b91..e3ae2e75e78 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -1069,6 +1069,7 @@ asmlinkage long compat_sys_kexec_load(unsigned long entry, void crash_kexec(struct pt_regs *regs) { + struct pt_regs fixed_regs; /* Take the kexec_mutex here to prevent sys_kexec_load * running on one cpu from replacing the crash kernel * we are using after a panic on a different cpu. @@ -1079,7 +1080,6 @@ void crash_kexec(struct pt_regs *regs) */ if (mutex_trylock(&kexec_mutex)) { if (kexec_crash_image) { - struct pt_regs fixed_regs; kmsg_dump(KMSG_DUMP_KEXEC); @@ -1088,6 +1088,14 @@ void crash_kexec(struct pt_regs *regs) machine_crash_shutdown(&fixed_regs); machine_kexec(kexec_crash_image); } +#ifdef CONFIG_CRASH_SWRESET + else { + crash_setup_regs(&fixed_regs, regs); + crash_save_vmcoreinfo(); + machine_crash_shutdown(&fixed_regs); + machine_crash_swreset(); + } +#endif mutex_unlock(&kexec_mutex); } } |