diff mbox

fix apic id reading in x2apic mode

Message ID 20090825133916.GD30093@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gleb Natapov Aug. 25, 2009, 1:39 p.m. UTC
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@redhat.com>
--
			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

Comments

Avi Kivity Aug. 26, 2009, 9:46 a.m. UTC | #1
On 08/25/2009 04:39 PM, Gleb Natapov wrote:
> Format of apic id register is different in x2apic mode.
> Return correct apic id when apic is in x2apic mode.
>
>    

Applied, thanks.
diff mbox

Patch

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");