linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Bouvier <benjamin.bouvier@nokia.com>
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de
Cc: hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org,
	Benjamin Bouvier <benjamin.bouvier@nokia.com>,
	Patrick Lelu <patrick.lelu@nokia.com>
Subject: [PATCH] x86/reboot: Enable restart_handler mechanism
Date: Fri, 17 Jan 2020 15:45:35 +0200	[thread overview]
Message-ID: <20200117134535.7224-1-benjamin.bouvier@nokia.com> (raw)

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.

Co-developed-by: Patrick Lelu <patrick.lelu@nokia.com>
Signed-off-by: Patrick Lelu <patrick.lelu@nokia.com>
Signed-off-by: Benjamin Bouvier <benjamin.bouvier@nokia.com>
---
 arch/x86/kernel/reboot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 0cc7c0b106bb..53c3d5a3f89d 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -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);
 }
 
-- 
2.21.0


             reply	other threads:[~2020-01-17 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17 13:45 Benjamin Bouvier [this message]
2020-02-14 14:09 ` [PATCH] x86/reboot: Enable restart_handler mechanism Bouvier, Benjamin (Nokia - FR/Lannion)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200117134535.7224-1-benjamin.bouvier@nokia.com \
    --to=benjamin.bouvier@nokia.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=patrick.lelu@nokia.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).