Lines Matching +full:reboot +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/kernel/reboot.c
8 #define pr_fmt(fmt) "reboot: " fmt
16 #include <linux/reboot.h>
23 * this indicates whether you can reboot with ctrl-alt-del: the default is yes
40 * reboot_type is still set to its default value (i.e., reboot= hasn't
42 * suppress DMI scanning for reboot quirks. Without it, it's
43 * impossible to override a faulty reboot quirk without recompiling.
58 * emergency_restart - reboot the system
61 * reboot the system. This is called when we know we are in
62 * trouble so this is our best effort to reboot. This is
81 * register_reboot_notifier - Register function to be called at reboot time
85 * to be called at reboot time.
97 * unregister_reboot_notifier - Unregister previously registered reboot notifier
100 * Unregisters a previously registered reboot
103 * Returns zero on success, or %-ENOENT on failure.
124 return -ENOMEM; in devm_register_reboot_notifier()
145 * register_restart_handler - Register function to be called to reset
148 * @nb->priority: Handler priority. Handlers should follow the
164 * machine_restart function calls do_kernel_restart - see below
170 * Restart handlers are expected to be registered from non-architecture
189 * unregister_restart_handler - Unregister previously registered
195 * Returns zero on success, or %-ENOENT on failure.
204 * do_kernel_restart - Execute kernel restart handler call chain
226 /* Make certain the cpu I'm about to reboot on is online */ in migrate_to_reboot_cpu()
231 current->flags |= PF_NO_SETAFFINITY; in migrate_to_reboot_cpu()
238 * kernel_restart - reboot the system
242 * Shutdown everything and perform a clean reboot.
268 * kernel_halt - halt the system
284 * kernel_power_off - power_off the system
304 * Reboot system call: for obvious reasons only root may call it,
306 * so that some mistake won't make this reboot the whole machine.
307 * You can also set the meaning of the ctrl-alt-del-key here.
309 * reboot doesn't sync: do that yourself before calling this.
311 SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, in SYSCALL_DEFINE4() argument
319 if (!ns_capable(pid_ns->user_ns, CAP_SYS_BOOT)) in SYSCALL_DEFINE4()
320 return -EPERM; in SYSCALL_DEFINE4()
328 return -EINVAL; in SYSCALL_DEFINE4()
370 ret = strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1); in SYSCALL_DEFINE4()
372 ret = -EFAULT; in SYSCALL_DEFINE4()
375 buffer[sizeof(buffer) - 1] = '\0'; in SYSCALL_DEFINE4()
393 ret = -EINVAL; in SYSCALL_DEFINE4()
406 * This function gets called by ctrl-alt-del - ie the keyboard interrupt.
408 * is whether to reboot at once, or just ignore the ctrl-alt-del.
421 static const char reboot_cmd[] = "/sbin/reboot";
437 ret = -ENOMEM; in run_cmd()
450 pr_warn("Failed to start orderly reboot: forcing the issue\n"); in __orderly_reboot()
489 * orderly_poweroff - Trigger an orderly system poweroff
511 * orderly_reboot - Trigger an orderly system reboot
513 * This may be called from any context to trigger a system reboot.
514 * If the orderly reboot fails, it will force an immediate reboot.
523 * hw_failure_emergency_poweroff_func - emergency poweroff work after a known delay
539 pr_emerg("Hardware protection timed-out. Trying forced poweroff\n"); in hw_failure_emergency_poweroff_func()
553 * hw_failure_emergency_poweroff - Trigger an emergency system poweroff
567 * hw_protection_shutdown - Trigger an emergency system poweroff
603 enum reboot_mode *mode; in reboot_setup() local
607 * reboot= will cause us to disable DMI checking in reboot_setup()
613 mode = &panic_reboot_mode; in reboot_setup()
616 mode = &reboot_mode; in reboot_setup()
621 *mode = REBOOT_WARM; in reboot_setup()
625 *mode = REBOOT_COLD; in reboot_setup()
629 *mode = REBOOT_HARD; in reboot_setup()
643 pr_err("Ignoring the CPU number in reboot= option. " in reboot_setup()
650 *mode = REBOOT_SOFT; in reboot_setup()
654 *mode = REBOOT_GPIO; in reboot_setup()
679 __setup("reboot=", reboot_setup);
727 return -EPERM; in mode_store()
740 return -EINVAL; in mode_store()
746 static struct kobj_attribute reboot_mode_attr = __ATTR_RW(mode);
759 return -EPERM; in force_store()
762 return -EINVAL; in force_store()
804 return -EPERM; in type_store()
819 return -EINVAL; in type_store()
840 return -EPERM; in cpu_store()
848 return -ERANGE; in cpu_store()
879 reboot_kobj = kobject_create_and_add("reboot", kernel_kobj); in reboot_ksysfs_init()
881 return -ENOMEM; in reboot_ksysfs_init()