aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorLiu, Jinsong <jinsong.liu@intel.com>2014-02-24 05:58:09 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2014-02-25 14:17:12 -0500
commit390bd528ae1c14d0b7f5db8225984f98617b3357 (patch)
tree90a06cecd26afb5853e5f9fbe2a61969256f4112 /arch/x86/kvm
parent0dd376e709975779cf43f368498c5c0eec843b02 (diff)
KVM: x86: Enable Intel MPX for guest
From 44c2abca2c2eadc6f2f752b66de4acc8131880c4 Mon Sep 17 00:00:00 2001 From: Liu Jinsong <jinsong.liu@intel.com> Date: Mon, 24 Feb 2014 18:12:31 +0800 Subject: [PATCH v5 3/3] KVM: x86: Enable Intel MPX for guest This patch enable Intel MPX feature to guest. Signed-off-by: Xudong Hao <xudong.hao@intel.com> Signed-off-by: Liu Jinsong <jinsong.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/cpuid.c4
-rw-r--r--arch/x86/kvm/x86.c3
-rw-r--r--arch/x86/kvm/x86.h3
3 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index b241325b5965..ddc8a7e165df 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -256,6 +256,8 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
256#endif 256#endif
257 unsigned f_rdtscp = kvm_x86_ops->rdtscp_supported() ? F(RDTSCP) : 0; 257 unsigned f_rdtscp = kvm_x86_ops->rdtscp_supported() ? F(RDTSCP) : 0;
258 unsigned f_invpcid = kvm_x86_ops->invpcid_supported() ? F(INVPCID) : 0; 258 unsigned f_invpcid = kvm_x86_ops->invpcid_supported() ? F(INVPCID) : 0;
259 unsigned f_mpx = kvm_x86_ops->mpx_supported ?
260 (kvm_x86_ops->mpx_supported() ? F(MPX) : 0) : 0;
259 261
260 /* cpuid 1.edx */ 262 /* cpuid 1.edx */
261 const u32 kvm_supported_word0_x86_features = 263 const u32 kvm_supported_word0_x86_features =
@@ -303,7 +305,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
303 /* cpuid 7.0.ebx */ 305 /* cpuid 7.0.ebx */
304 const u32 kvm_supported_word9_x86_features = 306 const u32 kvm_supported_word9_x86_features =
305 F(FSGSBASE) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) | 307 F(FSGSBASE) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) |
306 F(BMI2) | F(ERMS) | f_invpcid | F(RTM) | F(RDSEED) | 308 F(BMI2) | F(ERMS) | f_invpcid | F(RTM) | f_mpx | F(RDSEED) |
307 F(ADX); 309 F(ADX);
308 310
309 /* all calls to cpuid_count() should be made on the same cpu */ 311 /* all calls to cpuid_count() should be made on the same cpu */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 33fa9e348d18..6530019116b0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -616,6 +616,9 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
616 if (xcr0 & ~valid_bits) 616 if (xcr0 & ~valid_bits)
617 return 1; 617 return 1;
618 618
619 if ((!(xcr0 & XSTATE_BNDREGS)) != (!(xcr0 & XSTATE_BNDCSR)))
620 return 1;
621
619 kvm_put_guest_xcr0(vcpu); 622 kvm_put_guest_xcr0(vcpu);
620 vcpu->arch.xcr0 = xcr0; 623 vcpu->arch.xcr0 = xcr0;
621 624
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 8da5823bcde6..392ecbff0030 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -122,7 +122,8 @@ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt,
122 gva_t addr, void *val, unsigned int bytes, 122 gva_t addr, void *val, unsigned int bytes,
123 struct x86_exception *exception); 123 struct x86_exception *exception);
124 124
125#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM) 125#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \
126 | XSTATE_BNDREGS | XSTATE_BNDCSR)
126extern u64 host_xcr0; 127extern u64 host_xcr0;
127 128
128extern unsigned int min_timer_period_us; 129extern unsigned int min_timer_period_us;