From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [RFC] IRQ acknowledge on MIPS
Date: Tue, 23 Jan 2007 01:48:19 +0100 [thread overview]
Message-ID: <20070123004819.GA10927@amd64.aurel32.net> (raw)
Hi all,
There is currently a bug concerning the IRQ acknowlege on the MIPS
system emulation. It concerns both the QEMU and Malta boards, though it
is only detectable with a 2.4 kernel and thus on the Malta board. The
symptom is a storm of "We got a spurious interrupt from PIIX4."
This is due to the kernel requesting the interrupt number from the
i8259A where no interrupt is waiting. In such a case the i8259A answers
by an IRQ 7.
When an hardware interrupt occurs, the i8259A memorizes the interrupt
and sends it to the MIPS CPU. This is done via the pic_irq_request()
function. The result is that the bit 10 of the CP0 Cause register is
set to one (interrupt 2). But when the interrupt is finished, the i8259a
registers IRR and ISR are cleared, but not the CP0 Cause register. The
CPU always thinks there is an interrupt to serve, which is wrong.
The patch below addresses the problem, but it is just a way to show the
problem and the fix. It is not clean to merge it, except the GT64120
part.
With this patch the problem is fixed, and I see a 12% improvement in
the boot time of a Debian system.
Does anyone has an idea of a sane implementation for that? It seems
only the MIPS platform has to clear a register of the CPU when an
interrupt is finished.
Thanks,
Aurelien
Index: gt64xxx.c
===================================================================
RCS file: /sources/qemu/qemu/hw/gt64xxx.c,v
retrieving revision 1.2
diff -u -d -p -r1.2 gt64xxx.c
--- gt64xxx.c 17 Jan 2007 23:35:01 -0000 1.2
+++ gt64xxx.c 23 Jan 2007 00:34:14 -0000
@@ -433,7 +436,8 @@ static uint32_t gt64120_readl (void *opa
val = s->regs[saddr];
break;
case GT_PCI0_IACK:
- val = pic_intack_read(isa_pic);
+ /* Read the IRQ number */
+ val = pic_read_irq(isa_pic);
break;
/* SDRAM Parameters */
Index: i8259.c
===================================================================
RCS file: /sources/qemu/qemu/hw/i8259.c,v
retrieving revision 1.19
diff -u -d -p -r1.19 i8259.c
--- i8259.c 25 Jun 2006 18:15:31 -0000 1.19
+++ i8259.c 23 Jan 2007 00:34:15 -0000
@@ -161,6 +161,8 @@ void pic_update_irq(PicState2 *s)
#endif
s->irq_request(s->irq_request_opaque, 1);
}
+ else
+ s->irq_request(s->irq_request_opaque, 0);
}
#ifdef DEBUG_IRQ_LATENCY
Index: mips_malta.c
===================================================================
RCS file: /sources/qemu/qemu/hw/mips_malta.c,v
retrieving revision 1.4
diff -u -d -p -r1.4 mips_malta.c
--- mips_malta.c 20 Jan 2007 00:29:01 -0000 1.4
+++ mips_malta.c 23 Jan 2007 00:34:15 -0000
@@ -62,7 +62,7 @@ static void pic_irq_request(void *opaque
cpu_interrupt(env, CPU_INTERRUPT_HARD);
} else {
env->CP0_Cause &= ~0x00000400;
- cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
+ /* cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); */
}
}
Index: mips_r4k.c
===================================================================
RCS file: /sources/qemu/qemu/hw/mips_r4k.c,v
retrieving revision 1.31
diff -u -d -p -r1.31 mips_r4k.c
--- mips_r4k.c 6 Jan 2007 02:24:15 -0000 1.31
+++ mips_r4k.c 23 Jan 2007 00:34:15 -0000
@@ -44,7 +44,7 @@ static void pic_irq_request(void *opaque
cpu_interrupt(env, CPU_INTERRUPT_HARD);
} else {
env->CP0_Cause &= ~0x00000400;
- cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
+ /* cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); */
}
}
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
next reply other threads:[~2007-01-23 0:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-23 0:48 Aurelien Jarno [this message]
2007-01-23 9:01 ` [Qemu-devel] [RFC] IRQ acknowledge on MIPS Aurelien Jarno
2007-01-23 15:27 ` Alexander Voropay
2007-01-23 15:40 ` Paul Brook
2007-01-23 20:22 ` Fabrice Bellard
2007-01-23 16:36 ` Aurelien Jarno
2007-01-23 9:06 ` Marius Groeger
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=20070123004819.GA10927@amd64.aurel32.net \
--to=aurelien@aurel32.net \
--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).