diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-06-09 08:56:26 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:32:51 -0400 |
commit | c5af89b68abb26eea5e745f33228f4d672f115e5 (patch) | |
tree | aad12571ebedea7b869adbeec27e614c498715f4 /arch/x86/kvm/vmx.c | |
parent | d555c333aa544b222fe077adcd5dfea024b2c913 (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/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ae682929a642..c08bb4cf372e 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2411,7 +2411,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
2411 | vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val(); | 2411 | vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val(); |
2412 | kvm_set_cr8(&vmx->vcpu, 0); | 2412 | kvm_set_cr8(&vmx->vcpu, 0); |
2413 | msr = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; | 2413 | msr = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; |
2414 | if (vmx->vcpu.vcpu_id == 0) | 2414 | if (kvm_vcpu_is_bsp(&vmx->vcpu)) |
2415 | msr |= MSR_IA32_APICBASE_BSP; | 2415 | msr |= MSR_IA32_APICBASE_BSP; |
2416 | kvm_set_apic_base(&vmx->vcpu, msr); | 2416 | kvm_set_apic_base(&vmx->vcpu, msr); |
2417 | 2417 | ||
@@ -2422,7 +2422,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
2422 | * GUEST_CS_BASE should really be 0xffff0000, but VT vm86 mode | 2422 | * GUEST_CS_BASE should really be 0xffff0000, but VT vm86 mode |
2423 | * insists on having GUEST_CS_BASE == GUEST_CS_SELECTOR << 4. Sigh. | 2423 | * insists on having GUEST_CS_BASE == GUEST_CS_SELECTOR << 4. Sigh. |
2424 | */ | 2424 | */ |
2425 | if (vmx->vcpu.vcpu_id == 0) { | 2425 | if (kvm_vcpu_is_bsp(&vmx->vcpu)) { |
2426 | vmcs_write16(GUEST_CS_SELECTOR, 0xf000); | 2426 | vmcs_write16(GUEST_CS_SELECTOR, 0xf000); |
2427 | vmcs_writel(GUEST_CS_BASE, 0x000f0000); | 2427 | vmcs_writel(GUEST_CS_BASE, 0x000f0000); |
2428 | } else { | 2428 | } else { |
@@ -2451,7 +2451,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
2451 | vmcs_writel(GUEST_SYSENTER_EIP, 0); | 2451 | vmcs_writel(GUEST_SYSENTER_EIP, 0); |
2452 | 2452 | ||
2453 | vmcs_writel(GUEST_RFLAGS, 0x02); | 2453 | vmcs_writel(GUEST_RFLAGS, 0x02); |
2454 | if (vmx->vcpu.vcpu_id == 0) | 2454 | if (kvm_vcpu_is_bsp(&vmx->vcpu)) |
2455 | kvm_rip_write(vcpu, 0xfff0); | 2455 | kvm_rip_write(vcpu, 0xfff0); |
2456 | else | 2456 | else |
2457 | kvm_rip_write(vcpu, 0); | 2457 | kvm_rip_write(vcpu, 0); |