x86/reboot: Enable restart_handler mechanism
PATCH 1/1 x86/reboot: Enable restart_handler mechanism
Drivers may want to register restart_handlers for case where an external reset is needed to reset a complete system and not only the processor. This case is currently missing in x86 architecture.
So include call to do_kernel_restart() to use handlers registered through register_restart_handler() API when the processor restarts.
do_kernel_restart() cannot be called in machine_restart() as required by documentation as final step, because it will never be reached (restart having already been carried out). So call is done inside native_machine_restart(), and only here to not let drivers managed reset in hypervisor case where function native_machine_restart() is overridden.
--- arch/x86/kernel/reboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/reboot.c +2 -1
@@ -718,12 +718,13 @@ static void __machine_emergency_restart(int emergency) machine_ops.emergency_restart (); } -static void native_machine_restart (char *__unused) +static void native_machine_restart (char *cmd) {pr_notice ("machine restart\n" );if (!reboot_force)machine_shutdown (); +do_kernel_restart (cmd);__machine_emergency_restart (0 ); }
Signature · 1 line
2.21.0
Hi,
Gentle reminder.
Thanks.
Benjamin
Quoted 39 lines · Benjamin Bouvier
Drivers may want to register
restart_handlersfor case where an external reset is needed to reset a complete system and not only the processor. This case is currently missing in x86 architecture.
So include call todo_kernel_restart()to use handlers registered throughregister_restart_handler()API when the processor restarts.
do_kernel_restart()cannot be called inmachine_restart()as required by documentation as final step, because it will never be reached (restart having already been carried out). So call is done insidenative_machine_restart(), and only here to not let drivers managed reset in hypervisor case where functionnative_machine_restart()is overridden.Co-developed-by Patrick Lelu <[email protected]>Signed-off-by Patrick Lelu <[email protected]>Signed-off-by Benjamin Bouvier <[email protected]>--- arch/x86/kernel/reboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/x86/kernel/reboot.c +2
-1@@ -718,12 +718,13 @@ static void __machine_emergency_restart(int emergency) machine_ops.emergency_restart (); } -static void native_machine_restart (char *__unused) +static void native_machine_restart (char *cmd) {pr_notice ("machine restart\n" );if (!reboot_force)machine_shutdown (); +do_kernel_restart (cmd);__machine_emergency_restart (0 ); }