qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Artyom Tarasenko <atar4qemu@googlemail.com>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
	Artyom Tarasenko <atar4qemu@gmail.com>
Subject: [Qemu-devel] sparc32 fix spurious dma interrupts
Date: Wed, 10 Feb 2010 23:40:48 +0100	[thread overview]
Message-ID: <1265841648-27249-1-git-send-email-atar4qemu@google.com> (raw)

Don't raise interrupt when not enabled.
Don't set DMA_INTR bit spuriously.
Don't print misleading debug messages "Raise IRQ" when not raising any.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
diff --git a/hw/sparc32_dma.c b/hw/sparc32_dma.c
index 6e991e0..b2992ca 100644
--- a/hw/sparc32_dma.c
+++ b/hw/sparc32_dma.c
@@ -125,9 +125,11 @@ static void dma_set_irq(void *opaque, int irq, int level)
 {
     DMAState *s = opaque;
     if (level) {
-        DPRINTF("Raise IRQ\n");
         s->dmaregs[0] |= DMA_INTR;
-        qemu_irq_raise(s->irq);
+        if (s->dmaregs[0] & DMA_INTREN) {
+            DPRINTF("Raise IRQ\n");
+            qemu_irq_raise(s->irq);
+        }
     } else {
         s->dmaregs[0] &= ~DMA_INTR;
         DPRINTF("Lower IRQ\n");
@@ -142,8 +145,6 @@ void espdma_memory_read(void *opaque, uint8_t *buf, int len)
     DPRINTF("DMA read, direction: %c, addr 0x%8.8x\n",
             s->dmaregs[0] & DMA_WRITE_MEM ? 'w': 'r', s->dmaregs[1]);
     sparc_iommu_memory_read(s->iommu, s->dmaregs[1], buf, len);
-    DPRINTF("Raise IRQ\n");
-    s->dmaregs[0] |= DMA_INTR;
     s->dmaregs[1] += len;
 }
 
@@ -154,8 +155,6 @@ void espdma_memory_write(void *opaque, uint8_t *buf, int len)
     DPRINTF("DMA write, direction: %c, addr 0x%8.8x\n",
             s->dmaregs[0] & DMA_WRITE_MEM ? 'w': 'r', s->dmaregs[1]);
     sparc_iommu_memory_write(s->iommu, s->dmaregs[1], buf, len);
-    DPRINTF("Raise IRQ\n");
-    s->dmaregs[0] |= DMA_INTR;
     s->dmaregs[1] += len;
 }
 

             reply	other threads:[~2010-02-10 22:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 22:40 Artyom Tarasenko [this message]
2010-02-12 18:40 ` [Qemu-devel] Re: sparc32 fix spurious dma interrupts Artyom Tarasenko
2010-02-12 19:27 ` Blue Swirl
2010-02-12 22:32   ` Artyom Tarasenko
2010-02-13  7:52     ` 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=1265841648-27249-1-git-send-email-atar4qemu@google.com \
    --to=atar4qemu@googlemail.com \
    --cc=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).