From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxbMi-0004xb-Q7 for qemu-devel@nongnu.org; Sun, 28 Aug 2011 05:09:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QxbMh-0005L8-EJ for qemu-devel@nongnu.org; Sun, 28 Aug 2011 05:09:16 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:34659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxbMh-0005KZ-3j for qemu-devel@nongnu.org; Sun, 28 Aug 2011 05:09:15 -0400 Message-ID: <4E5A05A7.9030708@web.de> Date: Sun, 28 Aug 2011 11:08:55 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4E58FC3F.6080809@web.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig394596B5C3C55D98CC0725B4" Sender: jan.kiszka@web.de Subject: Re: [Qemu-devel] [PATCH] pc: Clean up PIC-to-APIC IRQ path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Lucas Meneghel Rodrigues , Anthony Liguori , Marcelo Tosatti , qemu-devel , Gerd Hoffmann , Avi Kivity This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig394596B5C3C55D98CC0725B4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2011-08-28 09:10, Blue Swirl wrote: > On Sat, Aug 27, 2011 at 2:16 PM, Jan Kiszka wrote: >> From: Jan Kiszka >> >> The master PIC is connected to the LINTIN0 of the APICs. As the APIC >> currently does not track the state of that line, we have to ask the PI= C >> to re-inject its IRQ after the CPU picked up an event from the APIC. >> >> Adds the proper state tracking so that we can already re-assert the CP= U >> IRQ at APIC level if there is a pending PIC IRQ. This allows to remove= >> all the old workarounds. >> >> The patch also fixes some failures of the kvm unit tests apic and >> eventinj by enabling a proper CPU IRQ deassert when the guest masks so= me >> pending IRQs at PIC level. >> >> Signed-off-by: Jan Kiszka >> --- >> >> It turned out that this patch from a larger cleanup series has no >> dependencies and can be applied directly to master to fix the observed= >> bug. >> >> hw/apic.c | 4 +++- >> hw/i8259.c | 10 ++-------- >> hw/pc.c | 3 --- >> hw/pc.h | 1 - >> 4 files changed, 5 insertions(+), 13 deletions(-) >> >> diff --git a/hw/apic.c b/hw/apic.c >> index d8f56c8..22ad635 100644 >> --- a/hw/apic.c >> +++ b/hw/apic.c >> @@ -104,6 +104,7 @@ struct APICState { >> QEMUTimer *timer; >> int sipi_vector; >> int wait_for_sipi; >> + int pic_level; >> }; >> >> static APICState *local_apics[MAX_APICS + 1]; >> @@ -186,6 +187,7 @@ void apic_deliver_pic_intr(DeviceState *d, int lev= el) >> { >> APICState *s =3D DO_UPCAST(APICState, busdev.qdev, d); >> >> + s->pic_level =3D level; >> if (level) { >> apic_local_deliver(s, APIC_LVT_LINT0); >> } else { >> @@ -397,7 +399,7 @@ static void apic_update_irq(APICState *s) >> if (!(s->spurious_vec & APIC_SV_ENABLE)) { >> return; >> } >> - if (apic_irq_pending(s) > 0) { >> + if (apic_irq_pending(s) > 0 || s->pic_level) { >> cpu_interrupt(s->cpu_env, CPU_INTERRUPT_HARD); >> } >> } >> diff --git a/hw/i8259.c b/hw/i8259.c >> index c0b96ab..cc6f76b 100644 >> --- a/hw/i8259.c >> +++ b/hw/i8259.c >> @@ -144,8 +144,7 @@ static int pic_get_irq(PicState *s) >> >> /* raise irq to CPU if necessary. must be called every time the activ= e >> irq may change */ >> -/* XXX: should not export it, but it is needed for an APIC kludge */ >> -void pic_update_irq(PicState2 *s) >> +static void pic_update_irq(PicState2 *s) >> { >> int irq2, irq; >> >> @@ -172,14 +171,9 @@ void pic_update_irq(PicState2 *s) >> printf("pic: cpu_interrupt\n"); >> #endif >> qemu_irq_raise(s->parent_irq); >> - } >> - >> -/* all targets should do this rather than acking the IRQ in the cpu *= / >> -#if defined(TARGET_MIPS) || defined(TARGET_PPC) || defined(TARGET_ALP= HA) >> - else { >> + } else { >=20 > Nice cleanup, this was pretty ugly. >=20 > Isn't it possible to compile the device in hwlib now? That should save > about 11 compiles for the full build since it is used by many targets. Not yet, but at the end of my queue (pic_info has to be refactored first)= =2E Jan --------------enig394596B5C3C55D98CC0725B4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5aBa4ACgkQitSsb3rl5xRW9wCffbjzVj8kqEAeKPMRuwLYMCaf TWoAoL+PX/9gu/xxExKJ7k5U0hNhaOgX =FyF6 -----END PGP SIGNATURE----- --------------enig394596B5C3C55D98CC0725B4--