KVM: Portability: Create kvm_arch_vcpu_runnable() function
authorHollis Blanchard <hollisb@us.ibm.com>
Mon, 3 Dec 2007 22:15:26 +0000 (16:15 -0600)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:53:17 +0000 (17:53 +0200)
This abstracts the detail of x86 hlt and INIT modes into a function.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm_main.c
drivers/kvm/x86.h

index 0f11046b94fa5a964e1409d61e178b8924a0684d..70664f020849bfcc3a674530d73a314124361c68 100644 (file)
@@ -643,8 +643,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
         */
        while (!kvm_cpu_has_interrupt(vcpu)
               && !signal_pending(current)
-              && vcpu->mp_state != VCPU_MP_STATE_RUNNABLE
-              && vcpu->mp_state != VCPU_MP_STATE_SIPI_RECEIVED) {
+              && !kvm_arch_vcpu_runnable(vcpu)) {
                set_current_state(TASK_INTERRUPTIBLE);
                vcpu_put(vcpu);
                schedule();
index 4b7acc76bb345915a569043da6aafd96a92e4950..eed796402e3b94a8b21761db0abda0f2827e9c12 100644 (file)
@@ -471,4 +471,11 @@ static inline u32 get_rdx_init_val(void)
 #define TSS_IOPB_SIZE (65536 / 8)
 #define TSS_REDIRECTION_SIZE (256 / 8)
 #define RMODE_TSS_SIZE (TSS_BASE_SIZE + TSS_REDIRECTION_SIZE + TSS_IOPB_SIZE + 1)
+
+static inline int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
+{
+       return vcpu->mp_state == VCPU_MP_STATE_RUNNABLE
+              || vcpu->mp_state == VCPU_MP_STATE_SIPI_RECEIVED;
+}
+
 #endif