]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
x86: Ignore writes to the xAPIC ID register
authorJan Kiszka <jan.kiszka@siemens.com>
Sat, 2 May 2015 10:40:05 +0000 (12:40 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 22 May 2015 04:55:21 +0000 (06:55 +0200)
Writing to the APIC ID register is legal in xAPIC mode but is ignored by
recent CPU models. Linux performs a write on boot-up, e.g., and ignoring
this is both cheap and helpful to keep para-virtualization needs low.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/x86/apic.c

index 7a23f5be3ee6187fd6293bb8c3ceba5c1e30b41b..d3b4211be61f95aee506c0608f382b5ef8e22215 100644 (file)
@@ -185,6 +185,7 @@ int apic_init(void)
                apic_ops.send_ipi = send_xapic_ipi;
 
                /* adjust reserved bits to xAPIC mode */
+               apic_reserved_bits[APIC_REG_ID] = 0;  /* writes are ignored */
                apic_reserved_bits[APIC_REG_LDR] = 0; /* separately filtered */
                apic_reserved_bits[APIC_REG_DFR] = 0; /* separately filtered */
                apic_reserved_bits[APIC_REG_ICR_HI] = 0x00ffffff;
@@ -518,7 +519,7 @@ unsigned int apic_mmio_access(unsigned long rip,
                else if (reg >= APIC_REG_XLVT0 && reg <= APIC_REG_XLVT3 &&
                         apic_invalid_lvt_delivery_mode(reg, val))
                        return 0;
-               else
+               else if (reg != APIC_REG_ID)
                        apic_ops.write(reg, val);
        } else {
                val = apic_ops.read(reg);