aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ed97c6c7e648..d4918d6fc924 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -89,6 +89,7 @@ struct vmcs {
89struct shared_msr_entry { 89struct shared_msr_entry {
90 unsigned index; 90 unsigned index;
91 u64 data; 91 u64 data;
92 u64 mask;
92}; 93};
93 94
94struct vcpu_vmx { 95struct vcpu_vmx {
@@ -601,12 +602,10 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset)
601 if (guest_efer & EFER_LMA) 602 if (guest_efer & EFER_LMA)
602 ignore_bits &= ~(u64)EFER_SCE; 603 ignore_bits &= ~(u64)EFER_SCE;
603#endif 604#endif
604 if ((guest_efer & ~ignore_bits) == (host_efer & ~ignore_bits))
605 return false;
606
607 guest_efer &= ~ignore_bits; 605 guest_efer &= ~ignore_bits;
608 guest_efer |= host_efer & ignore_bits; 606 guest_efer |= host_efer & ignore_bits;
609 vmx->guest_msrs[efer_offset].data = guest_efer; 607 vmx->guest_msrs[efer_offset].data = guest_efer;
608 vmx->guest_msrs[efer_offset].mask = ~ignore_bits;
610 return true; 609 return true;
611} 610}
612 611
@@ -657,7 +656,8 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)
657#endif 656#endif
658 for (i = 0; i < vmx->save_nmsrs; ++i) 657 for (i = 0; i < vmx->save_nmsrs; ++i)
659 kvm_set_shared_msr(vmx->guest_msrs[i].index, 658 kvm_set_shared_msr(vmx->guest_msrs[i].index,
660 vmx->guest_msrs[i].data); 659 vmx->guest_msrs[i].data,
660 vmx->guest_msrs[i].mask);
661} 661}
662 662
663static void __vmx_load_host_state(struct vcpu_vmx *vmx) 663static void __vmx_load_host_state(struct vcpu_vmx *vmx)
@@ -2394,6 +2394,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
2394 data = data_low | ((u64)data_high << 32); 2394 data = data_low | ((u64)data_high << 32);
2395 vmx->guest_msrs[j].index = i; 2395 vmx->guest_msrs[j].index = i;
2396 vmx->guest_msrs[j].data = 0; 2396 vmx->guest_msrs[j].data = 0;
2397 vmx->guest_msrs[j].mask = -1ull;
2397 ++vmx->nmsrs; 2398 ++vmx->nmsrs;
2398 } 2399 }
2399 2400