The kernel runs as a firmware in the VTL mode, and the only way
to restart on x86 is to triple fault. Thus, one has to always
supply "reboot=t" on the kernel command line, and missing that
renders rebooting not working.

Define the machine restart callback to always use the triple
fault to provide the robust configuration by default.

Cc: sta...@vger.kernel.org
Signed-off-by: Roman Kisel <rom...@linux.microsoft.com>
---
 arch/x86/hyperv/hv_vtl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c
index 8931fc186a5f..eb402362d738 100644
--- a/arch/x86/hyperv/hv_vtl.c
+++ b/arch/x86/hyperv/hv_vtl.c
@@ -44,6 +44,12 @@ static void  __noreturn hv_vtl_emergency_restart(void)
        }
 }
 
+/* The only way to restart is triple fault */
+static void  __noreturn hv_vtl_restart(char *)
+{
+       hv_vtl_emergency_restart();
+}
+
 void __init hv_vtl_init_platform(void)
 {
        pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
@@ -269,6 +275,7 @@ int __init hv_vtl_early_init(void)
        apic_update_callback(wakeup_secondary_cpu_64, 
hv_vtl_wakeup_secondary_cpu);
 
        machine_ops.emergency_restart = hv_vtl_emergency_restart;
+       machine_ops.restart = hv_vtl_restart;
 
        return 0;
 }
-- 
2.34.1


Reply via email to