From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: [PATCH] fix apic id reading in x2apic mode Date: Tue, 25 Aug 2009 16:39:17 +0300 Message-ID: <20090825133916.GD30093@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: avi@redhat.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:7690 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752808AbZHYNjR (ORCPT ); Tue, 25 Aug 2009 09:39:17 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7PDdJP1021835 for ; Tue, 25 Aug 2009 09:39:19 -0400 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: Format of apic id register is different in x2apic mode. Return correct apic id when apic is in x2apic mode. Signed-off-by: Gleb Natapov diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index e41e948..bd3a402 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -551,6 +551,12 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset) return 0; switch (offset) { + case APIC_ID: + if (apic_x2apic_mode(apic)) + val = kvm_apic_id(apic); + else + val = kvm_apic_id(apic) << 24; + break; case APIC_ARBPRI: printk(KERN_WARNING "Access APIC ARBPRI register " "which is for P6\n"); -- Gleb.