From patchwork Mon Apr 7 20:13:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kisel X-Patchwork-Id: 14041917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E43CC369A1 for ; Mon, 7 Apr 2025 21:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EiWYoHUyjXVwkeFT7aCipcb1kNdkuvJlZrw4+O5x91w=; b=hpSNFEMIxckY+Nhbc1x8V1hI1r +7pf2AoGwpcA48cGJjKvxs+cy21wZnQsVV8cQtaM4pBCmbUGBWZdticHBL4v0EHIAgWeaKOMDB1sP XQ2djyKSf2ywbahmcc3ltjqoRq7mqiqG5nYeD4CN7asNTOhNeN7m30F9ooZUrjPZnl/p1nI763FLO SdwCdRGFxS+Nv15ZEU2A18EmDnaEaOKwqMNx6dyD4SBMwFAtQ87lBLadA9rk9+XZf1T/UFEpPXvzq DEarJMmbQQgixFHS86nKbIL6R8Ftg95xHOVidfcbhcj7PxDACbINtAhqvAarCA1KboHXzFgFZhThX eMeFKNzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1u1uKy-000000027uc-1De6; Mon, 07 Apr 2025 21:49:00 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1u1sqs-00000001wIt-2lkk for linux-arm-kernel@bombadil.infradead.org; Mon, 07 Apr 2025 20:13:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=EiWYoHUyjXVwkeFT7aCipcb1kNdkuvJlZrw4+O5x91w=; b=paqhsQkTYgFCY7B2DmW3bszAhd YTc6gpfitgVGRQV2u5ojHRkO3i86hdJjWlLWZryDhdsGcaYZ0D5cawv8nydnDHOL1PkKR6mm3eXwX qP31pGCZt6R6T5dPTeW2ln+zpVO5qgfyaCkO/Jsy5RFpfp3VhU5yBwvSR8ZVxG5hNh6JRpqi9/fAq n7eosfyVXTK0dUb6Hg9w/Olp5bxq9zVj1y6PCdscFy3YncrIm9Z6kOdAyYK4tiGj6vgPiYCZq45kD qb+T4AJSo4t0AoR3aoS8EqIAs7C3ONgX+kpWE1sh+lecLuEmFfXAHhOnE+N90y1fTrF4tEGEa9igH x2uwCssQ==; Received: from linux.microsoft.com ([13.77.154.182]) by desiato.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1u1sqp-0000000893J-2Lkv for linux-arm-kernel@lists.infradead.org; Mon, 07 Apr 2025 20:13:49 +0000 Received: from romank-3650.corp.microsoft.com (unknown [131.107.160.188]) by linux.microsoft.com (Postfix) with ESMTPSA id 8A3C72113E80; Mon, 7 Apr 2025 13:13:40 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8A3C72113E80 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1744056820; bh=EiWYoHUyjXVwkeFT7aCipcb1kNdkuvJlZrw4+O5x91w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlJew+pCEAMAblBos5cUaZBK6FKYFaxcs04yrXFuct3w6xqmKjYZA36rsuov3EMQ/ oYjtfnce66ifmDsZfd+J96isC9P31jB3RzYVN7BhlmEdU9oWWfPYii+boWnCdhEXn5 YpKE82W2b45+KZBAAkFlKywWLsD0U1wKtlrEjmDI= From: Roman Kisel To: arnd@arndb.de, bhelgaas@google.com, bp@alien8.de, catalin.marinas@arm.com, conor+dt@kernel.org, dan.carpenter@linaro.org, dave.hansen@linux.intel.com, decui@microsoft.com, haiyangz@microsoft.com, hpa@zytor.com, joey.gouly@arm.com, krzk+dt@kernel.org, kw@linux.com, kys@microsoft.com, lenb@kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, mark.rutland@arm.com, maz@kernel.org, mingo@redhat.com, oliver.upton@linux.dev, rafael@kernel.org, robh@kernel.org, rafael.j.wysocki@intel.com, ssengar@linux.microsoft.com, sudeep.holla@arm.com, suzuki.poulose@arm.com, tglx@linutronix.de, wei.liu@kernel.org, will@kernel.org, yuzenghui@huawei.com, devicetree@vger.kernel.org, kvmarm@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, x86@kernel.org Cc: apais@microsoft.com, benhill@microsoft.com, bperkins@microsoft.com, sunilmut@microsoft.com Subject: [PATCH hyperv-next v7 06/11] arm64, x86: hyperv: Report the VTL the system boots in Date: Mon, 7 Apr 2025 13:13:31 -0700 Message-ID: <20250407201336.66913-7-romank@linux.microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250407201336.66913-1-romank@linux.microsoft.com> References: <20250407201336.66913-1-romank@linux.microsoft.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250407_211347_920947_36DFDE9C X-CRM114-Status: GOOD ( 12.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 if 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;