aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/kvm/kvm-ia64.c16
-rw-r--r--arch/powerpc/kvm/powerpc.c13
-rw-r--r--arch/s390/kvm/interrupt.c8
-rw-r--r--arch/x86/include/asm/kvm_host.h2
-rw-r--r--arch/x86/kvm/x86.c6
-rw-r--r--include/linux/kvm_host.h2
-rw-r--r--virt/kvm/kvm_main.c4
7 files changed, 11 insertions, 40 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index d7aa6bb8f477..0ad09f05efa9 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1935,19 +1935,6 @@ int kvm_highest_pending_irq(struct kvm_vcpu *vcpu)
1935 return find_highest_bits((int *)&vpd->irr[0]); 1935 return find_highest_bits((int *)&vpd->irr[0]);
1936} 1936}
1937 1937
1938int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
1939{
1940 if (kvm_highest_pending_irq(vcpu) != -1)
1941 return 1;
1942 return 0;
1943}
1944
1945int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu)
1946{
1947 /* do real check here */
1948 return 1;
1949}
1950
1951int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) 1938int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
1952{ 1939{
1953 return vcpu->arch.timer_fired; 1940 return vcpu->arch.timer_fired;
@@ -1960,7 +1947,8 @@ gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
1960 1947
1961int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 1948int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
1962{ 1949{
1963 return vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE; 1950 return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE) ||
1951 (kvm_highest_pending_irq(vcpu) != -1);
1964} 1952}
1965 1953
1966int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, 1954int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 0341391eff12..2a4551f78f60 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -39,20 +39,9 @@ gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
39 return gfn; 39 return gfn;
40} 40}
41 41
42int kvm_cpu_has_interrupt(struct kvm_vcpu *v)
43{
44 return !!(v->arch.pending_exceptions);
45}
46
47int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu)
48{
49 /* do real check here */
50 return 1;
51}
52
53int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) 42int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
54{ 43{
55 return !(v->arch.msr & MSR_WE); 44 return !(v->arch.msr & MSR_WE) || !!(v->arch.pending_exceptions);
56} 45}
57 46
58 47
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 4d613415c435..2c2f98353415 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -283,7 +283,7 @@ static int __try_deliver_ckc_interrupt(struct kvm_vcpu *vcpu)
283 return 1; 283 return 1;
284} 284}
285 285
286int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu) 286static int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
287{ 287{
288 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; 288 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
289 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int; 289 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int;
@@ -320,12 +320,6 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
320 return rc; 320 return rc;
321} 321}
322 322
323int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu)
324{
325 /* do real check here */
326 return 1;
327}
328
329int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) 323int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
330{ 324{
331 return 0; 325 return 0;
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 3f4f00a23536..08732d7b6d98 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -797,6 +797,8 @@ asmlinkage void kvm_handle_fault_on_reboot(void);
797int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); 797int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
798int kvm_age_hva(struct kvm *kvm, unsigned long hva); 798int kvm_age_hva(struct kvm *kvm, unsigned long hva);
799int cpuid_maxphyaddr(struct kvm_vcpu *vcpu); 799int cpuid_maxphyaddr(struct kvm_vcpu *vcpu);
800int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu);
801int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
800int kvm_cpu_get_interrupt(struct kvm_vcpu *v); 802int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
801 803
802#endif /* _ASM_X86_KVM_HOST_H */ 804#endif /* _ASM_X86_KVM_HOST_H */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 11cfd897aac6..b87d65d89a05 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4890,8 +4890,10 @@ void kvm_arch_flush_shadow(struct kvm *kvm)
4890int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 4890int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
4891{ 4891{
4892 return vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE 4892 return vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE
4893 || vcpu->arch.mp_state == KVM_MP_STATE_SIPI_RECEIVED 4893 || vcpu->arch.mp_state == KVM_MP_STATE_SIPI_RECEIVED
4894 || vcpu->arch.nmi_pending; 4894 || vcpu->arch.nmi_pending ||
4895 (kvm_arch_interrupt_allowed(vcpu) &&
4896 kvm_cpu_has_interrupt(vcpu));
4895} 4897}
4896 4898
4897void kvm_vcpu_kick(struct kvm_vcpu *vcpu) 4899void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 2c6a5f008746..4af56036a6bf 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -332,7 +332,6 @@ int kvm_arch_hardware_setup(void);
332void kvm_arch_hardware_unsetup(void); 332void kvm_arch_hardware_unsetup(void);
333void kvm_arch_check_processor_compat(void *rtn); 333void kvm_arch_check_processor_compat(void *rtn);
334int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); 334int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
335int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
336 335
337void kvm_free_physmem(struct kvm *kvm); 336void kvm_free_physmem(struct kvm *kvm);
338 337
@@ -341,7 +340,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm);
341void kvm_free_all_assigned_devices(struct kvm *kvm); 340void kvm_free_all_assigned_devices(struct kvm *kvm);
342void kvm_arch_sync_events(struct kvm *kvm); 341void kvm_arch_sync_events(struct kvm *kvm);
343 342
344int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
345int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 343int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
346void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 344void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
347 345
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index d7b9bbba26da..532af9b41ee3 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1666,9 +1666,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
1666 for (;;) { 1666 for (;;) {
1667 prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE); 1667 prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
1668 1668
1669 if ((kvm_arch_interrupt_allowed(vcpu) && 1669 if (kvm_arch_vcpu_runnable(vcpu)) {
1670 kvm_cpu_has_interrupt(vcpu)) ||
1671 kvm_arch_vcpu_runnable(vcpu)) {
1672 set_bit(KVM_REQ_UNHALT, &vcpu->requests); 1670 set_bit(KVM_REQ_UNHALT, &vcpu->requests);
1673 break; 1671 break;
1674 } 1672 }