From patchwork Tue Aug 25 13:39:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 43756 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7PDdVoe031155 for ; Tue, 25 Aug 2009 13:39:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753222AbZHYNjR (ORCPT ); Tue, 25 Aug 2009 09:39:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753149AbZHYNjR (ORCPT ); Tue, 25 Aug 2009 09:39:17 -0400 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 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7PDdHxJ004487; Tue, 25 Aug 2009 09:39:18 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 1D6DF18D467; Tue, 25 Aug 2009 16:39:17 +0300 (IDT) Date: Tue, 25 Aug 2009 16:39:17 +0300 From: Gleb Natapov To: avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH] fix apic id reading in x2apic mode Message-ID: <20090825133916.GD30093@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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");