From mboxrd@z Thu Jan 1 00:00:00 1970 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 D9930C3DA7F for ; Sat, 3 Aug 2024 01:23:40 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qBd1wMelZARBCVInJl3VCnspXuIwi7xicjkRlzE9arc=; b=eExY5HdZHvUNfER8GTbGfSJo6h l7rdJe0GLbdIE9nMnXyBDISY6uUrWZDT31MjEVPY4rHG74QLgdEHaCPWR5UmPnV91jnwn2pZuvkkz 8lqxxm5TqDZfMTANo2d0efg6stZW4zH74N5mdqnRk04qEngdZLYaUhh7MZ157SfHQI3GTH4B56YG3 LK6/W1PX7fx/nT7hr6EqK3miQkpX5x55xjDXWJp9ioQIeVQ+54L/tu9W3BX1YPrJ2561qbh1PMF7T jKa4he6JA2t7wkhbS9xESyFrQoFb55oWmrKW2Y9eFppV6APH3iSLqhCzDbEZ4y+Z5+ZQnFm6jRGJz +7LZc3EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sa3Ua-0000000AVoJ-2TiU; Sat, 03 Aug 2024 01:23:32 +0000 Received: from mail-pl1-f178.google.com ([209.85.214.178]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sa3TC-0000000AVLE-1Qpb for linux-arm-kernel@lists.infradead.org; Sat, 03 Aug 2024 01:22:07 +0000 Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1ff1cd07f56so65980775ad.2 for ; Fri, 02 Aug 2024 18:22:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722648125; x=1723252925; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=qBd1wMelZARBCVInJl3VCnspXuIwi7xicjkRlzE9arc=; b=pwlRXo4KjXX7tfeCpMqA8wnOXPLc76eiF8wDfajL6zOAAmdSr7u9C5WlZL6f0skEtb 8TYWYt71sfP+bq3G5Z+HSfFPGedsMumj4L+lC67r8GVG8tyGDlRN26erfT1ztSf/blQq dk0Z8HP+1iTCdi20xLYRZgq7xchjGptg1/QSPuI64EIzOBd1f60NJqVUVxLOrwOXCzgx yX6tU/aGW2JJEloSYBtsCIZWlGCxKn6htZdCk93GlPyLTCIU14i4kgNgkqg6x59VFEFP tegyEC4T04I/2+jZUUD92jbw2Eb95NlrWWTdQxtwz28Ja7ObRS5atBXNEY1IkHHLFBvP UzrA== X-Forwarded-Encrypted: i=1; AJvYcCVHF0E26OYZwQVLnzAASj9mHl3jsDQsm9Cm63BUeO6V9GtiOgZHOK4gcvlHla3cU6ZoujeXt1MEez8SwxWB++2/v7nzMn6DdyNIeglF0AeA/Ihmvig= X-Gm-Message-State: AOJu0Yxs9RuqCKhZv1N1t6Qt5xt/3QABmpmwPMu7ZBWFUZ2BReeJy2Vc 16uL67AqAbEoezdOX6c6ify4nFJov0KegE5qptkVIo8rZ1gdp0k5 X-Google-Smtp-Source: AGHT+IEh3GRCAvALzlvd4U+F1tShJABMMoDoWNowR82KjXH9xwxziEaiwqMzhpgj6M2OlmS1YgXMiA== X-Received: by 2002:a17:902:ecc5:b0:1fd:8f66:b070 with SMTP id d9443c01a7336-1ff57464d40mr74676445ad.57.1722648125527; Fri, 02 Aug 2024 18:22:05 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([20.69.120.36]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f6093fsm23731485ad.114.2024.08.02.18.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 18:22:05 -0700 (PDT) Date: Sat, 3 Aug 2024 01:22:03 +0000 From: Wei Liu To: Roman Kisel Cc: arnd@arndb.de, bhelgaas@google.com, bp@alien8.de, catalin.marinas@arm.com, dave.hansen@linux.intel.com, decui@microsoft.com, haiyangz@microsoft.com, hpa@zytor.com, kw@linux.com, kys@microsoft.com, lenb@kernel.org, lpieralisi@kernel.org, mingo@redhat.com, rafael@kernel.org, robh@kernel.org, tglx@linutronix.de, wei.liu@kernel.org, will@kernel.org, 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, apais@microsoft.com, benhill@microsoft.com, ssengar@microsoft.com, sunilmut@microsoft.com, vdso@hexbites.dev Subject: Re: [PATCH v3 4/7] arm64: hyperv: Boot in a Virtual Trust Level Message-ID: References: <20240726225910.1912537-1-romank@linux.microsoft.com> <20240726225910.1912537-5-romank@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240726225910.1912537-5-romank@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240802_182206_407476_7553C9E3 X-CRM114-Status: GOOD ( 25.15 ) 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 On Fri, Jul 26, 2024 at 03:59:07PM -0700, Roman Kisel wrote: > To run in the VTL mode, Hyper-V drivers have to know what > VTL the system boots in, and the arm64/hyperv code does not > update the variable that stores the value. > > Update the variable to enable the Hyper-V drivers to boot > in the VTL mode and print the VTL the code runs in. > > Signed-off-by: Roman Kisel > --- > arch/arm64/hyperv/Makefile | 1 + > arch/arm64/hyperv/hv_vtl.c | 13 +++++++++++++ > arch/arm64/hyperv/mshyperv.c | 4 ++++ > arch/arm64/include/asm/mshyperv.h | 7 +++++++ > 4 files changed, 25 insertions(+) > create mode 100644 arch/arm64/hyperv/hv_vtl.c > > diff --git a/arch/arm64/hyperv/Makefile b/arch/arm64/hyperv/Makefile > index 87c31c001da9..9701a837a6e1 100644 > --- a/arch/arm64/hyperv/Makefile > +++ b/arch/arm64/hyperv/Makefile > @@ -1,2 +1,3 @@ > # SPDX-License-Identifier: GPL-2.0 > obj-y := hv_core.o mshyperv.o > +obj-$(CONFIG_HYPERV_VTL_MODE) += hv_vtl.o > diff --git a/arch/arm64/hyperv/hv_vtl.c b/arch/arm64/hyperv/hv_vtl.c > new file mode 100644 > index 000000000000..38642b7b6be0 > --- /dev/null > +++ b/arch/arm64/hyperv/hv_vtl.c > @@ -0,0 +1,13 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2024, Microsoft, Inc. > + * > + * Author : Roman Kisel > + */ > + > +#include > + > +void __init hv_vtl_init_platform(void) > +{ > + pr_info("Linux runs in Hyper-V Virtual Trust Level\n"); > +} > diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c > index 341f98312667..8fd04d6e4800 100644 > --- a/arch/arm64/hyperv/mshyperv.c > +++ b/arch/arm64/hyperv/mshyperv.c > @@ -98,6 +98,10 @@ static int __init hyperv_init(void) > return ret; > } > > + /* Find the VTL */ > + ms_hyperv.vtl = get_vtl(); > + hv_vtl_init_platform(); It doesn't make sense to me because this function unconditionally prints Linux runs in Hyper-V Virtual Trust Level. Thanks, Wei. > + > ms_hyperv_late_init(); > > hyperv_initialized = true; > diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h > index a7a3586f7cb1..63d6bb6998fc 100644 > --- a/arch/arm64/include/asm/mshyperv.h > +++ b/arch/arm64/include/asm/mshyperv.h > @@ -49,6 +49,13 @@ static inline u64 hv_get_msr(unsigned int reg) > ARM_SMCCC_OWNER_VENDOR_HYP, \ > HV_SMCCC_FUNC_NUMBER) > > +#ifdef CONFIG_HYPERV_VTL_MODE > +void __init hv_vtl_init_platform(void); > +int __init hv_vtl_early_init(void); > +#else > +static inline void __init hv_vtl_init_platform(void) {} > +#endif > + > #include > > #define ARM_SMCCC_VENDOR_HYP_UID_HYPERV_REG_0 0x7948734d > -- > 2.34.1 >