]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86: eoi micro-optimization
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 18 Apr 2012 09:57:10 +0000 (12:57 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 18 Apr 2012 20:00:07 +0000 (23:00 +0300)
We know both register and value for eoi beforehand,
so there's no need to check it and no need to do math
to calculate the msr. Saves instructions/branches
on each EOI when using x2apic.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/x2apic_cluster.c
arch/x86/kernel/apic/x2apic_phys.c
arch/x86/kernel/apic/x2apic_uv_x.c

index 74efb8df8d7cf4dc09a5319349f15446e49d2fc3..5eb6d56ab34e1cb2862b9e783a790d912ed332c4 100644 (file)
@@ -138,6 +138,11 @@ static inline void native_apic_msr_write(u32 reg, u32 v)
        wrmsr(APIC_BASE_MSR + (reg >> 4), v, 0);
 }
 
+static inline void native_apic_msr_eoi_write(u32 reg, u32 v)
+{
+       wrmsr(APIC_BASE_MSR + (APIC_EOI >> 4), APIC_EOI_ACK, 0);
+}
+
 static inline u32 native_apic_msr_read(u32 reg)
 {
        u64 msr;
index a5baa785a25136075509347bc2bc9983b668eac8..ff35cff0e1a7e6f4f16b628504c821c5e544bacf 100644 (file)
@@ -260,7 +260,7 @@ static struct apic apic_x2apic_cluster = {
 
        .read                           = native_apic_msr_read,
        .write                          = native_apic_msr_write,
-       .eoi_write                      = native_apic_msr_write,
+       .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
        .wait_icr_idle                  = native_x2apic_wait_icr_idle,
index aac165b9f1b744b64d32729bb8951ca6b0214576..06a08128d33d9d7bca1dd192626b7eadbdf7c88c 100644 (file)
@@ -166,7 +166,7 @@ static struct apic apic_x2apic_phys = {
 
        .read                           = native_apic_msr_read,
        .write                          = native_apic_msr_write,
-       .eoi_write                      = native_apic_msr_write,
+       .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
        .wait_icr_idle                  = native_x2apic_wait_icr_idle,
index 5b0e3d0a3d2d3d826755ec4654f296914bdd7b58..c6d03f7a4401324444d33c0adf201ec13fbb7aea 100644 (file)
@@ -404,7 +404,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
 
        .read                           = native_apic_msr_read,
        .write                          = native_apic_msr_write,
-       .eoi_write                      = native_apic_msr_write,
+       .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
        .wait_icr_idle                  = native_x2apic_wait_icr_idle,