From 7f46ddbd487e0d0528d89534fdfb31d885977804 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Sun, 14 Oct 2012 13:08:58 +0200 Subject: [PATCH] KVM: apic: fix LDR calculation in x2apic mode Signed-off-by: Gleb Natapov Reviewed-by: Chegu Vinod Tested-by: Chegu Vinod Signed-off-by: Avi Kivity --- arch/x86/kvm/lapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index c6e6b721b6ee..43e9fadca5d0 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -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 & -- 2.39.5