kvm: x86: fix apic_base enable check
authorAndrew Jones <drjones@redhat.com>
Wed, 15 Jan 2014 12:39:59 +0000 (13:39 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 15 Jan 2014 12:42:14 +0000 (13:42 +0100)
Commit e66d2ae7c67bd moved the assignment
vcpu->arch.apic_base = value above a condition with
(vcpu->arch.apic_base ^ value), causing that check
to always fail. Use old_value, vcpu->arch.apic_base's
old value, in the condition instead.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/lapic.c

index 1673940cf9c35169d808a71ef31c031d5c8a390d..775702f649ca686ff7a1dcf467c5325b8a3e9c3c 100644 (file)
@@ -1355,7 +1355,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
        vcpu->arch.apic_base = value;
 
        /* update jump label if enable bit changes */
-       if ((vcpu->arch.apic_base ^ value) & MSR_IA32_APICBASE_ENABLE) {
+       if ((old_value ^ value) & MSR_IA32_APICBASE_ENABLE) {
                if (value & MSR_IA32_APICBASE_ENABLE)
                        static_key_slow_dec_deferred(&apic_hw_disabled);
                else