Skip to content

Commit 1aefefb

Browse files
committed
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 <[email protected]>
1 parent 0cf6361 commit 1aefefb

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
@@ -69,6 +69,15 @@ static void __noreturn hv_vtl_emergency_restart(void)
6969
}
7070
}
7171

72+
/*
73+
* The only way to restart in the VTL mode is to triple fault as the kernel runs
74+
* as firmware.
75+
*/
76+
static void __noreturn hv_vtl_restart(char __maybe_unused *cmd)
77+
{
78+
hv_vtl_emergency_restart();
79+
}
80+
7281
void __init hv_vtl_init_platform(void)
7382
{
7483
pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
@@ -254,6 +263,8 @@ static int hv_vtl_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip, unsi
254263
int __init hv_vtl_early_init(void)
255264
{
256265
machine_ops.emergency_restart = hv_vtl_emergency_restart;
266+
machine_ops.restart = hv_vtl_restart;
267+
257268
/*
258269
* `boot_cpu_has` returns the runtime feature support,
259270
* and here is the earliest it can be used.

0 commit comments

Comments
 (0)