linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Weijiang <weijiang.yang@intel.com>
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	pbonzini@redhat.com, sean.j.christopherson@intel.com,
	jmattson@google.com
Cc: yu.c.zhang@linux.intel.com, Yang Weijiang <weijiang.yang@intel.com>
Subject: [PATCH v12 10/10] KVM: x86: Enable CET virtualization and advertise CET to userspace
Date: Wed,  6 May 2020 16:21:09 +0800	[thread overview]
Message-ID: <20200506082110.25441-11-weijiang.yang@intel.com> (raw)
In-Reply-To: <20200506082110.25441-1-weijiang.yang@intel.com>

Set the feature bits so that CET capabilities can be seen in guest via
CPUID enumeration. Add CR4.CET bit support in order to allow guest set CET
master control bit(CR4.CET).

Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
---
 arch/x86/include/asm/kvm_host.h | 3 ++-
 arch/x86/kvm/cpuid.c            | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index f68c825e94ad..21f3c89d8c70 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -95,7 +95,8 @@
 			  | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \
 			  | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \
 			  | X86_CR4_OSXMMEXCPT | X86_CR4_LA57 | X86_CR4_VMXE \
-			  | X86_CR4_SMAP | X86_CR4_PKE | X86_CR4_UMIP))
+			  | X86_CR4_SMAP | X86_CR4_PKE | X86_CR4_UMIP \
+			  | X86_CR4_CET))
 
 #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR)
 
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 984ab2b395b3..333a9e0d7cdf 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -344,7 +344,8 @@ void kvm_set_cpu_caps(void)
 		F(AVX512VBMI) | F(LA57) | 0 /*PKU*/ | 0 /*OSPKE*/ | F(RDPID) |
 		F(AVX512_VPOPCNTDQ) | F(UMIP) | F(AVX512_VBMI2) | F(GFNI) |
 		F(VAES) | F(VPCLMULQDQ) | F(AVX512_VNNI) | F(AVX512_BITALG) |
-		F(CLDEMOTE) | F(MOVDIRI) | F(MOVDIR64B) | 0 /*WAITPKG*/
+		F(CLDEMOTE) | F(MOVDIRI) | F(MOVDIR64B) | 0 /*WAITPKG*/ |
+		F(SHSTK)
 	);
 	/* Set LA57 based on hardware capability. */
 	if (cpuid_ecx(7) & F(LA57))
@@ -353,7 +354,7 @@ void kvm_set_cpu_caps(void)
 	kvm_cpu_cap_mask(CPUID_7_EDX,
 		F(AVX512_4VNNIW) | F(AVX512_4FMAPS) | F(SPEC_CTRL) |
 		F(SPEC_CTRL_SSBD) | F(ARCH_CAPABILITIES) | F(INTEL_STIBP) |
-		F(MD_CLEAR) | F(AVX512_VP2INTERSECT) | F(FSRM)
+		F(MD_CLEAR) | F(AVX512_VP2INTERSECT) | F(FSRM) | F(IBT)
 	);
 
 	/* TSC_ADJUST and ARCH_CAPABILITIES are emulated in software. */
-- 
2.17.2


  parent reply	other threads:[~2020-05-06  8:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06  8:20 [PATCH v12 00/10] Introduce support for guest CET feature Yang Weijiang
2020-05-06  8:21 ` [PATCH v12 01/10] KVM: VMX: Introduce CET VMCS fields and flags Yang Weijiang
2020-05-06  8:21 ` [PATCH v12 02/10] KVM: VMX: Set guest CET MSRs per KVM and host configuration Yang Weijiang
2020-05-07  5:54   ` kbuild test robot
2020-05-06  8:21 ` [PATCH v12 03/10] KVM: VMX: Configure CET settings upon guest CR0/4 changing Yang Weijiang
2020-05-06  8:21 ` [PATCH v12 04/10] KVM: x86: Refresh CPUID once guest changes XSS bits Yang Weijiang
2020-05-06  8:21 ` [PATCH v12 05/10] KVM: x86: Load guest fpu state when access MSRs managed by XSAVES Yang Weijiang
2020-05-06  8:21 ` [PATCH v12 06/10] KVM: x86: Add userspace access interface for CET MSRs Yang Weijiang
2020-05-07  5:09   ` kbuild test robot
2020-05-06  8:21 ` [PATCH v12 07/10] KVM: VMX: Enable CET support for nested VM Yang Weijiang
2020-05-06  8:21 ` [PATCH v12 08/10] KVM: VMX: Add VMCS dump and sanity check for CET states Yang Weijiang
2020-05-06  8:21 ` [PATCH v12 09/10] KVM: x86: Add #CP support in guest exception dispatch Yang Weijiang
2020-05-06  8:21 ` Yang Weijiang [this message]
2020-05-20  5:18   ` [PATCH v12 10/10] KVM: x86: Enable CET virtualization and advertise CET to userspace Sean Christopherson
2020-05-06  8:21 ` [kvm-unit-tests PATCH v2] x86: Add test cases for user-mode CET validation Yang Weijiang
2020-05-18  8:42 ` [PATCH v12 00/10] Introduce support for guest CET feature Yang Weijiang
2020-05-19  6:06   ` Sean Christopherson
2020-06-10 16:56 ` Sean Christopherson
2020-06-11  1:29   ` Yang Weijiang
2020-06-23 18:39     ` Sean Christopherson
2020-06-24  5:56       ` Yang Weijiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200506082110.25441-11-weijiang.yang@intel.com \
    --to=weijiang.yang@intel.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=yu.c.zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).