From patchwork Mon Mar 20 10:03:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 72077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1133026wrt; Mon, 20 Mar 2023 03:27:33 -0700 (PDT) X-Google-Smtp-Source: AK7set8Xx+dMV0Z9o55h//RqAUFmmy36wJGxfA8BPO581XVuBvZjQUVoUKyY1fGMl33xBm65XGcN X-Received: by 2002:a62:7b4b:0:b0:625:c048:2f81 with SMTP id w72-20020a627b4b000000b00625c0482f81mr13809759pfc.32.1679308052890; Mon, 20 Mar 2023 03:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679308052; cv=none; d=google.com; s=arc-20160816; b=bdwfDWNZfbMmSeE95ixwA4fd7zcMd9d3z0+BEuZ2+G0DAbEsd3niAWv8+Ts/TMzZL1 nM6ZqiwWsS9g4iyMGl4/GRlTcFy4dV3t6TSEHVnkSKqRx8fwQkzb9Ls/dvLdiqCp++Wf r+rAUPZk48q3IG8wpHtGne4qcS1ipIyfd7sJ7cFL8olj7xDNukgyFUUeeaBP9LL37n4j WSvNZ8kK/3mvI476/0o/Ik1/a286xGkIhw2wKljmCvLeVUF96ZYYA+Hg/yhfqbbDDlme gBYdz2Rh6ULatW9CSjuBdn4tqy7r2gFDxegLH5+Bxj36GDIe1wJhLKUY7cJl3RpF336q tOyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=m8jjVQgvGPJQeoOJeABcx5K8xClDg9B7AC1Hcldbrs8=; b=RnGFmsedtfKu39QwvEwd9UD+cN+y2HqLyqIVy5mnPenMjUPXzYGsZliP87mVQ+12rA 8uxMywZRIkpfc1Y0Fhgf8yv0jAmzAEheccctFtagjH8arbK8ynONo5OiFRzdBGHAV10U 8g/6qp86TqVwPMIBenOE27xg8w0oCs2OX78kd0OAYc4V1t/tMfuyUwBZRUnmxu49iRmr O9otUFWEvil0O96aM59mEx5e5jyQSAbUNsWbKqrylf4Xi/FZsQwFicEtrxHPF90MCrlv 0ZgtsHWG7V0W6mZcpGMJyoG/OGYvT7vzhL4mtdJnN+Zv8cZZUZqbJG1p6yCFhZggUbiY iwcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=MUoybISV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a654145000000b004fbb899417dsi9691256pgp.851.2023.03.20.03.27.19; Mon, 20 Mar 2023 03:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=MUoybISV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230030AbjCTKF7 (ORCPT + 99 others); Mon, 20 Mar 2023 06:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbjCTKFd (ORCPT ); Mon, 20 Mar 2023 06:05:33 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 79601244B3; Mon, 20 Mar 2023 03:04:49 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 400B920FAEE0; Mon, 20 Mar 2023 03:03:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 400B920FAEE0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679306623; bh=m8jjVQgvGPJQeoOJeABcx5K8xClDg9B7AC1Hcldbrs8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MUoybISV2S+ERAmGjzyKq7Wdl8ucOSzVHudOtGJVcZepbSFWVn1W9upTtGRLgyA+k lUdlObmhHMu870qd0yXxcBF6RwRxdfcy8Mef1FPL7upOnzKmm9y2Kr/Udy9DhA7gHo uIeYdlneVs5pRJyWI9RXcS9yVCYrwt5oxiHyd3O4= From: Saurabh Sengar To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, arnd@arndb.de, tiala@microsoft.com, mikelley@microsoft.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH v3 5/5] x86/Kconfig: Add HYPERV_VTL_MODE Date: Mon, 20 Mar 2023 03:03:38 -0700 Message-Id: <1679306618-31484-6-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1679306618-31484-1-git-send-email-ssengar@linux.microsoft.com> References: <1679306618-31484-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760882120543451981?= X-GMAIL-MSGID: =?utf-8?q?1760882120543451981?= Add HYPERV_VTL_MODE Kconfig flag for VTL mode. Signed-off-by: Saurabh Sengar --- arch/x86/Kconfig | 24 ++++++++++++++++++++++++ arch/x86/hyperv/Makefile | 1 + 2 files changed, 25 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 453f462f6c9c..c3faaaea1e31 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -782,6 +782,30 @@ menuconfig HYPERVISOR_GUEST if HYPERVISOR_GUEST +config HYPERV_VTL_MODE + bool "Enable Linux to boot in VTL context" + depends on X86_64 && HYPERV + default n + help + Virtual Secure Mode (VSM) is a set of hypervisor capabilities and + enlightenments offered to host and guest partitions which enables + the creation and management of new security boundaries within + operating system software. + + VSM achieves and maintains isolation through Virtual Trust Levels + (VTLs). Virtual Trust Levels are hierarchical, with higher levels + being more privileged than lower levels. VTL0 is the least privileged + level, and currently only other level supported is VTL2. + + Select this option to build a Linux kernel to run at a VTL other than + the normal VTL0, which currently is only VTL2. This option + initializes the x86 platform for VTL2, and adds the ability to boot + secondary CPUs directly into 64-bit context as required for VTLs other + than 0. A kernel built with this option must run at VTL2, and will + not run as a normal guest. + + If unsure, say N + config PARAVIRT bool "Enable paravirtualization code" depends on HAVE_STATIC_CALL diff --git a/arch/x86/hyperv/Makefile b/arch/x86/hyperv/Makefile index 5d2de10809ae..3a1548054b48 100644 --- a/arch/x86/hyperv/Makefile +++ b/arch/x86/hyperv/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only obj-y := hv_init.o mmu.o nested.o irqdomain.o ivm.o obj-$(CONFIG_X86_64) += hv_apic.o hv_proc.o +obj-$(CONFIG_HYPERV_VTL_MODE) += hv_vtl.o ifdef CONFIG_X86_64 obj-$(CONFIG_PARAVIRT_SPINLOCKS) += hv_spinlock.o