]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: apic: fix LDR calculation in x2apic mode
authorGleb Natapov <gleb@redhat.com>
Sun, 14 Oct 2012 11:08:58 +0000 (13:08 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 3 Mar 2018 15:50:39 +0000 (15:50 +0000)
commit 7f46ddbd487e0d0528d89534fdfb31d885977804 upstream.

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>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/kvm/lapic.c

index 055cc49ffb100630de5c843cc11b70052da377a6..264b15352dae8cfccaf7d5e9cc4313942938e979 100644 (file)
@@ -1022,7 +1022,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));
                apic_set_reg(apic, APIC_LDR, ldr);
        }
        apic->base_address = apic->vcpu->arch.apic_base &