diff options
author | Christoffer Dall <c.dall@virtualopensystems.com> | 2012-03-08 16:44:24 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-04-08 05:47:47 -0400 |
commit | b6d33834bd4e8bdf4a199812e31b3e36da53c794 (patch) | |
tree | 3360ac4b5fa572e3acb21ecdc686c6d941baa2fc /arch/x86/kvm/x86.c | |
parent | 66ef89315f121cda9bf5b65a4ef02ad1b4fb16d9 (diff) |
KVM: Factor out kvm_vcpu_kick to arch-generic code
The kvm_vcpu_kick function performs roughly the same funcitonality on
most all architectures, so we shouldn't have separate copies.
PowerPC keeps a pointer to interchanging waitqueues on the vcpu_arch
structure and to accomodate this special need a
__KVM_HAVE_ARCH_VCPU_GET_WQ define and accompanying function
kvm_arch_vcpu_wq have been defined. For all other architectures this
is a generic inline that just returns &vcpu->wq;
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4044ce0bf7c1..511031dcb9cc 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -6403,21 +6403,9 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) | |||
6403 | kvm_cpu_has_interrupt(vcpu)); | 6403 | kvm_cpu_has_interrupt(vcpu)); |
6404 | } | 6404 | } |
6405 | 6405 | ||
6406 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu) | 6406 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) |
6407 | { | 6407 | { |
6408 | int me; | 6408 | return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE; |
6409 | int cpu = vcpu->cpu; | ||
6410 | |||
6411 | if (waitqueue_active(&vcpu->wq)) { | ||
6412 | wake_up_interruptible(&vcpu->wq); | ||
6413 | ++vcpu->stat.halt_wakeup; | ||
6414 | } | ||
6415 | |||
6416 | me = get_cpu(); | ||
6417 | if (cpu != me && (unsigned)cpu < nr_cpu_ids && cpu_online(cpu)) | ||
6418 | if (kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE) | ||
6419 | smp_send_reschedule(cpu); | ||
6420 | put_cpu(); | ||
6421 | } | 6409 | } |
6422 | 6410 | ||
6423 | int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu) | 6411 | int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu) |