From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: [PATCH] KVM: apic: fix LDR calculation in x2apic mode Date: Sun, 14 Oct 2012 13:08:58 +0200 Message-ID: <20121014110858.GN16648@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Chegu Vinod , avi@redhat.com, mtosatti@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:63606 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752526Ab2JNLJC (ORCPT ); Sun, 14 Oct 2012 07:09:02 -0400 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Gleb Natapov diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index c6e6b72..43e9fad 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 & -- Gleb.