From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50408 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8Tga-0006e9-6l for qemu-devel@nongnu.org; Sat, 09 Apr 2011 04:41:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8TgU-0003oA-3E for qemu-devel@nongnu.org; Sat, 09 Apr 2011 04:38:23 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:56013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8TgT-0003nu-Oq for qemu-devel@nongnu.org; Sat, 09 Apr 2011 04:38:22 -0400 Message-ID: <4DA01AF2.3040309@web.de> Date: Sat, 09 Apr 2011 10:38:10 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <20110403195314.GB23034@volta.aurel32.net> <20110403234207.GD11748@valinux.co.jp> <20110404021511.GF11748@valinux.co.jp> In-Reply-To: <20110404021511.GF11748@valinux.co.jp> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigFEC0BABC4539EEB1A72EB48C" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH] ioapic: when switches to level trigger mode, interrupts raised repeatedly. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: qemu-devel@nongnu.org, Aurelien Jarno This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigFEC0BABC4539EEB1A72EB48C Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2011-04-04 04:15, Isaku Yamahata wrote: > On Mon, Apr 04, 2011 at 08:42:07AM +0900, Isaku Yamahata wrote: >> > Thank you for applying. But I found that the patch is wrong and >> > I'm preparing the new one. Can you please revert it? > Here is the corrected patch. The first wrong patch clears the interrupt= s > bit unconditionally. Which caused losing interrupt. >=20 > From 5ed177d35ab14f3b070a0eba2c49400279a3a14b Mon Sep 17 00:00:00 2001 > Message-Id: <5ed177d35ab14f3b070a0eba2c49400279a3a14b.1301883258.git.ya= mahata@valinux.co.jp> > In-Reply-To: > References: > From: Isaku Yamahata > Date: Wed, 16 Mar 2011 14:00:13 +0900 > Subject: [PATCH 01/30] ioapic: when switches to level trigger mode, int= errupts raised repeatedly. >=20 > - the trigger mode is edge at first by reset. > - During initializatoin, the interrupt is raised as edge which is maske= d. > The corresponding bit of irr is set. =2E..and that is the actual problem. The spec says: "Interrupt Mask=97R/W= =2E When this bit is 1, the interrupt signal is masked. Edge-sensitive interrupts signaled on a masked interrupt pin are ignored (i.e., not delivered or held pending)." So this should do the trick in a correct way (untested, please validate): diff --git a/hw/ioapic.c b/hw/ioapic.c index 569327d..6663f41 100644 --- a/hw/ioapic.c +++ b/hw/ioapic.c @@ -161,7 +161,7 @@ static void ioapic_set_irq(void *opaque, int vector, = int level) } } else { /* edge triggered */ - if (level) { + if (level && !(entry & IOAPIC_LVT_MASKED)) { s->irr |=3D mask; ioapic_service(s); } Jan --------------enigFEC0BABC4539EEB1A72EB48C 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.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk2gGvYACgkQitSsb3rl5xSP8gCeJAOsERzsx3yHcrXkElN2dgz9 z7cAnj8LhM7rMnZq+K0W/QPiKH8fXYG9 =Xf15 -----END PGP SIGNATURE----- --------------enigFEC0BABC4539EEB1A72EB48C--