KVM: apic: fix LDR calculation in x2apic mode
authorGleb Natapov <gleb@redhat.com>
Sun, 14 Oct 2012 11:08:58 +0000 (13:08 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 22 Oct 2012 16:03:27 +0000 (18:03 +0200)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Reviewed-by: Chegu Vinod <chegu_vinod@hp.com>
Tested-by: Chegu Vinod <chegu_vinod@hp.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/lapic.c

index c6e6b72..43e9fad 100644 (file)
@@ -1311,7 +1311,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
        vcpu->arch.apic_base = value;
        if (apic_x2apic_mode(apic)) {
                u32 id = kvm_apic_id(apic);
-               u32 ldr = ((id & ~0xf) << 16) | (1 << (id & 0xf));
+               u32 ldr = ((id >> 4) << 16) | (1 << (id & 0xf));
                kvm_apic_set_ldr(apic, ldr);
        }
        apic->base_address = apic->vcpu->arch.apic_base &