aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-09 08:56:26 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:51 -0400
commitc5af89b68abb26eea5e745f33228f4d672f115e5 (patch)
treeaad12571ebedea7b869adbeec27e614c498715f4 /arch/x86/kvm/x86.c
parentd555c333aa544b222fe077adcd5dfea024b2c913 (diff)
KVM: Introduce kvm_vcpu_is_bsp() function.
Use it instead of open code "vcpu_id zero is BSP" assumption. Signed-off-by: Gleb Natapov <gleb@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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e877efa37620..d8adc1da76dd 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4330,7 +4330,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
4330 kvm_set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR); 4330 kvm_set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
4331 4331
4332 /* Older userspace won't unhalt the vcpu on reset. */ 4332 /* Older userspace won't unhalt the vcpu on reset. */
4333 if (vcpu->vcpu_id == 0 && kvm_rip_read(vcpu) == 0xfff0 && 4333 if (kvm_vcpu_is_bsp(vcpu) && kvm_rip_read(vcpu) == 0xfff0 &&
4334 sregs->cs.selector == 0xf000 && sregs->cs.base == 0xffff0000 && 4334 sregs->cs.selector == 0xf000 && sregs->cs.base == 0xffff0000 &&
4335 !(vcpu->arch.cr0 & X86_CR0_PE)) 4335 !(vcpu->arch.cr0 & X86_CR0_PE))
4336 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 4336 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
@@ -4601,7 +4601,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
4601 kvm = vcpu->kvm; 4601 kvm = vcpu->kvm;
4602 4602
4603 vcpu->arch.mmu.root_hpa = INVALID_PAGE; 4603 vcpu->arch.mmu.root_hpa = INVALID_PAGE;
4604 if (!irqchip_in_kernel(kvm) || vcpu->vcpu_id == 0) 4604 if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu))
4605 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 4605 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
4606 else 4606 else
4607 vcpu->arch.mp_state = KVM_MP_STATE_UNINITIALIZED; 4607 vcpu->arch.mp_state = KVM_MP_STATE_UNINITIALIZED;