# HG changeset patch # User Alexander Kudryavtsev # Date 1320317996 -10800 # Node ID 6ab7effdd9919604054e9f7f790baf98bf7229b9 # Parent 2ac064c0cc7929f27cfc75a905624447c34ac91b imported patch no-palacios-eoi diff -r 2ac064c0cc79 -r 6ab7effdd991 arch/x86_64/kernel/interrupts.c --- a/arch/x86_64/kernel/interrupts.c Wed Aug 31 16:17:55 2011 +0400 +++ b/arch/x86_64/kernel/interrupts.c Thu Nov 03 13:59:56 2011 +0300 @@ -20,6 +20,7 @@ #include idtvec_handler_t idtvec_table[NUM_IDT_ENTRIES]; +static int idtvec_no_eoi[NUM_IDT_ENTRIES]; static DEFINE_SPINLOCK(idtvec_table_lock); extern void asm_idtvec_table(void); @@ -270,9 +271,15 @@ spin_lock_irqsave(&idtvec_table_lock, irqstate); idtvec_table[vector] = handler; + idtvec_no_eoi[vector] = 0; // by default, do EOI. spin_unlock_irqrestore(&idtvec_table_lock, irqstate); } +void set_idtvec_noeoi(unsigned int vector, int no_eoi) { + ASSERT(vector < NUM_IDT_ENTRIES); + + idtvec_no_eoi[vector] = no_eoi; +} /** C entry point for interrupts * Called by asm_interrupt to direct control to the handler @@ -293,7 +300,7 @@ return; #endif - if (vector >= FIRST_EXTERNAL_VECTOR) + if (vector >= FIRST_EXTERNAL_VECTOR && !idtvec_no_eoi[vector]) lapic_ack_interrupt(); } diff -r 2ac064c0cc79 -r 6ab7effdd991 arch/x86_64/kernel/palacios/palacios.c --- a/arch/x86_64/kernel/palacios/palacios.c Wed Aug 31 16:17:55 2011 +0400 +++ b/arch/x86_64/kernel/palacios/palacios.c Thu Nov 03 13:59:56 2011 +0300 @@ -344,6 +344,8 @@ ioapic_set_trigger_for_vector(vector, ioapic_edge_sensitive); set_idtvec_handler(vector, palacios_dispatch_interrupt); + /* Do not EOI palacios owned interrupts. */ + set_idtvec_noeoi(vector, 1); return 0; } diff -r 2ac064c0cc79 -r 6ab7effdd991 include/arch-x86_64/proto.h --- a/include/arch-x86_64/proto.h Wed Aug 31 16:17:55 2011 +0400 +++ b/include/arch-x86_64/proto.h Thu Nov 03 13:59:56 2011 +0300 @@ -48,4 +48,12 @@ idtvec_handler_t handler //!< Callback function ); +/** Set vector to be not acked with EIO (required by Palacios). */ +extern void +set_idtvec_noeoi( + unsigned int vector, + int no_eoi +); + + #endif