diff options
author | Yang, Wei <wei.y.yang@intel.com> | 2011-06-14 08:10:18 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-07-12 06:16:23 -0400 |
commit | 74dc2b4ffe3af1eac367be0178f88487cb9b240a (patch) | |
tree | 2f5e4cb1281f9fd91a2db67c722864db7e39fbc3 /arch/x86/kvm/x86.c | |
parent | d9c3476d8a99455cd3af1bd773acd77aa947a934 (diff) |
KVM: Add RDWRGSFS support when setting CR4
This patch adds RDWRGSFS support when setting CR4.
Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6f1e54d0828d..423e0cda8e91 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -588,6 +588,14 @@ static bool guest_cpuid_has_smep(struct kvm_vcpu *vcpu) | |||
588 | return best && (best->ebx & bit(X86_FEATURE_SMEP)); | 588 | return best && (best->ebx & bit(X86_FEATURE_SMEP)); |
589 | } | 589 | } |
590 | 590 | ||
591 | static bool guest_cpuid_has_fsgsbase(struct kvm_vcpu *vcpu) | ||
592 | { | ||
593 | struct kvm_cpuid_entry2 *best; | ||
594 | |||
595 | best = kvm_find_cpuid_entry(vcpu, 7, 0); | ||
596 | return best && (best->ebx & bit(X86_FEATURE_FSGSBASE)); | ||
597 | } | ||
598 | |||
591 | static void update_cpuid(struct kvm_vcpu *vcpu) | 599 | static void update_cpuid(struct kvm_vcpu *vcpu) |
592 | { | 600 | { |
593 | struct kvm_cpuid_entry2 *best; | 601 | struct kvm_cpuid_entry2 *best; |
@@ -618,6 +626,9 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
618 | if (!guest_cpuid_has_smep(vcpu) && (cr4 & X86_CR4_SMEP)) | 626 | if (!guest_cpuid_has_smep(vcpu) && (cr4 & X86_CR4_SMEP)) |
619 | return 1; | 627 | return 1; |
620 | 628 | ||
629 | if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_RDWRGSFS)) | ||
630 | return 1; | ||
631 | |||
621 | if (is_long_mode(vcpu)) { | 632 | if (is_long_mode(vcpu)) { |
622 | if (!(cr4 & X86_CR4_PAE)) | 633 | if (!(cr4 & X86_CR4_PAE)) |
623 | return 1; | 634 | return 1; |