From: Hollis Blanchard <hollisb@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: l_indien@magic.fr, aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH 3 of 4] [qemu ppc uic] Remember the state of level-triggered interrupts
Date: Wed, 23 Apr 2008 17:23:54 -0500 [thread overview]
Message-ID: <cacf1c628f43f0390890.1208989434@localhost.localdomain> (raw)
In-Reply-To: <patchbomb.1208989431@localhost.localdomain>
This fixes the following race condition:
1. target handles an interrupt and begins to EOI
2. device raises an interrupt, setting UIC SR
3. target finishes EOI by clearing SR bit
On hardware, a device with a level-triggered interrupt would instantly
re-assert SR after step 3, so we need to do the same.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff --git a/qemu/hw/ppc4xx_devs.c b/qemu/hw/ppc4xx_devs.c
--- a/qemu/hw/ppc4xx_devs.c
+++ b/qemu/hw/ppc4xx_devs.c
@@ -278,6 +278,7 @@
struct ppcuic_t {
uint32_t dcr_base;
int use_vectors;
+ uint32_t level; /* Remembers the state of level-triggered interrupts. */
uint32_t uicsr; /* Status register */
uint32_t uicer; /* Enable register */
uint32_t uiccr; /* Critical register */
@@ -385,10 +386,13 @@
uic->uicsr |= mask;
} else {
/* Level sensitive interrupt */
- if (level == 1)
+ if (level == 1) {
uic->uicsr |= mask;
- else
+ uic->level |= mask;
+ } else {
uic->uicsr &= ~mask;
+ uic->level &= ~mask;
+ }
}
#ifdef DEBUG_UIC
if (loglevel & CPU_LOG_INT) {
@@ -460,6 +464,7 @@
switch (dcrn) {
case DCR_UICSR:
uic->uicsr &= ~val;
+ uic->uicsr |= uic->level;
ppcuic_trigger_irq(uic);
break;
case DCR_UICSRS:
next prev parent reply other threads:[~2008-04-23 22:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-23 22:23 [Qemu-devel] [PATCH 0 of 4] PowerPC 4xx device emulation improvements Hollis Blanchard
2008-04-23 22:23 ` [Qemu-devel] [PATCH 1 of 4] [qemu ppc uic] Order IRQ bit numbers as described in the UIC documentation Hollis Blanchard
2008-04-23 22:23 ` [Qemu-devel] [PATCH 2 of 4] [qemu ppc uic] Remove interrupt polarity code Hollis Blanchard
2008-04-23 22:23 ` Hollis Blanchard [this message]
2008-04-23 22:23 ` [Qemu-devel] [PATCH 4 of 4] [qemu ppc pci] Emulate the PCI(-legacy) controller found on some 440 SoCs Hollis Blanchard
2008-05-05 3:46 ` 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=cacf1c628f43f0390890.1208989434@localhost.localdomain \
--to=hollisb@us.ibm.com \
--cc=aurelien@aurel32.net \
--cc=l_indien@magic.fr \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).