Skip to content

Commit e956ee9

Browse files
romank-msftliuw
authored andcommitted
arm64, x86: hyperv: Report the VTL the system boots in
The hyperv guest code might run in various Virtual Trust Levels. Report the level when the kernel boots in the non-default (0) one. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Link: https://lore.kernel.org/r/20250428210742.435282-7-romank@linux.microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org> Message-ID: <20250428210742.435282-7-romank@linux.microsoft.com>
1 parent 1f5538a commit e956ee9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

arch/arm64/hyperv/mshyperv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ static int __init hyperv_init(void)
118118
if (ms_hyperv.priv_high & HV_ACCESS_PARTITION_ID)
119119
hv_get_partition_id();
120120
ms_hyperv.vtl = get_vtl();
121+
if (ms_hyperv.vtl > 0) /* non default VTL */
122+
pr_info("Linux runs in Hyper-V Virtual Trust Level %d\n", ms_hyperv.vtl);
121123

122124
ms_hyperv_late_init();
123125

arch/x86/hyperv/hv_vtl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ static void __noreturn hv_vtl_restart(char __maybe_unused *cmd)
5555

5656
void __init hv_vtl_init_platform(void)
5757
{
58-
pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
58+
/*
59+
* This function is a no-op if the VTL mode is not enabled.
60+
* If it is, this function runs if and only the kernel boots in
61+
* VTL2 which the x86 hv initialization path makes sure of.
62+
*/
63+
pr_info("Linux runs in Hyper-V Virtual Trust Level %d\n", ms_hyperv.vtl);
5964

6065
x86_platform.realmode_reserve = x86_init_noop;
6166
x86_platform.realmode_init = x86_init_noop;

0 commit comments

Comments
 (0)