diff options
-rw-r--r-- | arch/x86/kvm/irq.c | 20 | ||||
-rw-r--r-- | arch/x86/kvm/irq.h | 2 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 20 | ||||
-rw-r--r-- | include/linux/kvm_host.h | 1 |
4 files changed, 21 insertions, 22 deletions
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c index 07a09aad4fd6..e5714759e97f 100644 --- a/arch/x86/kvm/irq.c +++ b/arch/x86/kvm/irq.c | |||
@@ -63,26 +63,6 @@ int kvm_cpu_get_interrupt(struct kvm_vcpu *v) | |||
63 | } | 63 | } |
64 | EXPORT_SYMBOL_GPL(kvm_cpu_get_interrupt); | 64 | EXPORT_SYMBOL_GPL(kvm_cpu_get_interrupt); |
65 | 65 | ||
66 | static void vcpu_kick_intr(void *info) | ||
67 | { | ||
68 | #ifdef DEBUG | ||
69 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *)info; | ||
70 | printk(KERN_DEBUG "vcpu_kick_intr %p \n", vcpu); | ||
71 | #endif | ||
72 | } | ||
73 | |||
74 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu) | ||
75 | { | ||
76 | int ipi_pcpu = vcpu->cpu; | ||
77 | |||
78 | if (waitqueue_active(&vcpu->wq)) { | ||
79 | wake_up_interruptible(&vcpu->wq); | ||
80 | ++vcpu->stat.halt_wakeup; | ||
81 | } | ||
82 | if (vcpu->guest_mode) | ||
83 | smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0, 0); | ||
84 | } | ||
85 | |||
86 | void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu) | 66 | void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu) |
87 | { | 67 | { |
88 | kvm_inject_apic_timer_irqs(vcpu); | 68 | kvm_inject_apic_timer_irqs(vcpu); |
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h index c376b5b41bba..53c7f48254be 100644 --- a/arch/x86/kvm/irq.h +++ b/arch/x86/kvm/irq.h | |||
@@ -85,6 +85,4 @@ void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); | |||
85 | void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); | 85 | void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); |
86 | void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu); | 86 | void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu); |
87 | 87 | ||
88 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); | ||
89 | |||
90 | #endif | 88 | #endif |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 5902c5cbc1bb..733bff65d9a9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3144,3 +3144,23 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) | |||
3144 | return vcpu->arch.mp_state == VCPU_MP_STATE_RUNNABLE | 3144 | return vcpu->arch.mp_state == VCPU_MP_STATE_RUNNABLE |
3145 | || vcpu->arch.mp_state == VCPU_MP_STATE_SIPI_RECEIVED; | 3145 | || vcpu->arch.mp_state == VCPU_MP_STATE_SIPI_RECEIVED; |
3146 | } | 3146 | } |
3147 | |||
3148 | static void vcpu_kick_intr(void *info) | ||
3149 | { | ||
3150 | #ifdef DEBUG | ||
3151 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *)info; | ||
3152 | printk(KERN_DEBUG "vcpu_kick_intr %p \n", vcpu); | ||
3153 | #endif | ||
3154 | } | ||
3155 | |||
3156 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu) | ||
3157 | { | ||
3158 | int ipi_pcpu = vcpu->cpu; | ||
3159 | |||
3160 | if (waitqueue_active(&vcpu->wq)) { | ||
3161 | wake_up_interruptible(&vcpu->wq); | ||
3162 | ++vcpu->stat.halt_wakeup; | ||
3163 | } | ||
3164 | if (vcpu->guest_mode) | ||
3165 | smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0, 0); | ||
3166 | } | ||
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index a85d5b6943de..953b50aa0e61 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -250,6 +250,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm); | |||
250 | 250 | ||
251 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 251 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
252 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | 252 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); |
253 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); | ||
253 | 254 | ||
254 | static inline void kvm_guest_enter(void) | 255 | static inline void kvm_guest_enter(void) |
255 | { | 256 | { |