[PATCH v2 7/9] x86/hyperv: Move setting the real_mode_header to hv_vtl_init_platform

From: Yunhong Jiang
Date: Fri Aug 23 2024 - 19:25:30 EST


For the VTL2 hyperv guest, currently the hv_vtl_init_platform() clears
x86_platform.realmode_reserve/init while the hv_vtl_early_init() sets the
real_mode_header.

Set the real_mode_header together with x86_platform.realmode_reserve/init
in hv_vtl_init_platform(). This is ok because x86_platform.realmode_init()
is invoked from an early initcall while hv_vtl_init_platform() is called
during early boot.

Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/lkml/87a5ho2q6x.ffs@tglx/
Signed-off-by: Yunhong Jiang <yunhong.jiang@xxxxxxxxxxxxxxx>
---
arch/x86/hyperv/hv_vtl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c
index 987a6a1200b0..e5aa2688cdd0 100644
--- a/arch/x86/hyperv/hv_vtl.c
+++ b/arch/x86/hyperv/hv_vtl.c
@@ -44,6 +44,7 @@ void __init hv_vtl_init_platform(void)
x86_platform.hyper.is_private_mmio = hv_is_private_mmio_tdx;
x86_platform.realmode_reserve = x86_init_noop;
x86_platform.realmode_init = x86_init_noop;
+ real_mode_header = &hv_vtl_real_mode_header;
x86_init.irqs.pre_vector_init = x86_init_noop;
x86_init.timers.timer_init = x86_init_noop;

@@ -259,7 +260,6 @@ int __init hv_vtl_early_init(void)
panic("XSAVE has to be disabled as it is not supported by this module.\n"
"Please add 'noxsave' to the kernel command line.\n");

- real_mode_header = &hv_vtl_real_mode_header;
apic_update_callback(wakeup_secondary_cpu_64, hv_vtl_wakeup_secondary_cpu);

return 0;
--
2.25.1