qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel Developers <qemu-devel@nongnu.org>
Cc: qemu-ppc@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [PATCH] PPC: Fix via-cuda memory registration
Date: Thu,  8 Sep 2011 18:54:45 +0200	[thread overview]
Message-ID: <1315500885-32577-1-git-send-email-agraf@suse.de> (raw)

Commit 23c5e4ca (convert to memory API) broke the VIA Cuda emulation layer
by not registering the IO structs.

This patch registers them properly and thus makes -M g3beige and -M mac99
work again.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

PS: Please test your patches. This one could have been found with an invocation
    as simple as "qemu-system-ppc". We boot into the OpenBIOS prompt by default,
    so you wouldn't even have required a guest image or kernel.
---
 hw/cuda.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/hw/cuda.c b/hw/cuda.c
index 6f05975..4077436 100644
--- a/hw/cuda.c
+++ b/hw/cuda.c
@@ -634,16 +634,20 @@ static uint32_t cuda_readl (void *opaque, target_phys_addr_t addr)
     return 0;
 }
 
-static CPUWriteMemoryFunc * const cuda_write[] = {
-    &cuda_writeb,
-    &cuda_writew,
-    &cuda_writel,
-};
-
-static CPUReadMemoryFunc * const cuda_read[] = {
-    &cuda_readb,
-    &cuda_readw,
-    &cuda_readl,
+static MemoryRegionOps cuda_ops = {
+    .old_mmio = {
+        .write = {
+            cuda_writeb,
+            cuda_writew,
+            cuda_writel,
+        },
+        .read = {
+            cuda_readb,
+            cuda_readw,
+            cuda_readl,
+        },
+    },
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static bool cuda_timer_exist(void *opaque, int version_id)
@@ -740,8 +744,8 @@ void cuda_init (MemoryRegion **cuda_mem, qemu_irq irq)
     s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
 
     s->adb_poll_timer = qemu_new_timer_ns(vm_clock, cuda_adb_poll, s);
-    cpu_register_io_memory(cuda_read, cuda_write, s,
-                                             DEVICE_NATIVE_ENDIAN);
+    memory_region_init_io(&s->mem, &cuda_ops, s, "cuda", 0x2000);
+
     *cuda_mem = &s->mem;
     vmstate_register(NULL, -1, &vmstate_cuda, s);
     qemu_register_reset(cuda_reset, s);
-- 
1.6.0.2

             reply	other threads:[~2011-09-08 16:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-08 16:54 Alexander Graf [this message]
2011-09-10 18:28 ` [Qemu-devel] [PATCH] PPC: Fix via-cuda memory registration Andreas Färber
2011-09-11 10:41 ` Avi Kivity
2011-09-11 11:38   ` Alexander Graf
2011-09-12  9:07     ` Avi Kivity
2011-09-12 10:06       ` Alexander Graf
2011-09-12 13:46       ` Lucas Meneghel Rodrigues
2011-09-12 13:53         ` Avi Kivity
2011-09-12 20:12           ` Blue Swirl
2011-09-12 20:20           ` Lucas Meneghel Rodrigues
2011-09-12 20:33           ` Peter Maydell
2011-09-12 21:05           ` Anthony Liguori
2011-09-13 19:31             ` [Qemu-devel] [Qemu-ppc] " Blue Swirl
2011-09-13 20:16               ` Anthony Liguori
2011-09-14 19:48                 ` Blue Swirl
2011-09-14 20:01                   ` Avi Kivity
2011-09-14 20:03                     ` Alexander Graf

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=1315500885-32577-1-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).