qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Artyom Tarasenko <atar4qemu@gmail.com>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com, Artyom Tarasenko <atar4qemu@gmail.com>
Subject: [Qemu-devel] [PATCH 2/2][sparc64] Improve interrupt handling priority
Date: Tue,  3 Apr 2012 17:49:05 +0200	[thread overview]
Message-ID: <258a97f635594b174e38d0550087facdd53aa459.1333467746.git.atar4qemu@gmail.com> (raw)
In-Reply-To: <9752d94b9333062d8e3b74dffafc20f348167d95.1333467746.git.atar4qemu@gmail.com>
In-Reply-To: <9752d94b9333062d8e3b74dffafc20f348167d95.1333467746.git.atar4qemu@gmail.com>

The vector interrupt has higher priority than interrupt_level_n.
Also check only interrupt_level_n concurency when TL > 0, the traps of
other types may be nested.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
 hw/sun4u.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/hw/sun4u.c b/hw/sun4u.c
index 9d28194..e6b18f7 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -254,6 +254,10 @@ void cpu_check_irqs(CPUSPARCState *env)
     uint32_t pil = env->pil_in |
                   (env->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER));
 
+    /* TT_IVEC has a higher priority (16) than TT_EXTINT (31..17) */
+    if (env->ivec_status & 0x20) {
+        return;
+    }
     /* check if TM or SM in SOFTINT are set
        setting these also causes interrupt 14 */
     if (env->softint & (SOFTINT_TIMER | SOFTINT_STIMER)) {
@@ -281,7 +285,8 @@ void cpu_check_irqs(CPUSPARCState *env)
                 int old_interrupt = env->interrupt_index;
                 int new_interrupt = TT_EXTINT | i;
 
-                if (env->tl > 0 && cpu_tsptr(env)->tt > new_interrupt) {
+                if (unlikely(env->tl > 0 && cpu_tsptr(env)->tt > new_interrupt
+                  && ((cpu_tsptr(env)->tt & 0x1f0) == TT_EXTINT))) {
                     CPUIRQ_DPRINTF("Not setting CPU IRQ: TL=%d "
                                    "current %x >= pending %x\n",
                                    env->tl, cpu_tsptr(env)->tt, new_interrupt);
-- 
1.7.3.4

  reply	other threads:[~2012-04-03 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 15:49 [Qemu-devel] [PATCH 1/2][sparc64] Fix vector interrupt handling Artyom Tarasenko
2012-04-03 15:49 ` Artyom Tarasenko [this message]
2012-04-04 20:46 ` Blue Swirl

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=258a97f635594b174e38d0550087facdd53aa459.1333467746.git.atar4qemu@gmail.com \
    --to=atar4qemu@gmail.com \
    --cc=blauwirbel@gmail.com \
    --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).