All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: laurent@vivier.eu, pbonzini@redhat.com, fam@euphon.net,
	qemu-devel@nongnu.org
Subject: [PATCH 02/10] macfb: don't use special irq_state and irq_mask variables in MacfbState
Date: Mon, 28 Feb 2022 22:25:19 +0000	[thread overview]
Message-ID: <20220228222527.8234-3-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20220228222527.8234-1-mark.cave-ayland@ilande.co.uk>

The current IRQ state and IRQ mask are handled exactly the same as standard
register accesses, so store these values directly in the regs array rather
than having separate variables for them.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/display/macfb.c         | 15 +++++++--------
 include/hw/display/macfb.h |  2 --
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 66ceacf1ae..fb54b460c1 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -476,7 +476,8 @@ static void macfb_update_display(void *opaque)
 
 static void macfb_update_irq(MacfbState *s)
 {
-    uint32_t irq_state = s->irq_state & s->irq_mask;
+    uint32_t irq_state = s->regs[DAFB_INTR_STAT >> 2] &
+                         s->regs[DAFB_INTR_MASK >> 2];
 
     if (irq_state) {
         qemu_irq_raise(s->irq);
@@ -496,7 +497,7 @@ static void macfb_vbl_timer(void *opaque)
     MacfbState *s = opaque;
     int64_t next_vbl;
 
-    s->irq_state |= DAFB_INTR_VBL;
+    s->regs[DAFB_INTR_STAT >> 2] |= DAFB_INTR_VBL;
     macfb_update_irq(s);
 
     /* 60 Hz irq */
@@ -530,10 +531,8 @@ static uint64_t macfb_ctrl_read(void *opaque,
     case DAFB_MODE_VADDR2:
     case DAFB_MODE_CTRL1:
     case DAFB_MODE_CTRL2:
-        val = s->regs[addr >> 2];
-        break;
     case DAFB_INTR_STAT:
-        val = s->irq_state;
+        val = s->regs[addr >> 2];
         break;
     case DAFB_MODE_SENSE:
         val = macfb_sense_read(s);
@@ -568,7 +567,7 @@ static void macfb_ctrl_write(void *opaque,
         macfb_sense_write(s, val);
         break;
     case DAFB_INTR_MASK:
-        s->irq_mask = val;
+        s->regs[addr >> 2] = val;
         if (val & DAFB_INTR_VBL) {
             next_vbl = macfb_next_vbl();
             timer_mod(s->vbl_timer, next_vbl);
@@ -577,12 +576,12 @@ static void macfb_ctrl_write(void *opaque,
         }
         break;
     case DAFB_INTR_CLEAR:
-        s->irq_state &= ~DAFB_INTR_VBL;
+        s->regs[DAFB_INTR_STAT >> 2] &= ~DAFB_INTR_VBL;
         macfb_update_irq(s);
         break;
     case DAFB_RESET:
         s->palette_current = 0;
-        s->irq_state &= ~DAFB_INTR_VBL;
+        s->regs[DAFB_INTR_STAT >> 2] &= ~DAFB_INTR_VBL;
         macfb_update_irq(s);
         break;
     case DAFB_LUT:
diff --git a/include/hw/display/macfb.h b/include/hw/display/macfb.h
index e52775aa21..6d9f0f7869 100644
--- a/include/hw/display/macfb.h
+++ b/include/hw/display/macfb.h
@@ -66,8 +66,6 @@ typedef struct MacfbState {
     uint32_t regs[MACFB_NUM_REGS];
     MacFbMode *mode;
 
-    uint32_t irq_state;
-    uint32_t irq_mask;
     QEMUTimer *vbl_timer;
     qemu_irq irq;
 } MacfbState;
-- 
2.20.1



  parent reply	other threads:[~2022-02-28 22:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 22:25 [PATCH 00/10] q800: migration fixes Mark Cave-Ayland
2022-02-28 22:25 ` [PATCH 01/10] macfb: add VMStateDescription for MacfbNubusState and MacfbSysBusState Mark Cave-Ayland
2022-02-28 22:25 ` Mark Cave-Ayland [this message]
2022-02-28 23:11   ` [PATCH 02/10] macfb: don't use special irq_state and irq_mask variables in MacfbState Philippe Mathieu-Daudé
2022-02-28 22:25 ` [PATCH 03/10] macfb: increase number of registers saved " Mark Cave-Ayland
2022-03-02  9:11   ` Mark Cave-Ayland
2022-02-28 22:25 ` [PATCH 04/10] macfb: add VMStateDescription fields for display type and VBL timer Mark Cave-Ayland
2022-02-28 22:25 ` [PATCH 05/10] macfb: set initial value of mode control registers in macfb_common_realize() Mark Cave-Ayland
2022-02-28 22:25 ` [PATCH 06/10] esp: introduce esp_set_pdma_cb() function Mark Cave-Ayland
2022-02-28 23:06   ` Philippe Mathieu-Daudé
2022-02-28 22:25 ` [PATCH 07/10] esp: introduce esp_pdma_cb() function Mark Cave-Ayland
2022-02-28 23:06   ` Philippe Mathieu-Daudé
2022-02-28 22:25 ` [PATCH 08/10] esp: convert ESPState pdma_cb from a function pointer to an integer Mark Cave-Ayland
2022-02-28 23:10   ` Philippe Mathieu-Daudé
2022-03-02  9:17     ` Mark Cave-Ayland
2022-02-28 22:25 ` [PATCH 09/10] esp: include the current PDMA callback in the migration stream Mark Cave-Ayland
2022-02-28 22:25 ` [PATCH 10/10] esp: recreate ESPState current_req after migration Mark Cave-Ayland

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=20220228222527.8234-3-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=fam@euphon.net \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.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 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.