aboutsummaryrefslogtreecommitdiff
path: root/kernel/reboot.c
AgeCommit message (Collapse)AuthorFilesLines
2018-09-11kernel/reboot.c: export pm_power_off_prepareOleksij Rempel1-0/+1
Export pm_power_off_prepare. It is needed to implement power off on Freescale/NXP iMX6 based boards with external power management integrated circuit (PMIC). Signed-off-by: Oleksij Rempel <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2018-08-06PM / reboot: Eliminate race between reboot and suspendPingfan Liu1-3/+3
At present, "systemctl suspend" and "shutdown" can run in parrallel. A system can suspend after devices_shutdown(), and resume. Then the shutdown task goes on to power off. This causes many devices are not really shut off. Hence replacing reboot_mutex with system_transition_mutex (renamed from pm_mutex) to achieve the exclusion. The renaming of pm_mutex as system_transition_mutex can be better to reflect the purpose of the mutex. Signed-off-by: Pingfan Liu <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2017-11-17kernel/reboot.c: add devm_register_reboot_notifier()Andrey Smirnov1-0/+27
Add devm_* wrapper around register_reboot_notifier to simplify device specific reboot notifier registration/unregistration. [[email protected]: move `struct device' forward decl to top-of-file] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Andrey Smirnov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2015-09-10kexec: split kexec_load syscall from kexec core codeDave Young1-1/+1
There are two kexec load syscalls, kexec_load another and kexec_file_load. kexec_file_load has been splited as kernel/kexec_file.c. In this patch I split kexec_load syscall code to kernel/kexec.c. And add a new kconfig option KEXEC_CORE, so we can disable kexec_load and use kexec_file_load only, or vice verse. The original requirement is from Ted Ts'o, he want kexec kernel signature being checked with CONFIG_KEXEC_VERIFY_SIG enabled. But kexec-tools use kexec_load syscall can bypass the checking. Vivek Goyal proposed to create a common kconfig option so user can compile in only one syscall for loading kexec kernel. KEXEC/KEXEC_FILE selects KEXEC_CORE so that old config files still work. Because there's general code need CONFIG_KEXEC_CORE, so I updated all the architecture Kconfig with a new option KEXEC_CORE, and let KEXEC selects KEXEC_CORE in arch Kconfig. Also updated general kernel code with to kexec_load syscall. [[email protected]: coding-style fixes] Signed-off-by: Dave Young <[email protected]> Cc: Eric W. Biederman <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Petr Tesarik <[email protected]> Cc: Theodore Ts'o <[email protected]> Cc: Josh Boyer <[email protected]> Cc: David Howells <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2015-04-15kernel/reboot.c: add orderly_reboot for graceful rebootJoel Stanley1-5/+48
The kernel has orderly_poweroff which allows the kernel to initiate a graceful shutdown of userspace, by running /sbin/poweroff. This adds orderly_reboot that will cause userspace to shut itself down by calling /sbin/reboot. This will be used for shutdown initiated by a system controller on platforms that do not use ACPI. orderly_reboot() should be used when the system wants to allow userspace to gracefully shut itself down. For cases where the system may imminently catch on fire, the existing emergency_restart() provides an immediate reboot without involving userspace. Signed-off-by: Joel Stanley <[email protected]> Cc: Fabian Frederick <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Jeremy Kerr <[email protected]> Cc: David S. Miller <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-09-26kernel: add support for kernel restart handler call chainGuenter Roeck1-0/+81
Various drivers implement architecture and/or device specific means to restart (reset) the system. Various mechanisms have been implemented to support those schemes. The best known mechanism is arm_pm_restart, which is a function pointer to be set either from platform specific code or from drivers. Another mechanism is to use hardware watchdogs to issue a reset; this mechanism is used if there is no other method available to reset a board or system. Two examples are alim7101_wdt, which currently uses the reboot notifier to trigger a reset, and moxart_wdt, which registers the arm_pm_restart function. The existing mechanisms have a number of drawbacks. Typically only one scheme to restart the system is supported (at least if arm_pm_restart is used). At least in theory there can be multiple means to restart the system, some of which may be less desirable (for example one mechanism may only reset the CPU, while another may reset the entire system). Using arm_pm_restart can also be racy if the function pointer is set from a driver, as the driver may be in the process of being unloaded when arm_pm_restart is called. Using the reboot notifier is always racy, as it is unknown if and when other functions using the reboot notifier have completed execution by the time the watchdog fires. Introduce a system restart handler call chain to solve the described problems. This call chain is expected to be executed from the architecture specific machine_restart() function. Drivers providing system restart functionality (such as the watchdog drivers mentioned above) are expected to register with this call chain. By using the priority field in the notifier block, callers can control restart handler execution sequence and thus ensure that the restart handler with the optimal restart capabilities for a given system is called first. Signed-off-by: Guenter Roeck <[email protected]> Acked-by: Catalin Marinas <[email protected]> Acked-by: Heiko Stuebner <[email protected]> Cc: Russell King <[email protected]> Cc: Wim Van Sebroeck <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Will Deacon <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Jonas Jensen <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Dmitry Eremin-Solenikov <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Tomasz Figa <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
2014-06-04kernel/reboot.c: convert simple_strtoul to kstrtointFabian Frederick1-7/+14
Replace obsolete function. kstrtoint is used as reboot_cpu is an integer. Signed-off-by: Fabian Frederick <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-12-18kexec: migrate to reboot cpuVivek Goyal1-1/+1
Commit 1b3a5d02ee07 ("reboot: move arch/x86 reboot= handling to generic kernel") moved reboot= handling to generic code. In the process it also removed the code in native_machine_shutdown() which are moving reboot process to reboot_cpu/cpu0. I guess that thought must have been that all reboot paths are calling migrate_to_reboot_cpu(), so we don't need this special handling. But kexec reboot path (kernel_kexec()) is not calling migrate_to_reboot_cpu() so above change broke kexec. Now reboot can happen on non-boot cpu and when INIT is sent in second kerneo to bring up BP, it brings down the machine. So start calling migrate_to_reboot_cpu() in kexec reboot path to avoid this problem. Bisected by WANG Chao. Reported-by: Matthew Whitehead <[email protected]> Reported-by: Dave Young <[email protected]> Signed-off-by: Vivek Goyal <[email protected]> Tested-by: Baoquan He <[email protected]> Tested-by: WANG Chao <[email protected]> Acked-by: H. Peter Anvin <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-09-24kernel/reboot.c: re-enable the function of variable reboot_defaultChuansheng Liu1-1/+8
Commit 1b3a5d02ee07 ("reboot: move arch/x86 reboot= handling to generic kernel") did some cleanup for reboot= command line, but it made the reboot_default inoperative. The default value of variable reboot_default should be 1, and if command line reboot= is not set, system will use the default reboot mode. [[email protected]: fix comment layout] Signed-off-by: Li Fei <[email protected]> Signed-off-by: liu chuansheng <[email protected]> Acked-by: Robin Holt <[email protected]> Cc: <[email protected]> [3.11.x] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-07-09reboot: move arch/x86 reboot= handling to generic kernelRobin Holt1-1/+75
Merge together the unicore32, arm, and x86 reboot= command line parameter handling. Signed-off-by: Robin Holt <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Russell King <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Russ Anderson <[email protected]> Cc: Robin Holt <[email protected]> Acked-by: Ingo Molnar <[email protected]> Acked-by: Guan Xuetao <[email protected]> Acked-by: Russell King <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-07-09reboot: checkpatch.pl the new kernel/reboot.c fileRobin Holt1-14/+13
Get the new file to pass scripts/checkpatch.pl Signed-off-by: Robin Holt <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Russ Anderson <[email protected]> Cc: Robin Holt <[email protected]> Cc: Russell King <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-07-09reboot: move shutdown/reboot related functions to kernel/reboot.cRobin Holt1-0/+346
This patch is preparatory. It moves reboot related syscall, etc functions from kernel/sys.c to kernel/reboot.c. Signed-off-by: Robin Holt <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Russ Anderson <[email protected]> Cc: Robin Holt <[email protected]> Cc: Russell King <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>