Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2055495pxa; Fri, 7 Aug 2020 01:47:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFHWIaNXyeJQGbNP5f+zLJTU8YE2fKg7IeCJBfCo8F4FjtWRhME1OGNi+Q1D6zIpwUY5l8 X-Received: by 2002:a17:906:434c:: with SMTP id z12mr8024078ejm.33.1596790066633; Fri, 07 Aug 2020 01:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596790066; cv=none; d=google.com; s=arc-20160816; b=bknFyUv+3a3+BXrBTO8V1d+skGxw6ict5zjW8X/a84n+5hpKAkRzAIH+nD39lrBuf/ f6GO+1ai+hydTlLtyDiC4cJpkaw41WCvTdZLo1uTND1a5lUaARs43sFpu6cRLFUT0BZ2 i/1/32YvgnGUJwp9TgLo80Qu8ExYqej52+tVKGVClPZj9hk/p1HooJqXg5aRDNvUCsIY 3FbVe3P6fiYitDUmTdZpXH10ihynn/qdZ12/tPGaUhN0zv5RU4lz+e911crR8EUs8zjQ Tm1YvcBWSbP4GjCvx756CXWA6EEsQiN7Y/8cPzgYoQ01cDDSMNtqWvNC9XANy9qlV6K4 w5Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=5191NcJoKCOWD1x3firixeoHNzgLOnnmW7a9hAxpaAM=; b=Wac7IcpiVKaYGGf1PzdNR8oztN/7SbfFAccONSPpxM/AipHnoJelbA17roTzBPqaP+ EsJnQtZEWLZMiSRHdcmfz3ANyQTJPNSSv6GkJxeseBE3EVHH0LkYrHsE/76WwuBNlVNz IIB09R+kNVUT/BwGAvV0NIhso9tSWaO1pFSTpH8FIUpFdEX6X4nkN8iFoW5cOlCQLWvu QrZ7YMKLBotcb/heNDrZukwmB/jM8CJV0GYd5iZqM16eD5t6ZgW8S2zPe+qsUsc9LMQp lRdylfgNXnMZXlgSP598Xu/rk/T+OAnnUc14uHTR1j0pIvQdpVE6KMDngYpVyWEJ/9jt XHfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si408594ejf.672.2020.08.07.01.47.22; Fri, 07 Aug 2020 01:47:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727852AbgHGIqs (ORCPT + 99 others); Fri, 7 Aug 2020 04:46:48 -0400 Received: from mga06.intel.com ([134.134.136.31]:65145 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726382AbgHGIqr (ORCPT ); Fri, 7 Aug 2020 04:46:47 -0400 IronPort-SDR: 9lUVoQ61V38JDQuZP/R0iCzRx94K6gKM0LbYE3q/Tzc0JnJAjY5tx/EDUw5PNnivqRTYb22y8C 1+kdfYdB0TpQ== X-IronPort-AV: E=McAfee;i="6000,8403,9705"; a="214565718" X-IronPort-AV: E=Sophos;i="5.75,445,1589266800"; d="scan'208";a="214565718" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2020 01:46:46 -0700 IronPort-SDR: 95lBwmMTRHBuGxcPLquYgJLSzAWQtRulQ1T7PQhLt3uMioPI148jKqrntGjoyKziS0e8AFeB2V Fljic4D8ECSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,445,1589266800"; d="scan'208";a="307317144" Received: from chenyi-pc.sh.intel.com ([10.239.159.72]) by orsmga002.jf.intel.com with ESMTP; 07 Aug 2020 01:46:44 -0700 From: Chenyi Qiang To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Xiaoyao Li Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 1/7] KVM: VMX: Introduce PKS VMCS fields Date: Fri, 7 Aug 2020 16:48:35 +0800 Message-Id: <20200807084841.7112-2-chenyi.qiang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807084841.7112-1-chenyi.qiang@intel.com> References: <20200807084841.7112-1-chenyi.qiang@intel.com> Sender: linux-kernel-owner@vger.kernel.org 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 domian. Two VMCS fields {HOST,GUEST}_IA32_PKRS are introduced in {host,guest}-state area to store the value 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 --- 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 cd7de4b401fe..425cf81dd722 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -94,6 +94,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 @@ -107,6 +108,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 @@ -243,12 +245,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