From: Keir Fraser Subject: [PATCH][FIX] Possible fix for spurious interrupts Date: Thu, 13 Apr 2006 19:12:04 +0100 Message-ID: Mime-Version: 1.0 (Apple Message framework v623) Content-Type: multipart/mixed; boundary=Apple-Mail-2--858999921 Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Devel Cc: Michele , Jan Beulich List-Id: xen-devel@lists.xenproject.org --Apple-Mail-2--858999921 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Here is a patch that appears to fix the spurious interrupt problems for me. This is inspired by Jan's observation that the IO-APIC mask/unmask that we do for ISR processing seems to cause corruption of other routing entries. So the fix here is to do the same as native Linux -- do not mask/unmask, but instead send EOI after doing ISR processing. To confirm this really was the problem I modified native Linux to do the same as Xen currently does (mask before ISR processing; unmask after). I then got lots of spurious USB interrupts even on native Linux! :-( Please test... I'll put it in xen-unstable tomorrow if there are no complaints and it will be a strong candidate for the next 3.0.2 release too. -- Keir --Apple-Mail-2--858999921 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="ioapic.patch" Content-Disposition: attachment; filename=ioapic.patch diff -r e7d769001b4b xen/arch/x86/io_apic.c --- a/xen/arch/x86/io_apic.c Thu Apr 13 16:21:13 2006 +++ b/xen/arch/x86/io_apic.c Thu Apr 13 19:03:18 2006 @@ -190,16 +190,16 @@ __modify_IO_APIC_irq(irq, 0, 0x00010000); } -/* trigger = 0 */ -static void __edge_IO_APIC_irq (unsigned int irq) -{ - __modify_IO_APIC_irq(irq, 0, 0x00008000); -} - -/* trigger = 1 */ -static void __level_IO_APIC_irq (unsigned int irq) -{ - __modify_IO_APIC_irq(irq, 0x00008000, 0); +/* mask = 1, trigger = 0 */ +static void __mask_and_edge_IO_APIC_irq (unsigned int irq) +{ + __modify_IO_APIC_irq(irq, 0x00010000, 0x00008000); +} + +/* mask = 0, trigger = 1 */ +static void __unmask_and_level_IO_APIC_irq (unsigned int irq) +{ + __modify_IO_APIC_irq(irq, 0x00008000, 0x00010000); } static void mask_IO_APIC_irq (unsigned int irq) @@ -1323,10 +1323,13 @@ static void mask_and_ack_level_ioapic_irq (unsigned int irq) { +} + +static void end_level_ioapic_irq (unsigned int irq) +{ unsigned long v; int i; - mask_IO_APIC_irq(irq); /* * It appears there is an erratum which affects at least version 0x11 * of I/O APIC (that's the 82093AA and cores integrated into various @@ -1355,15 +1358,10 @@ if (!(v & (1 << (i & 0x1f)))) { atomic_inc(&irq_mis_count); spin_lock(&ioapic_lock); - __edge_IO_APIC_irq(irq); - __level_IO_APIC_irq(irq); + __mask_and_edge_IO_APIC_irq(irq); + __unmask_and_level_IO_APIC_irq(irq); spin_unlock(&ioapic_lock); } -} - -static void end_level_ioapic_irq (unsigned int irq) -{ - unmask_IO_APIC_irq(irq); } static unsigned int startup_edge_ioapic_vector(unsigned int vector) --Apple-Mail-2--858999921 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Apple-Mail-2--858999921--