From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KW0dU-00071j-9F for qemu-devel@nongnu.org; Wed, 20 Aug 2008 23:14:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KW0dT-00071R-Pv for qemu-devel@nongnu.org; Wed, 20 Aug 2008 23:14:55 -0400 Received: from [199.232.76.173] (port=37194 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KW0dT-00071M-I8 for qemu-devel@nongnu.org; Wed, 20 Aug 2008 23:14:55 -0400 Received: from savannah.gnu.org ([199.232.41.3]:42414 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KW0dT-0004Io-2B for qemu-devel@nongnu.org; Wed, 20 Aug 2008 23:14:55 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KW0dR-0004tb-0v for qemu-devel@nongnu.org; Thu, 21 Aug 2008 03:14:53 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KW0dQ-0004tX-PI for qemu-devel@nongnu.org; Thu, 21 Aug 2008 03:14:52 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Thu, 21 Aug 2008 03:14:52 +0000 Subject: [Qemu-devel] [5041] De-assert PIC IRQs properly at APIC level Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5041 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5041 Author: aurel32 Date: 2008-08-21 03:14:52 +0000 (Thu, 21 Aug 2008) Log Message: ----------- De-assert PIC IRQs properly at APIC level [ Taking latest isapc changes into account. ] Ensure that PIC-delivered IRQs are properly de-asserted in case the APIC is in EXTINT or FIXED mode (with level-triggering selected) on LINT0. Fixes EFI-BIOS boot issues. This patch also cleans up a bit the interface between PIC and APIC, making apic_local_deliver private again. Signed-off-by: Jan Kiszka Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/hw/apic.c trunk/hw/pc.c trunk/hw/pc.h Modified: trunk/hw/apic.c =================================================================== --- trunk/hw/apic.c 2008-08-21 03:14:41 UTC (rev 5040) +++ trunk/hw/apic.c 2008-08-21 03:14:52 UTC (rev 5041) @@ -166,7 +166,7 @@ tab[i] &= ~mask; } -void apic_local_deliver(CPUState *env, int vector) +static void apic_local_deliver(CPUState *env, int vector) { APICState *s = env->apic_state; uint32_t lvt = s->lvt[vector]; @@ -197,6 +197,27 @@ } } +void apic_deliver_pic_intr(CPUState *env, int level) +{ + if (level) + apic_local_deliver(env, APIC_LVT_LINT0); + else { + APICState *s = env->apic_state; + uint32_t lvt = s->lvt[APIC_LVT_LINT0]; + + switch ((lvt >> 8) & 7) { + case APIC_DM_FIXED: + if (!(lvt & APIC_LVT_LEVEL_TRIGGER)) + break; + reset_bit(s->irr, lvt & 0xff); + /* fall through */ + case APIC_DM_EXTINT: + cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); + break; + } + } +} + #define foreach_apic(apic, deliver_bitmask, code) \ {\ int __i, __j, __mask;\ Modified: trunk/hw/pc.c =================================================================== --- trunk/hw/pc.c 2008-08-21 03:14:41 UTC (rev 5040) +++ trunk/hw/pc.c 2008-08-21 03:14:52 UTC (rev 5041) @@ -119,11 +119,9 @@ CPUState *env = first_cpu; if (env->apic_state) { - if (!level) - return; while (env) { if (apic_accept_pic_intr(env)) - apic_local_deliver(env, APIC_LINT0); + apic_deliver_pic_intr(env, level); env = env->next_cpu; } } else { Modified: trunk/hw/pc.h =================================================================== --- trunk/hw/pc.h 2008-08-21 03:14:41 UTC (rev 5040) +++ trunk/hw/pc.h 2008-08-21 03:14:52 UTC (rev 5041) @@ -40,11 +40,9 @@ /* APIC */ typedef struct IOAPICState IOAPICState; -#define APIC_LINT0 3 - int apic_init(CPUState *env); int apic_accept_pic_intr(CPUState *env); -void apic_local_deliver(CPUState *env, int vector); +void apic_deliver_pic_intr(CPUState *env, int level); int apic_get_interrupt(CPUState *env); IOAPICState *ioapic_init(void); void ioapic_set_irq(void *opaque, int vector, int level);