Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3589334pxb; Mon, 21 Feb 2022 01:10:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiz6KQbv0ejIgG0Virg97P3YwF4wDXbAxN4gQt9MGsUyBesBB5x7ZKAUaxXlvojtqsXnAJ X-Received: by 2002:a17:907:1245:b0:6cc:e663:7baa with SMTP id wc5-20020a170907124500b006cce6637baamr14585227ejb.447.1645434608648; Mon, 21 Feb 2022 01:10:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645434608; cv=none; d=google.com; s=arc-20160816; b=ZIe+sx6jryJuGJgMXihIHORq/hLIFHOKzt+jb3yhGdphu1aQhGGb7igFVOOSdXKKtt ErL7J85yCNV8zvY/h+z+osOxqqu4T3KWg4OnQ0rFIhZsyLXRiQVGx/ELJkUtwZZ380Vv XIUGL3zLZez9HKQyVX70ClhGbo1qcUYhtXUXrQoy+kNItHNUsHcw0AHfVnUHbs/xEkME k13TAZKLS4aOkVpg/sW77ZDTdviX/Xfo4fzQpsqZ9oLcVVeEtlOjtpIScrUixyj05HYr R+lCW+RMtw2R4ZqcThzsjRmHFRawrerQg/1fxXnYlc/aq55bl/yfBO51L6sp4GkgKvzQ BH7A== 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 :cc:to:from:dkim-signature; bh=5KeN6ZMMg45pO3Iy3bHn4DrLY66VO2sfrDD2Fiqz8q0=; b=WYWzxUzB1WESyGG4+3gRRK7e/f4y5tdVUnSdfMmONBfmIIrk8/aPlyYyiIP1XcsdXj v85EHfs6gOtNSG7fKMDes08Ok9BZnidMinmpy4gyd6X5Tjx3U/OzXOaOFDnrIZOtRFJN grqNkp73s336+SWgczwWSrRx1U6Y7xZ5fOYfVAACKRnvrMBya55oT59XvPnZZjwfYHvF S5Lg9Rgei1XMzL5CgQWSnqkHlQUnJD4tHbMNmq3lXMrpRYX4MZpJmIzKXflZQ3vcdrwP bjyFy+oOicKOzREFTWAFaK7FPXiqg1cMLfl6HDZheRW8RhCUB4EGpL7jHRT0olWBysC+ Iizg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XBhYrprl; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs1si10889539ejc.413.2022.02.21.01.09.45; Mon, 21 Feb 2022 01:10:08 -0800 (PST) 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=@intel.com header.s=Intel header.b=XBhYrprl; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346830AbiBUIGW (ORCPT + 99 others); Mon, 21 Feb 2022 03:06:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346810AbiBUIGU (ORCPT ); Mon, 21 Feb 2022 03:06:20 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEF38635E; Mon, 21 Feb 2022 00:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645430757; x=1676966757; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=5VNRZNN7CqeqZx9FxLdMANtkHPO8VyZj8Jmc3XU1Ow8=; b=XBhYrprlixfhGhRHwrWnanH2TWfv739m3W7WZtk+/ZeWFAZc1DaUBvIx qkE5GoE5UdH064IsllWXjG4oHNUOO0nOFT2gGEBAV2gLIZ8Av0Q5ria0D KtZ3Dbd3zNXzhtk+8kPddjo3U/6VEWa/ZXXgYDCw6SpATdB7RgBUuoqrN Q6BLS3z4BIni5dID3xcCD8r6lC4+GXlWrB0dr8OwR36gHprouj3QDqlsO gSWIXJsjxEdURy2iXtTZv4vjWTPEcc3JOfJtwFq+MFJGs3h15lPbP+DU0 Yg5g4WZpafPVdQeAGlcD2e/NYLi47xafqyUgw93WH9bQSNvyaZr0xhonm Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10264"; a="250277843" X-IronPort-AV: E=Sophos;i="5.88,385,1635231600"; d="scan'208";a="250277843" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 00:05:41 -0800 X-IronPort-AV: E=Sophos;i="5.88,385,1635231600"; d="scan'208";a="638472239" Received: from unknown (HELO chenyi-pc.sh.intel.com) ([10.239.159.73]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 00:05:38 -0800 From: Chenyi Qiang To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Xiaoyao Li Cc: Chenyi Qiang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/7] KVM: VMX: Introduce PKS VMCS fields Date: Mon, 21 Feb 2022 16:08:34 +0800 Message-Id: <20220221080840.7369-2-chenyi.qiang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220221080840.7369-1-chenyi.qiang@intel.com> References: <20220221080840.7369-1-chenyi.qiang@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 PKS(Protection Keys for Supervisor Pages) is a feature that extends the Protection Key architecture to support thread-specific permission restrictions on supervisor pages. A new PKS MSR(PKRS) is defined in kernel to support PKS, which holds a set of permissions associated with each protection domain. Two VMCS fields {HOST,GUEST}_IA32_PKRS are introduced in {host,guest}-state area to store the respective values of PKRS. Every VM exit saves PKRS into guest-state area. If VM_EXIT_LOAD_IA32_PKRS = 1, VM exit loads PKRS from the host-state area. If VM_ENTRY_LOAD_IA32_PKRS = 1, VM entry loads PKRS from the guest-state area. Signed-off-by: Chenyi Qiang Reviewed-by: Jim Mattson --- arch/x86/include/asm/vmx.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 0ffaa3156a4e..7962d506ba91 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -95,6 +95,7 @@ #define VM_EXIT_CLEAR_BNDCFGS 0x00800000 #define VM_EXIT_PT_CONCEAL_PIP 0x01000000 #define VM_EXIT_CLEAR_IA32_RTIT_CTL 0x02000000 +#define VM_EXIT_LOAD_IA32_PKRS 0x20000000 #define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR 0x00036dff @@ -108,6 +109,7 @@ #define VM_ENTRY_LOAD_BNDCFGS 0x00010000 #define VM_ENTRY_PT_CONCEAL_PIP 0x00020000 #define VM_ENTRY_LOAD_IA32_RTIT_CTL 0x00040000 +#define VM_ENTRY_LOAD_IA32_PKRS 0x00400000 #define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR 0x000011ff @@ -245,12 +247,16 @@ enum vmcs_field { GUEST_BNDCFGS_HIGH = 0x00002813, GUEST_IA32_RTIT_CTL = 0x00002814, GUEST_IA32_RTIT_CTL_HIGH = 0x00002815, + GUEST_IA32_PKRS = 0x00002818, + GUEST_IA32_PKRS_HIGH = 0x00002819, HOST_IA32_PAT = 0x00002c00, HOST_IA32_PAT_HIGH = 0x00002c01, HOST_IA32_EFER = 0x00002c02, HOST_IA32_EFER_HIGH = 0x00002c03, HOST_IA32_PERF_GLOBAL_CTRL = 0x00002c04, HOST_IA32_PERF_GLOBAL_CTRL_HIGH = 0x00002c05, + HOST_IA32_PKRS = 0x00002c06, + HOST_IA32_PKRS_HIGH = 0x00002c07, PIN_BASED_VM_EXEC_CONTROL = 0x00004000, CPU_BASED_VM_EXEC_CONTROL = 0x00004002, EXCEPTION_BITMAP = 0x00004004, -- 2.17.1