From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KW0eE-0007ZP-PO for qemu-devel@nongnu.org; Wed, 20 Aug 2008 23:15:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KW0eE-0007Yk-AB for qemu-devel@nongnu.org; Wed, 20 Aug 2008 23:15:42 -0400 Received: from [199.232.76.173] (port=37201 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KW0eD-0007Yc-Ru for qemu-devel@nongnu.org; Wed, 20 Aug 2008 23:15:41 -0400 Received: from hall.aurel32.net ([91.121.138.14]:57034) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KW0eB-0004PW-F0 for qemu-devel@nongnu.org; Wed, 20 Aug 2008 23:15:41 -0400 Received: from [88.128.94.200] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1KW0e7-0007dK-3F for qemu-devel@nongnu.org; Thu, 21 Aug 2008 05:15:35 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1KW0e0-0003da-FV for qemu-devel@nongnu.org; Thu, 21 Aug 2008 05:15:28 +0200 Date: Thu, 21 Aug 2008 05:15:28 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 2/2] De-assert PIC IRQs properly at APIC level Message-ID: <20080821031528.GI3371@volta.aurel32.net> References: <48A998AB.5080409@web.de> <48AC353A.3030109@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <48AC353A.3030109@siemens.com> 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 On Wed, Aug 20, 2008 at 05:16:10PM +0200, Jan Kiszka wrote: > [ Taking latest isapc changes into account. ] Applied, thanks. > 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 > --- > hw/apic.c | 23 ++++++++++++++++++++++- > hw/pc.c | 4 +--- > hw/pc.h | 4 +--- > 3 files changed, 24 insertions(+), 7 deletions(-) > > Index: b/hw/apic.c > =================================================================== > --- a/hw/apic.c > +++ b/hw/apic.c > @@ -166,7 +166,7 @@ static inline void reset_bit(uint32_t *t > 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_local_deliver(CPUState *env, i > } > } > > +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;\ > Index: b/hw/pc.c > =================================================================== > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -119,11 +119,9 @@ static void pic_irq_request(void *opaque > 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 { > Index: b/hw/pc.h > =================================================================== > --- a/hw/pc.h > +++ b/hw/pc.h > @@ -40,11 +40,9 @@ void irq_info(void); > /* 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); > > > -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net