Skip to content

Commit 07b7419

Browse files
romank-msftliuw
authored andcommitted
x86/hyperv: Add VTL mode callback for restarting the system
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>
1 parent ced518a commit 07b7419

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/x86/hyperv/hv_vtl.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ static void __noreturn hv_vtl_emergency_restart(void)
4444
}
4545
}
4646

47+
/*
48+
* The only way to restart in the VTL mode is to triple fault as the kernel runs
49+
* as firmware.
50+
*/
51+
static void __noreturn hv_vtl_restart(char __maybe_unused *cmd)
52+
{
53+
hv_vtl_emergency_restart();
54+
}
55+
4756
void __init hv_vtl_init_platform(void)
4857
{
4958
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)
258267
int __init hv_vtl_early_init(void)
259268
{
260269
machine_ops.emergency_restart = hv_vtl_emergency_restart;
270+
machine_ops.restart = hv_vtl_restart;
271+
261272
/*
262273
* `boot_cpu_has` returns the runtime feature support,
263274
* and here is the earliest it can be used.

0 commit comments

Comments
 (0)