Skip to content

Commit 227b660

Browse files
Yunhong Jiangallenpais
authored andcommitted
x86/hyperv/vtl: Setup the 64-bit trampoline for TDX guests
The hypervisor is an untrusted entity for TDX guests. It cannot be used to boot secondary CPUs - neither via hypercalls not the INIT assert, de-assert plus Start-Up IPI messages. Instead, the platform virtual firmware boots the secondary CPUs and puts them in a state to transfer control to the kernel. This mechanism uses the wakeup mailbox described in the Multiprocessor Wakeup Structure of the ACPI specification. The entry point to the kernel is trampoline_start64. Allocate and setup the trampoline using the default x86_platform callbacks. The platform firmware configures the secondary CPUs in long mode. It is no longer necessary to locate the trampoline under 1MB memory. After handoff from firmware, the trampoline code switches briefly to 32-bit addressing mode, which has an addressing limit of 4GB. Set the upper bound of the trampoline memory accordingly. Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Yunhong Jiang <[email protected]> Signed-off-by: Ricardo Neri <[email protected]>
1 parent 2d03cfa commit 227b660

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

arch/x86/hyperv/hv_vtl.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@ void __init hv_vtl_init_platform(void)
3939
{
4040
pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
4141

42+
/* There is no paravisor present if we are here. */
43+
if (hv_isolation_type_tdx()) {
44+
x86_init.resources.realmode_limit = SZ_4G;
45+
} else {
46+
x86_platform.realmode_reserve = x86_init_noop;
47+
x86_platform.realmode_init = x86_init_noop;
48+
real_mode_header = &hv_vtl_real_mode_header;
49+
}
50+
4251
x86_init.resources.probe_roms = x86_init_noop;
43-
x86_platform.realmode_reserve = x86_init_noop;
44-
x86_platform.realmode_init = x86_init_noop;
45-
real_mode_header = &hv_vtl_real_mode_header;
4652
x86_init.irqs.pre_vector_init = x86_init_noop;
4753
x86_init.timers.timer_init = x86_init_noop;
4854

0 commit comments

Comments
 (0)