aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorNadav Amit <namit@cs.technion.ac.il>2015-04-01 20:10:36 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2015-04-08 04:47:02 -0400
commit58d269d8cccc53643f1a0900cfc0940e85ec9691 (patch)
treed8154df29de173aa1efa6192077854b4084fccb5 /arch/x86/kvm
parent3b5a5ffa928a3f875b0d5dd284eeb7c322e1688a (diff)
KVM: x86: BSP in MSR_IA32_APICBASE is writable
After reset, the CPU can change the BSP, which will be used upon INIT. Reset should return the BSP which QEMU asked for, and therefore handled accordingly. To quote: "If the MP protocol has completed and a BSP is chosen, subsequent INITs (either to a specific processor or system wide) do not cause the MP protocol to be repeated." [Intel SDM 8.4.2: MP Initialization Protocol Requirements and Restrictions] Signed-off-by: Nadav Amit <namit@cs.technion.ac.il> Message-Id: <1427933438-12782-3-git-send-email-namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/lapic.c2
-rw-r--r--arch/x86/kvm/svm.c2
-rw-r--r--arch/x86/kvm/vmx.c2
-rw-r--r--arch/x86/kvm/x86.c2
4 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 11a0af113f27..4a6e58a967f7 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1523,8 +1523,6 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
1523 return; 1523 return;
1524 } 1524 }
1525 1525
1526 if (!kvm_vcpu_is_bsp(apic->vcpu))
1527 value &= ~MSR_IA32_APICBASE_BSP;
1528 vcpu->arch.apic_base = value; 1526 vcpu->arch.apic_base = value;
1529 1527
1530 /* update jump label if enable bit changes */ 1528 /* update jump label if enable bit changes */
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 155534c0f5e8..ce741b8650f6 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1261,7 +1261,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
1261 1261
1262 svm->vcpu.arch.apic_base = APIC_DEFAULT_PHYS_BASE | 1262 svm->vcpu.arch.apic_base = APIC_DEFAULT_PHYS_BASE |
1263 MSR_IA32_APICBASE_ENABLE; 1263 MSR_IA32_APICBASE_ENABLE;
1264 if (kvm_vcpu_is_bsp(&svm->vcpu)) 1264 if (kvm_vcpu_is_reset_bsp(&svm->vcpu))
1265 svm->vcpu.arch.apic_base |= MSR_IA32_APICBASE_BSP; 1265 svm->vcpu.arch.apic_base |= MSR_IA32_APICBASE_BSP;
1266 1266
1267 svm_init_osvw(&svm->vcpu); 1267 svm_init_osvw(&svm->vcpu);
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ddce07e8bef8..8c14d6a455b0 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4706,7 +4706,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4706 vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val(); 4706 vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val();
4707 kvm_set_cr8(&vmx->vcpu, 0); 4707 kvm_set_cr8(&vmx->vcpu, 0);
4708 apic_base_msr.data = APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE; 4708 apic_base_msr.data = APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE;
4709 if (kvm_vcpu_is_bsp(&vmx->vcpu)) 4709 if (kvm_vcpu_is_reset_bsp(&vmx->vcpu))
4710 apic_base_msr.data |= MSR_IA32_APICBASE_BSP; 4710 apic_base_msr.data |= MSR_IA32_APICBASE_BSP;
4711 apic_base_msr.host_initiated = true; 4711 apic_base_msr.host_initiated = true;
4712 kvm_set_apic_base(&vmx->vcpu, &apic_base_msr); 4712 kvm_set_apic_base(&vmx->vcpu, &apic_base_msr);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a578629acb42..f7a78c62ab87 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7269,7 +7269,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
7269 7269
7270 vcpu->arch.pv.pv_unhalted = false; 7270 vcpu->arch.pv.pv_unhalted = false;
7271 vcpu->arch.emulate_ctxt.ops = &emulate_ops; 7271 vcpu->arch.emulate_ctxt.ops = &emulate_ops;
7272 if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu)) 7272 if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_reset_bsp(vcpu))
7273 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 7273 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
7274 else 7274 else
7275 vcpu->arch.mp_state = KVM_MP_STATE_UNINITIALIZED; 7275 vcpu->arch.mp_state = KVM_MP_STATE_UNINITIALIZED;