diff options
-rw-r--r-- | drivers/kvm/kvm.h | 1 | ||||
-rw-r--r-- | drivers/kvm/kvm_main.c | 11 | ||||
-rw-r--r-- | drivers/kvm/svm.c | 7 | ||||
-rw-r--r-- | drivers/kvm/vmx.c | 7 |
4 files changed, 14 insertions, 12 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index e665f5500159..ac358b8d3de8 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -504,6 +504,7 @@ int kvm_setup_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, | |||
504 | int size, unsigned long count, int string, int down, | 504 | int size, unsigned long count, int string, int down, |
505 | gva_t address, int rep, unsigned port); | 505 | gva_t address, int rep, unsigned port); |
506 | void kvm_emulate_cpuid(struct kvm_vcpu *vcpu); | 506 | void kvm_emulate_cpuid(struct kvm_vcpu *vcpu); |
507 | int kvm_emulate_halt(struct kvm_vcpu *vcpu); | ||
507 | int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address); | 508 | int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address); |
508 | int emulate_clts(struct kvm_vcpu *vcpu); | 509 | int emulate_clts(struct kvm_vcpu *vcpu); |
509 | int emulator_get_dr(struct x86_emulate_ctxt* ctxt, int dr, | 510 | int emulator_get_dr(struct x86_emulate_ctxt* ctxt, int dr, |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 230b25aa469c..556416962541 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1285,6 +1285,17 @@ int emulate_instruction(struct kvm_vcpu *vcpu, | |||
1285 | } | 1285 | } |
1286 | EXPORT_SYMBOL_GPL(emulate_instruction); | 1286 | EXPORT_SYMBOL_GPL(emulate_instruction); |
1287 | 1287 | ||
1288 | int kvm_emulate_halt(struct kvm_vcpu *vcpu) | ||
1289 | { | ||
1290 | if (vcpu->irq_summary) | ||
1291 | return 1; | ||
1292 | |||
1293 | vcpu->run->exit_reason = KVM_EXIT_HLT; | ||
1294 | ++vcpu->stat.halt_exits; | ||
1295 | return 0; | ||
1296 | } | ||
1297 | EXPORT_SYMBOL_GPL(kvm_emulate_halt); | ||
1298 | |||
1288 | int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run) | 1299 | int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run) |
1289 | { | 1300 | { |
1290 | unsigned long nr, a0, a1, a2, a3, a4, a5, ret; | 1301 | unsigned long nr, a0, a1, a2, a3, a4, a5, ret; |
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index ec040e2f8c58..70f386e04cbe 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -1115,12 +1115,7 @@ static int halt_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1115 | { | 1115 | { |
1116 | vcpu->svm->next_rip = vcpu->svm->vmcb->save.rip + 1; | 1116 | vcpu->svm->next_rip = vcpu->svm->vmcb->save.rip + 1; |
1117 | skip_emulated_instruction(vcpu); | 1117 | skip_emulated_instruction(vcpu); |
1118 | if (vcpu->irq_summary) | 1118 | return kvm_emulate_halt(vcpu); |
1119 | return 1; | ||
1120 | |||
1121 | kvm_run->exit_reason = KVM_EXIT_HLT; | ||
1122 | ++vcpu->stat.halt_exits; | ||
1123 | return 0; | ||
1124 | } | 1119 | } |
1125 | 1120 | ||
1126 | static int vmmcall_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1121 | static int vmmcall_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index a534e6fe8184..90abd3c58c65 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -1896,12 +1896,7 @@ static int handle_interrupt_window(struct kvm_vcpu *vcpu, | |||
1896 | static int handle_halt(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1896 | static int handle_halt(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1897 | { | 1897 | { |
1898 | skip_emulated_instruction(vcpu); | 1898 | skip_emulated_instruction(vcpu); |
1899 | if (vcpu->irq_summary) | 1899 | return kvm_emulate_halt(vcpu); |
1900 | return 1; | ||
1901 | |||
1902 | kvm_run->exit_reason = KVM_EXIT_HLT; | ||
1903 | ++vcpu->stat.halt_exits; | ||
1904 | return 0; | ||
1905 | } | 1900 | } |
1906 | 1901 | ||
1907 | static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1902 | static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |