]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/hyperv: Add VTL mode callback for restarting the system
authorRoman Kisel <romank@linux.microsoft.com>
Thu, 27 Feb 2025 21:47:28 +0000 (13:47 -0800)
committerWei Liu <wei.liu@kernel.org>
Thu, 20 Mar 2025 21:23:03 +0000 (21:23 +0000)
The kernel runs as a firmware in the VTL mode, and the only way
to restart in the VTL mode on x86 is to triple fault. Thus, one
has to always supply "reboot=t" on the kernel command line in the
VTL mode, 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.

Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
Link: https://lore.kernel.org/r/20250227214728.15672-3-romank@linux.microsoft.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20250227214728.15672-3-romank@linux.microsoft.com>

arch/x86/hyperv/hv_vtl.c

index 4421b75ad9a911012bd7491e503b787e06cd3300..582fe820e29c276e18af21b3a260ac275dd875ba 100644 (file)
@@ -44,6 +44,15 @@ static void  __noreturn hv_vtl_emergency_restart(void)
        }
 }
 
+/*
+ * The only way to restart in the VTL mode is to triple fault as the kernel runs
+ * as firmware.
+ */
+static void  __noreturn hv_vtl_restart(char __maybe_unused *cmd)
+{
+       hv_vtl_emergency_restart();
+}
+
 void __init hv_vtl_init_platform(void)
 {
        pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
@@ -258,6 +267,8 @@ static int hv_vtl_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip)
 int __init hv_vtl_early_init(void)
 {
        machine_ops.emergency_restart = hv_vtl_emergency_restart;
+       machine_ops.restart = hv_vtl_restart;
+
        /*
         * `boot_cpu_has` returns the runtime feature support,
         * and here is the earliest it can be used.