aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2013-12-28 20:29:30 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2013-12-30 15:58:17 -0500
commite66d2ae7c67bd9ac982a3d1890564de7f7eabf4b (patch)
tree5d507fbd9a8412f053fb58e812a0366830d5cf1e /arch/x86
parentf41bfc9423aac4e589d2b3bedf26b3c249c61146 (diff)
KVM: x86: Fix APIC map calculation after re-enabling
Update arch.apic_base before triggering recalculate_apic_map. Otherwise the recalculation will work against the previous state of the APIC and will fail to build the correct map when an APIC is hardware-enabled again. This fixes a regression of 1e08ec4a13. Cc: stable@vger.kernel.org Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/lapic.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index dec48bfaddb8..1673940cf9c3 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1350,6 +1350,10 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
1350 return; 1350 return;
1351 } 1351 }
1352 1352
1353 if (!kvm_vcpu_is_bsp(apic->vcpu))
1354 value &= ~MSR_IA32_APICBASE_BSP;
1355 vcpu->arch.apic_base = value;
1356
1353 /* update jump label if enable bit changes */ 1357 /* update jump label if enable bit changes */
1354 if ((vcpu->arch.apic_base ^ value) & MSR_IA32_APICBASE_ENABLE) { 1358 if ((vcpu->arch.apic_base ^ value) & MSR_IA32_APICBASE_ENABLE) {
1355 if (value & MSR_IA32_APICBASE_ENABLE) 1359 if (value & MSR_IA32_APICBASE_ENABLE)
@@ -1359,10 +1363,6 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
1359 recalculate_apic_map(vcpu->kvm); 1363 recalculate_apic_map(vcpu->kvm);
1360 } 1364 }
1361 1365
1362 if (!kvm_vcpu_is_bsp(apic->vcpu))
1363 value &= ~MSR_IA32_APICBASE_BSP;
1364
1365 vcpu->arch.apic_base = value;
1366 if ((old_value ^ value) & X2APIC_ENABLE) { 1366 if ((old_value ^ value) & X2APIC_ENABLE) {
1367 if (value & X2APIC_ENABLE) { 1367 if (value & X2APIC_ENABLE) {
1368 u32 id = kvm_apic_id(apic); 1368 u32 id = kvm_apic_id(apic);