aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/apic.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-05-16 12:03:52 -0400
committerIngo Molnar <mingo@kernel.org>2012-05-18 03:46:08 -0400
commit2a43195d831997551da93e6b3c22c965e93fe9cc (patch)
treeb7ad184a43adb4018aab793efda8524b5ba5e280 /arch/x86/include/asm/apic.h
parent4ebcc243901c48ee3baba6bdf179c7315fa8806f (diff)
x86/apic: Add apic->eoi_write() callback
Add eoi_write callback so that kvm can override eoi accesses without touching the rest of the apic. As a side-effect, this will enable a micro-optimization for apics using msr. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Cc: Avi Kivity <avi@redhat.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: gleb@redhat.com Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/0df425d746c49ac2ecc405174df87752869629d2.1337184153.git.mst@redhat.com [ tidied it up a bit ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/apic.h')
-rw-r--r--arch/x86/include/asm/apic.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index a09e9ab0bbdf..bf8d065dd977 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -351,6 +351,14 @@ struct apic {
351 /* apic ops */ 351 /* apic ops */
352 u32 (*read)(u32 reg); 352 u32 (*read)(u32 reg);
353 void (*write)(u32 reg, u32 v); 353 void (*write)(u32 reg, u32 v);
354 /*
355 * ->eoi_write() has the same signature as ->write().
356 *
357 * Drivers can support both ->eoi_write() and ->write() by passing the same
358 * callback value. Kernel can override ->eoi_write() and fall back
359 * on write for EOI.
360 */
361 void (*eoi_write)(u32 reg, u32 v);
354 u64 (*icr_read)(void); 362 u64 (*icr_read)(void);
355 void (*icr_write)(u32 low, u32 high); 363 void (*icr_write)(u32 low, u32 high);
356 void (*wait_icr_idle)(void); 364 void (*wait_icr_idle)(void);
@@ -426,6 +434,11 @@ static inline void apic_write(u32 reg, u32 val)
426 apic->write(reg, val); 434 apic->write(reg, val);
427} 435}
428 436
437static inline void apic_eoi(void)
438{
439 apic->eoi_write(APIC_EOI, APIC_EOI_ACK);
440}
441
429static inline u64 apic_icr_read(void) 442static inline u64 apic_icr_read(void)
430{ 443{
431 return apic->icr_read(); 444 return apic->icr_read();
@@ -450,6 +463,7 @@ static inline u32 safe_apic_wait_icr_idle(void)
450 463
451static inline u32 apic_read(u32 reg) { return 0; } 464static inline u32 apic_read(u32 reg) { return 0; }
452static inline void apic_write(u32 reg, u32 val) { } 465static inline void apic_write(u32 reg, u32 val) { }
466static inline void apic_eoi(void) { }
453static inline u64 apic_icr_read(void) { return 0; } 467static inline u64 apic_icr_read(void) { return 0; }
454static inline void apic_icr_write(u32 low, u32 high) { } 468static inline void apic_icr_write(u32 low, u32 high) { }
455static inline void apic_wait_icr_idle(void) { } 469static inline void apic_wait_icr_idle(void) { }
@@ -463,7 +477,7 @@ static inline void ack_APIC_irq(void)
463 * ack_APIC_irq() actually gets compiled as a single instruction 477 * ack_APIC_irq() actually gets compiled as a single instruction
464 * ... yummie. 478 * ... yummie.
465 */ 479 */
466 apic_write(APIC_EOI, APIC_EOI_ACK); 480 apic_eoi();
467} 481}
468 482
469static inline unsigned default_get_apic_id(unsigned long x) 483static inline unsigned default_get_apic_id(unsigned long x)