aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 51ecd381793b..59371de5d722 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -114,7 +114,7 @@ module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR);
114static bool __read_mostly report_ignored_msrs = true; 114static bool __read_mostly report_ignored_msrs = true;
115module_param(report_ignored_msrs, bool, S_IRUGO | S_IWUSR); 115module_param(report_ignored_msrs, bool, S_IRUGO | S_IWUSR);
116 116
117unsigned int min_timer_period_us = 500; 117unsigned int min_timer_period_us = 200;
118module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR); 118module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
119 119
120static bool __read_mostly kvmclock_periodic_sync = true; 120static bool __read_mostly kvmclock_periodic_sync = true;
@@ -843,7 +843,10 @@ EXPORT_SYMBOL_GPL(kvm_set_cr4);
843int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) 843int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
844{ 844{
845#ifdef CONFIG_X86_64 845#ifdef CONFIG_X86_64
846 cr3 &= ~CR3_PCID_INVD; 846 bool pcid_enabled = kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE);
847
848 if (pcid_enabled)
849 cr3 &= ~CR3_PCID_INVD;
847#endif 850#endif
848 851
849 if (cr3 == kvm_read_cr3(vcpu) && !pdptrs_changed(vcpu)) { 852 if (cr3 == kvm_read_cr3(vcpu) && !pdptrs_changed(vcpu)) {
@@ -6671,12 +6674,13 @@ void kvm_vcpu_deactivate_apicv(struct kvm_vcpu *vcpu)
6671int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) 6674int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
6672{ 6675{
6673 unsigned long nr, a0, a1, a2, a3, ret; 6676 unsigned long nr, a0, a1, a2, a3, ret;
6674 int op_64_bit, r; 6677 int op_64_bit;
6675
6676 r = kvm_skip_emulated_instruction(vcpu);
6677 6678
6678 if (kvm_hv_hypercall_enabled(vcpu->kvm)) 6679 if (kvm_hv_hypercall_enabled(vcpu->kvm)) {
6679 return kvm_hv_hypercall(vcpu); 6680 if (!kvm_hv_hypercall(vcpu))
6681 return 0;
6682 goto out;
6683 }
6680 6684
6681 nr = kvm_register_read(vcpu, VCPU_REGS_RAX); 6685 nr = kvm_register_read(vcpu, VCPU_REGS_RAX);
6682 a0 = kvm_register_read(vcpu, VCPU_REGS_RBX); 6686 a0 = kvm_register_read(vcpu, VCPU_REGS_RBX);
@@ -6697,7 +6701,7 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
6697 6701
6698 if (kvm_x86_ops->get_cpl(vcpu) != 0) { 6702 if (kvm_x86_ops->get_cpl(vcpu) != 0) {
6699 ret = -KVM_EPERM; 6703 ret = -KVM_EPERM;
6700 goto out; 6704 goto out_error;
6701 } 6705 }
6702 6706
6703 switch (nr) { 6707 switch (nr) {
@@ -6717,12 +6721,14 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
6717 ret = -KVM_ENOSYS; 6721 ret = -KVM_ENOSYS;
6718 break; 6722 break;
6719 } 6723 }
6720out: 6724out_error:
6721 if (!op_64_bit) 6725 if (!op_64_bit)
6722 ret = (u32)ret; 6726 ret = (u32)ret;
6723 kvm_register_write(vcpu, VCPU_REGS_RAX, ret); 6727 kvm_register_write(vcpu, VCPU_REGS_RAX, ret);
6728
6729out:
6724 ++vcpu->stat.hypercalls; 6730 ++vcpu->stat.hypercalls;
6725 return r; 6731 return kvm_skip_emulated_instruction(vcpu);
6726} 6732}
6727EXPORT_SYMBOL_GPL(kvm_emulate_hypercall); 6733EXPORT_SYMBOL_GPL(kvm_emulate_hypercall);
6728 6734