All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] Re: [PATCH] ioapic: when switches to level trigger mode, interrupts raised repeatedly.
Date: Sat, 09 Apr 2011 10:38:10 +0200	[thread overview]
Message-ID: <4DA01AF2.3040309@web.de> (raw)
In-Reply-To: <20110404021511.GF11748@valinux.co.jp>

[-- Attachment #1: Type: text/plain, Size: 1799 bytes --]

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 interrupts
> bit unconditionally. Which caused losing interrupt.
> 
> From 5ed177d35ab14f3b070a0eba2c49400279a3a14b Mon Sep 17 00:00:00 2001
> Message-Id: <5ed177d35ab14f3b070a0eba2c49400279a3a14b.1301883258.git.yamahata@valinux.co.jp>
> In-Reply-To: <cover.1301883258.git.yamahata@valinux.co.jp>
> References: <cover.1301883258.git.yamahata@valinux.co.jp>
> From: Isaku Yamahata <yamahata@valinux.co.jp>
> Date: Wed, 16 Mar 2011 14:00:13 +0900
> Subject: [PATCH 01/30] ioapic: when switches to level trigger mode, interrupts raised repeatedly.
> 
> - the trigger mode is edge at first by reset.
> - During initializatoin, the interrupt is raised as edge which is masked.
>   The corresponding bit of irr is set.

...and that is the actual problem. The spec says: "Interrupt Mask—R/W.
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 |= mask;
                 ioapic_service(s);
             }

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  reply	other threads:[~2011-04-09  8:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16  9:05 [Qemu-devel] [PATCH] ioapic: when switches to level trigger mode, interrupts raised repeatedly Isaku Yamahata
2011-04-03 19:53 ` Aurelien Jarno
2011-04-03 23:42   ` Isaku Yamahata
2011-04-04  2:15     ` Isaku Yamahata
2011-04-09  8:38       ` Jan Kiszka [this message]
2011-04-09 11:05         ` [Qemu-devel] " Isaku Yamahata
2011-04-09 11:18           ` [Qemu-devel] [PATCH] ioapic: Do not set irr for masked edge IRQs Jan Kiszka
2011-04-09 11:26             ` Jan Kiszka
2011-04-09 11:26               ` [Qemu-devel] " Jan Kiszka
2011-04-09 11:36               ` Jan Kiszka
2011-04-09 11:36                 ` [Qemu-devel] " Jan Kiszka
2011-04-09 11:41               ` Isaku Yamahata
2011-04-09 11:41                 ` [Qemu-devel] " Isaku Yamahata
2011-04-26 13:00             ` [Qemu-devel] " Jan Kiszka
2011-04-27 18:06               ` Aurelien Jarno
2011-04-04  5:14     ` [Qemu-devel] [PATCH] ioapic: when switches to level trigger mode, interrupts raised repeatedly Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DA01AF2.3040309@web.de \
    --to=jan.kiszka@web.de \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=yamahata@valinux.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.