From: Gleb Natapov <[email protected]>

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 <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index ce195f8..5b9d1ae 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -556,6 +556,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");
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to