diff options
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 7bddfab12013..b3986fec7e68 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -828,10 +828,9 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) | |||
828 | #endif | 828 | #endif |
829 | 829 | ||
830 | #ifdef CONFIG_X86_64 | 830 | #ifdef CONFIG_X86_64 |
831 | if (is_long_mode(&vmx->vcpu)) { | 831 | rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
832 | rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); | 832 | if (is_long_mode(&vmx->vcpu)) |
833 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); | 833 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); |
834 | } | ||
835 | #endif | 834 | #endif |
836 | for (i = 0; i < vmx->save_nmsrs; ++i) | 835 | for (i = 0; i < vmx->save_nmsrs; ++i) |
837 | kvm_set_shared_msr(vmx->guest_msrs[i].index, | 836 | kvm_set_shared_msr(vmx->guest_msrs[i].index, |
@@ -846,23 +845,23 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx) | |||
846 | 845 | ||
847 | ++vmx->vcpu.stat.host_state_reload; | 846 | ++vmx->vcpu.stat.host_state_reload; |
848 | vmx->host_state.loaded = 0; | 847 | vmx->host_state.loaded = 0; |
849 | if (vmx->host_state.fs_reload_needed) | 848 | #ifdef CONFIG_X86_64 |
850 | loadsegment(fs, vmx->host_state.fs_sel); | 849 | if (is_long_mode(&vmx->vcpu)) |
850 | rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); | ||
851 | #endif | ||
851 | if (vmx->host_state.gs_ldt_reload_needed) { | 852 | if (vmx->host_state.gs_ldt_reload_needed) { |
852 | kvm_load_ldt(vmx->host_state.ldt_sel); | 853 | kvm_load_ldt(vmx->host_state.ldt_sel); |
853 | #ifdef CONFIG_X86_64 | 854 | #ifdef CONFIG_X86_64 |
854 | load_gs_index(vmx->host_state.gs_sel); | 855 | load_gs_index(vmx->host_state.gs_sel); |
855 | wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); | ||
856 | #else | 856 | #else |
857 | loadsegment(gs, vmx->host_state.gs_sel); | 857 | loadsegment(gs, vmx->host_state.gs_sel); |
858 | #endif | 858 | #endif |
859 | } | 859 | } |
860 | if (vmx->host_state.fs_reload_needed) | ||
861 | loadsegment(fs, vmx->host_state.fs_sel); | ||
860 | reload_tss(); | 862 | reload_tss(); |
861 | #ifdef CONFIG_X86_64 | 863 | #ifdef CONFIG_X86_64 |
862 | if (is_long_mode(&vmx->vcpu)) { | 864 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
863 | rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); | ||
864 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); | ||
865 | } | ||
866 | #endif | 865 | #endif |
867 | if (current_thread_info()->status & TS_USEDFPU) | 866 | if (current_thread_info()->status & TS_USEDFPU) |
868 | clts(); | 867 | clts(); |
@@ -4249,11 +4248,6 @@ static int vmx_get_lpage_level(void) | |||
4249 | return PT_PDPE_LEVEL; | 4248 | return PT_PDPE_LEVEL; |
4250 | } | 4249 | } |
4251 | 4250 | ||
4252 | static inline u32 bit(int bitno) | ||
4253 | { | ||
4254 | return 1 << (bitno & 31); | ||
4255 | } | ||
4256 | |||
4257 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) | 4251 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) |
4258 | { | 4252 | { |
4259 | struct kvm_cpuid_entry2 *best; | 4253 | struct kvm_cpuid_entry2 *best; |