[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SN6PR02MB415729A098EF2346C912873AD4BC2@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Thu, 17 Apr 2025 15:28:14 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Roman Kisel <romank@...ux.microsoft.com>, "arnd@...db.de" <arnd@...db.de>,
"bhelgaas@...gle.com" <bhelgaas@...gle.com>, "bp@...en8.de" <bp@...en8.de>,
"catalin.marinas@....com" <catalin.marinas@....com>, "conor+dt@...nel.org"
<conor+dt@...nel.org>, "dan.carpenter@...aro.org" <dan.carpenter@...aro.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"decui@...rosoft.com" <decui@...rosoft.com>, "haiyangz@...rosoft.com"
<haiyangz@...rosoft.com>, "hpa@...or.com" <hpa@...or.com>,
"joey.gouly@....com" <joey.gouly@....com>, "krzk+dt@...nel.org"
<krzk+dt@...nel.org>, "kw@...ux.com" <kw@...ux.com>, "kys@...rosoft.com"
<kys@...rosoft.com>, "lenb@...nel.org" <lenb@...nel.org>,
"lpieralisi@...nel.org" <lpieralisi@...nel.org>,
"manivannan.sadhasivam@...aro.org" <manivannan.sadhasivam@...aro.org>,
"mark.rutland@....com" <mark.rutland@....com>, "maz@...nel.org"
<maz@...nel.org>, "mingo@...hat.com" <mingo@...hat.com>,
"oliver.upton@...ux.dev" <oliver.upton@...ux.dev>, "rafael@...nel.org"
<rafael@...nel.org>, "robh@...nel.org" <robh@...nel.org>,
"rafael.j.wysocki@...el.com" <rafael.j.wysocki@...el.com>,
"ssengar@...ux.microsoft.com" <ssengar@...ux.microsoft.com>,
"sudeep.holla@....com" <sudeep.holla@....com>, "suzuki.poulose@....com"
<suzuki.poulose@....com>, "tglx@...utronix.de" <tglx@...utronix.de>,
"wei.liu@...nel.org" <wei.liu@...nel.org>, "will@...nel.org"
<will@...nel.org>, "yuzenghui@...wei.com" <yuzenghui@...wei.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"kvmarm@...ts.linux.dev" <kvmarm@...ts.linux.dev>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-hyperv@...r.kernel.org"
<linux-hyperv@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-pci@...r.kernel.org"
<linux-pci@...r.kernel.org>, "x86@...nel.org" <x86@...nel.org>
CC: "apais@...rosoft.com" <apais@...rosoft.com>, "benhill@...rosoft.com"
<benhill@...rosoft.com>, "bperkins@...rosoft.com" <bperkins@...rosoft.com>,
"sunilmut@...rosoft.com" <sunilmut@...rosoft.com>
Subject: RE: [PATCH hyperv-next v8 06/11] arm64, x86: hyperv: Report the VTL
the system boots in
From: Roman Kisel <romank@...ux.microsoft.com> Sent: Monday, April 14, 2025 3:47 PM
>
> 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@...ux.microsoft.com>
> ---
> arch/arm64/hyperv/mshyperv.c | 2 ++
> arch/x86/hyperv/hv_vtl.c | 7 ++++++-
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
> index 43f422a7ef34..4fdc26ade1d7 100644
> --- a/arch/arm64/hyperv/mshyperv.c
> +++ b/arch/arm64/hyperv/mshyperv.c
> @@ -118,6 +118,8 @@ static int __init hyperv_init(void)
> if (ms_hyperv.priv_high & HV_ACCESS_PARTITION_ID)
> hv_get_partition_id();
> ms_hyperv.vtl = get_vtl();
> + if (ms_hyperv.vtl > 0) /* non default VTL */
> + pr_info("Linux runs in Hyper-V Virtual Trust Level %d\n", ms_hyperv.vtl);
>
> ms_hyperv_late_init();
>
> diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c
> index 582fe820e29c..038c896fdd60 100644
> --- a/arch/x86/hyperv/hv_vtl.c
> +++ b/arch/x86/hyperv/hv_vtl.c
> @@ -55,7 +55,12 @@ static void __noreturn hv_vtl_restart(char __maybe_unused *cmd)
>
> void __init hv_vtl_init_platform(void)
> {
> - pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
> + /*
> + * This function is a no-op if the VTL mode is not enabled.
> + * If it is, this function runs if and only the kernel boots in
> + * VTL2 which the x86 hv initialization path makes sure of.
> + */
> + pr_info("Linux runs in Hyper-V Virtual Trust Level %d\n", ms_hyperv.vtl);
>
> x86_platform.realmode_reserve = x86_init_noop;
> x86_platform.realmode_init = x86_init_noop;
> --
> 2.43.0
>
Reviewed-by: Michael Kelley <mhklinux@...look.com>
Powered by blists - more mailing lists