qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion
@ 2011-10-24 20:38 Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 01/14] mst_fpga: convert to memory API Benoît Canet
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

These patches apply against akivity memory/master.
They convert syborg to memory API and various
arm related component to VMState.

Omap boards where not modified because Linaro is
currently refactoring them.

Xscale was left apart too.

Benoît Canet (14):
  mst_fpga: convert to memory API
  syborg_fb: convert to memory API
  syborg_interrupt: convert to memory API
  syborg_keyboard: convert to memory API
  syborg_pointer: convert to memory API
  syborg_rtc: convert to memory API
  syborg_serial: convert to memory API
  syborg_timer: convert to memory API
  syborg_virtio: convert to memory API
  pl181: add vmstate
  bitbang_i2c: convert to VMState
  realview: convert realview i2c to VMState
  integratorcp: convert integratorcm to VMState
  integratorcp: convert icp_pic to VMState

 hw/bitbang_i2c.c      |   92 ++++++++++++++++++++++++++++++++----------------
 hw/integratorcp.c     |   38 ++++++++++++++++++++
 hw/mst_fpga.c         |   29 ++++++---------
 hw/pl181.c            |   40 +++++++++++++++++++--
 hw/realview.c         |   21 ++++++++++-
 hw/syborg_fb.c        |   28 ++++++---------
 hw/syborg_interrupt.c |   29 ++++++---------
 hw/syborg_keyboard.c  |   28 ++++++---------
 hw/syborg_pointer.c   |   28 ++++++---------
 hw/syborg_rtc.c       |   28 ++++++---------
 hw/syborg_serial.c    |   28 ++++++---------
 hw/syborg_timer.c     |   27 +++++---------
 hw/syborg_virtio.c    |   26 +++++--------
 13 files changed, 253 insertions(+), 189 deletions(-)

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 01/14] mst_fpga: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 02/14] syborg_fb: " Benoît Canet
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/mst_fpga.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/hw/mst_fpga.c b/hw/mst_fpga.c
index 7bcd5d7..cf9957b 100644
--- a/hw/mst_fpga.c
+++ b/hw/mst_fpga.c
@@ -34,6 +34,7 @@
 
 typedef struct mst_irq_state{
 	SysBusDevice busdev;
+	MemoryRegion iomem;
 
 	qemu_irq parent;
 
@@ -86,8 +87,8 @@ mst_fpga_set_irq(void *opaque, int irq, int level)
 }
 
 
-static uint32_t
-mst_fpga_readb(void *opaque, target_phys_addr_t addr)
+static uint64_t
+mst_fpga_readb(void *opaque, target_phys_addr_t addr, unsigned size)
 {
 	mst_irq_state *s = (mst_irq_state *) opaque;
 
@@ -124,7 +125,8 @@ mst_fpga_readb(void *opaque, target_phys_addr_t addr)
 }
 
 static void
-mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
+mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint64_t value,
+		unsigned size)
 {
 	mst_irq_state *s = (mst_irq_state *) opaque;
 	value &= 0xffffffff;
@@ -175,17 +177,11 @@ mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
 	}
 }
 
-static CPUReadMemoryFunc * const mst_fpga_readfn[] = {
-	mst_fpga_readb,
-	mst_fpga_readb,
-	mst_fpga_readb,
+static const MemoryRegionOps mst_fpga_ops = {
+	.read = mst_fpga_readb,
+	.write = mst_fpga_writeb,
+	.endianness = DEVICE_NATIVE_ENDIAN,
 };
-static CPUWriteMemoryFunc * const mst_fpga_writefn[] = {
-	mst_fpga_writeb,
-	mst_fpga_writeb,
-	mst_fpga_writeb,
-};
-
 
 static int mst_fpga_post_load(void *opaque, int version_id)
 {
@@ -198,7 +194,6 @@ static int mst_fpga_post_load(void *opaque, int version_id)
 static int mst_fpga_init(SysBusDevice *dev)
 {
 	mst_irq_state *s;
-	int iomemtype;
 
 	s = FROM_SYSBUS(mst_irq_state, dev);
 
@@ -210,9 +205,9 @@ static int mst_fpga_init(SysBusDevice *dev)
 	/* alloc the external 16 irqs */
 	qdev_init_gpio_in(&dev->qdev, mst_fpga_set_irq, MST_NUM_IRQS);
 
-	iomemtype = cpu_register_io_memory(mst_fpga_readfn,
-		mst_fpga_writefn, s, DEVICE_NATIVE_ENDIAN);
-	sysbus_init_mmio(dev, 0x00100000, iomemtype);
+	memory_region_init_io(&s->iomem, &mst_fpga_ops, s,
+			    "fpga", 0x00100000);
+	sysbus_init_mmio_region(dev, &s->iomem);
 	return 0;
 }
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 02/14] syborg_fb: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 01/14] mst_fpga: convert to memory API Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 03/14] syborg_interrupt: " Benoît Canet
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/syborg_fb.c |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/hw/syborg_fb.c b/hw/syborg_fb.c
index ae3e0eb..3b71c72 100644
--- a/hw/syborg_fb.c
+++ b/hw/syborg_fb.c
@@ -65,6 +65,7 @@ enum {
 
 typedef struct {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     DisplayState *ds;
     /*QEMUConsole *console;*/
     uint32_t need_update : 1;
@@ -294,7 +295,8 @@ static void syborg_fb_invalidate_display(void * opaque)
     s->need_update = 1;
 }
 
-static uint32_t syborg_fb_read(void *opaque, target_phys_addr_t offset)
+static uint64_t syborg_fb_read(void *opaque, target_phys_addr_t offset,
+                               unsigned size)
 {
     SyborgFBState *s = opaque;
 
@@ -366,7 +368,7 @@ static uint32_t syborg_fb_read(void *opaque, target_phys_addr_t offset)
 }
 
 static void syborg_fb_write(void *opaque, target_phys_addr_t offset,
-                            uint32_t val)
+                            uint64_t val, unsigned size)
 {
     SyborgFBState *s = opaque;
 
@@ -454,16 +456,10 @@ static void syborg_fb_write(void *opaque, target_phys_addr_t offset,
     }
 }
 
-static CPUReadMemoryFunc * const syborg_fb_readfn[] = {
-    syborg_fb_read,
-    syborg_fb_read,
-    syborg_fb_read
-};
-
-static CPUWriteMemoryFunc * const syborg_fb_writefn[] = {
-    syborg_fb_write,
-    syborg_fb_write,
-    syborg_fb_write
+static const MemoryRegionOps syborg_fb_ops = {
+    .read = syborg_fb_read,
+    .write = syborg_fb_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static void syborg_fb_save(QEMUFile *f, void *opaque)
@@ -515,13 +511,11 @@ static int syborg_fb_load(QEMUFile *f, void *opaque, int version_id)
 static int syborg_fb_init(SysBusDevice *dev)
 {
     SyborgFBState *s = FROM_SYSBUS(SyborgFBState, dev);
-    int iomemtype;
 
     sysbus_init_irq(dev, &s->irq);
-    iomemtype = cpu_register_io_memory(syborg_fb_readfn,
-                                       syborg_fb_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &syborg_fb_ops, s,
+                          "framebuffer", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
 
     s->ds = graphic_console_init(syborg_fb_update_display,
                                  syborg_fb_invalidate_display,
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 03/14] syborg_interrupt: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 01/14] mst_fpga: convert to memory API Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 02/14] syborg_fb: " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 04/14] syborg_keyboard: " Benoît Canet
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/syborg_interrupt.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/hw/syborg_interrupt.c b/hw/syborg_interrupt.c
index 1b0f3bb..512910a 100644
--- a/hw/syborg_interrupt.c
+++ b/hw/syborg_interrupt.c
@@ -55,6 +55,7 @@ typedef struct {
 
 typedef struct {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     int pending_count;
     uint32_t num_irqs;
     syborg_int_flags *flags;
@@ -84,7 +85,8 @@ static void syborg_int_set_irq(void *opaque, int irq, int level)
     }
 }
 
-static uint32_t syborg_int_read(void *opaque, target_phys_addr_t offset)
+static uint64_t syborg_int_read(void *opaque, target_phys_addr_t offset,
+                                unsigned size)
 {
     SyborgIntState *s = (SyborgIntState *)opaque;
     int i;
@@ -114,7 +116,8 @@ static uint32_t syborg_int_read(void *opaque, target_phys_addr_t offset)
     }
 }
 
-static void syborg_int_write(void *opaque, target_phys_addr_t offset, uint32_t value)
+static void syborg_int_write(void *opaque, target_phys_addr_t offset,
+                             uint64_t value, unsigned size)
 {
     SyborgIntState *s = (SyborgIntState *)opaque;
     int i;
@@ -156,16 +159,10 @@ static void syborg_int_write(void *opaque, target_phys_addr_t offset, uint32_t v
     syborg_int_update(s);
 }
 
-static CPUReadMemoryFunc * const syborg_int_readfn[] = {
-    syborg_int_read,
-    syborg_int_read,
-    syborg_int_read
-};
-
-static CPUWriteMemoryFunc * const syborg_int_writefn[] = {
-    syborg_int_write,
-    syborg_int_write,
-    syborg_int_write
+static const MemoryRegionOps syborg_int_ops = {
+    .read = syborg_int_read,
+    .write = syborg_int_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static void syborg_int_save(QEMUFile *f, void *opaque)
@@ -205,14 +202,12 @@ static int syborg_int_load(QEMUFile *f, void *opaque, int version_id)
 static int syborg_int_init(SysBusDevice *dev)
 {
     SyborgIntState *s = FROM_SYSBUS(SyborgIntState, dev);
-    int iomemtype;
 
     sysbus_init_irq(dev, &s->parent_irq);
     qdev_init_gpio_in(&dev->qdev, syborg_int_set_irq, s->num_irqs);
-    iomemtype = cpu_register_io_memory(syborg_int_readfn,
-                                       syborg_int_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &syborg_int_ops, s,
+                          "interrupt", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
     s->flags = g_malloc0(s->num_irqs * sizeof(syborg_int_flags));
 
     register_savevm(&dev->qdev, "syborg_int", -1, 1, syborg_int_save,
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 04/14] syborg_keyboard: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (2 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 03/14] syborg_interrupt: " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 05/14] syborg_pointer: " Benoît Canet
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/syborg_keyboard.c |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/hw/syborg_keyboard.c b/hw/syborg_keyboard.c
index 82b9dc0..03d2183 100644
--- a/hw/syborg_keyboard.c
+++ b/hw/syborg_keyboard.c
@@ -51,6 +51,7 @@ enum {
 
 typedef struct {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     uint32_t int_enabled;
     int extension_bit;
     uint32_t fifo_size;
@@ -66,7 +67,8 @@ static void syborg_keyboard_update(SyborgKeyboardState *s)
     qemu_set_irq(s->irq, level);
 }
 
-static uint32_t syborg_keyboard_read(void *opaque, target_phys_addr_t offset)
+static uint64_t syborg_keyboard_read(void *opaque, target_phys_addr_t offset,
+                                    unsigned size)
 {
     SyborgKeyboardState *s = (SyborgKeyboardState *)opaque;
     int c;
@@ -104,7 +106,7 @@ static uint32_t syborg_keyboard_read(void *opaque, target_phys_addr_t offset)
 }
 
 static void syborg_keyboard_write(void *opaque, target_phys_addr_t offset,
-                                  uint32_t value)
+                                  uint64_t value, unsigned size)
 {
     SyborgKeyboardState *s = (SyborgKeyboardState *)opaque;
 
@@ -121,16 +123,10 @@ static void syborg_keyboard_write(void *opaque, target_phys_addr_t offset,
     }
 }
 
-static CPUReadMemoryFunc * const syborg_keyboard_readfn[] = {
-     syborg_keyboard_read,
-     syborg_keyboard_read,
-     syborg_keyboard_read
-};
-
-static CPUWriteMemoryFunc * const syborg_keyboard_writefn[] = {
-     syborg_keyboard_write,
-     syborg_keyboard_write,
-     syborg_keyboard_write
+static const MemoryRegionOps syborg_keyboard_ops = {
+    .read = syborg_keyboard_read,
+    .write = syborg_keyboard_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static void syborg_keyboard_event(void *opaque, int keycode)
@@ -184,13 +180,11 @@ static const VMStateDescription vmstate_syborg_keyboard = {
 static int syborg_keyboard_init(SysBusDevice *dev)
 {
     SyborgKeyboardState *s = FROM_SYSBUS(SyborgKeyboardState, dev);
-    int iomemtype;
 
     sysbus_init_irq(dev, &s->irq);
-    iomemtype = cpu_register_io_memory(syborg_keyboard_readfn,
-                                       syborg_keyboard_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &syborg_keyboard_ops, s,
+                              "keyboard", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
     if (s->fifo_size <= 0) {
         fprintf(stderr, "syborg_keyboard: fifo too small\n");
         s->fifo_size = 16;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 05/14] syborg_pointer: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (3 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 04/14] syborg_keyboard: " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 06/14] syborg_rtc: " Benoît Canet
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/syborg_pointer.c |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/hw/syborg_pointer.c b/hw/syborg_pointer.c
index b91214d..a0f8b32 100644
--- a/hw/syborg_pointer.c
+++ b/hw/syborg_pointer.c
@@ -44,6 +44,7 @@ typedef struct {
 
 typedef struct {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     int int_enabled;
     uint32_t fifo_size;
     event_data *event_fifo;
@@ -57,7 +58,8 @@ static void syborg_pointer_update(SyborgPointerState *s)
     qemu_set_irq(s->irq, s->read_count && s->int_enabled);
 }
 
-static uint32_t syborg_pointer_read(void *opaque, target_phys_addr_t offset)
+static uint64_t syborg_pointer_read(void *opaque, target_phys_addr_t offset,
+                                    unsigned size)
 {
     SyborgPointerState *s = (SyborgPointerState *)opaque;
 
@@ -87,7 +89,7 @@ static uint32_t syborg_pointer_read(void *opaque, target_phys_addr_t offset)
 }
 
 static void syborg_pointer_write(void *opaque, target_phys_addr_t offset,
-                                 uint32_t value)
+                                 uint64_t value, unsigned size)
 {
     SyborgPointerState *s = (SyborgPointerState *)opaque;
 
@@ -110,16 +112,10 @@ static void syborg_pointer_write(void *opaque, target_phys_addr_t offset,
     syborg_pointer_update(s);
 }
 
-static CPUReadMemoryFunc * const syborg_pointer_readfn[] = {
-   syborg_pointer_read,
-   syborg_pointer_read,
-   syborg_pointer_read
-};
-
-static CPUWriteMemoryFunc * const syborg_pointer_writefn[] = {
-   syborg_pointer_write,
-   syborg_pointer_write,
-   syborg_pointer_write
+static const MemoryRegionOps syborg_pointer_ops = {
+    .read = syborg_pointer_read,
+    .write = syborg_pointer_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static void syborg_pointer_event(void *opaque, int dx, int dy, int dz,
@@ -186,13 +182,11 @@ static const VMStateDescription vmstate_syborg_pointer = {
 static int syborg_pointer_init(SysBusDevice *dev)
 {
     SyborgPointerState *s = FROM_SYSBUS(SyborgPointerState, dev);
-    int iomemtype;
 
     sysbus_init_irq(dev, &s->irq);
-    iomemtype = cpu_register_io_memory(syborg_pointer_readfn,
-				       syborg_pointer_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &syborg_pointer_ops, s,
+                          "pointer", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
 
     if (s->fifo_size <= 0) {
         fprintf(stderr, "syborg_pointer: fifo too small\n");
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 06/14] syborg_rtc: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (4 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 05/14] syborg_pointer: " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 07/14] syborg_serial: " Benoît Canet
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/syborg_rtc.c |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/hw/syborg_rtc.c b/hw/syborg_rtc.c
index 69f6ccf..375664f 100644
--- a/hw/syborg_rtc.c
+++ b/hw/syborg_rtc.c
@@ -35,12 +35,14 @@ enum {
 
 typedef struct {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     int64_t offset;
     int64_t data;
     qemu_irq irq;
 } SyborgRTCState;
 
-static uint32_t syborg_rtc_read(void *opaque, target_phys_addr_t offset)
+static uint64_t syborg_rtc_read(void *opaque, target_phys_addr_t offset,
+                                unsigned size)
 {
     SyborgRTCState *s = (SyborgRTCState *)opaque;
     offset &= 0xfff;
@@ -58,7 +60,8 @@ static uint32_t syborg_rtc_read(void *opaque, target_phys_addr_t offset)
     }
 }
 
-static void syborg_rtc_write(void *opaque, target_phys_addr_t offset, uint32_t value)
+static void syborg_rtc_write(void *opaque, target_phys_addr_t offset,
+                             uint64_t value, unsigned size)
 {
     SyborgRTCState *s = (SyborgRTCState *)opaque;
     uint64_t now;
@@ -90,16 +93,10 @@ static void syborg_rtc_write(void *opaque, target_phys_addr_t offset, uint32_t v
     }
 }
 
-static CPUReadMemoryFunc * const syborg_rtc_readfn[] = {
-    syborg_rtc_read,
-    syborg_rtc_read,
-    syborg_rtc_read
-};
-
-static CPUWriteMemoryFunc * const syborg_rtc_writefn[] = {
-    syborg_rtc_write,
-    syborg_rtc_write,
-    syborg_rtc_write
+static const MemoryRegionOps syborg_rtc_ops = {
+    .read = syborg_rtc_read,
+    .write = syborg_rtc_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static const VMStateDescription vmstate_syborg_rtc = {
@@ -118,12 +115,9 @@ static int syborg_rtc_init(SysBusDevice *dev)
 {
     SyborgRTCState *s = FROM_SYSBUS(SyborgRTCState, dev);
     struct tm tm;
-    int iomemtype;
 
-    iomemtype = cpu_register_io_memory(syborg_rtc_readfn,
-                                       syborg_rtc_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &syborg_rtc_ops, s, "rtc", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
 
     qemu_get_timedate(&tm, 0);
     s->offset = (uint64_t)mktime(&tm) * 1000000000;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 07/14] syborg_serial: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (5 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 06/14] syborg_rtc: " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 08/14] syborg_timer: " Benoît Canet
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/syborg_serial.c |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/hw/syborg_serial.c b/hw/syborg_serial.c
index c83f82c..b73a009 100644
--- a/hw/syborg_serial.c
+++ b/hw/syborg_serial.c
@@ -58,6 +58,7 @@ enum {
 
 typedef struct {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     uint32_t int_enable;
     uint32_t fifo_size;
     uint32_t *read_fifo;
@@ -152,7 +153,8 @@ static void dma_rx_start(SyborgSerialState *s, uint32_t len)
     syborg_serial_update(s);
 }
 
-static uint32_t syborg_serial_read(void *opaque, target_phys_addr_t offset)
+static uint64_t syborg_serial_read(void *opaque, target_phys_addr_t offset,
+                                   unsigned size)
 {
     SyborgSerialState *s = (SyborgSerialState *)opaque;
     uint32_t c;
@@ -192,7 +194,7 @@ static uint32_t syborg_serial_read(void *opaque, target_phys_addr_t offset)
 }
 
 static void syborg_serial_write(void *opaque, target_phys_addr_t offset,
-                                uint32_t value)
+                                uint64_t value, unsigned size)
 {
     SyborgSerialState *s = (SyborgSerialState *)opaque;
     unsigned char ch;
@@ -261,16 +263,10 @@ static void syborg_serial_event(void *opaque, int event)
     /* TODO: Report BREAK events?  */
 }
 
-static CPUReadMemoryFunc * const syborg_serial_readfn[] = {
-     syborg_serial_read,
-     syborg_serial_read,
-     syborg_serial_read
-};
-
-static CPUWriteMemoryFunc * const syborg_serial_writefn[] = {
-     syborg_serial_write,
-     syborg_serial_write,
-     syborg_serial_write
+static const MemoryRegionOps syborg_serial_ops = {
+    .read = syborg_serial_read,
+    .write = syborg_serial_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static const VMStateDescription vmstate_syborg_serial = {
@@ -295,13 +291,11 @@ static const VMStateDescription vmstate_syborg_serial = {
 static int syborg_serial_init(SysBusDevice *dev)
 {
     SyborgSerialState *s = FROM_SYSBUS(SyborgSerialState, dev);
-    int iomemtype;
 
     sysbus_init_irq(dev, &s->irq);
-    iomemtype = cpu_register_io_memory(syborg_serial_readfn,
-                                       syborg_serial_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &syborg_serial_ops, s,
+                          "serial", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
     s->chr = qdev_init_chardev(&dev->qdev);
     if (s->chr) {
         qemu_chr_add_handlers(s->chr, syborg_serial_can_receive,
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 08/14] syborg_timer: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (6 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 07/14] syborg_serial: " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 09/14] syborg_virtio: " Benoît Canet
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/syborg_timer.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/hw/syborg_timer.c b/hw/syborg_timer.c
index 50c813e..dfee457 100644
--- a/hw/syborg_timer.c
+++ b/hw/syborg_timer.c
@@ -53,6 +53,7 @@ enum {
 
 typedef struct {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     ptimer_state *timer;
     int running;
     int oneshot;
@@ -83,7 +84,8 @@ static void syborg_timer_tick(void *opaque)
     syborg_timer_update(s);
 }
 
-static uint32_t syborg_timer_read(void *opaque, target_phys_addr_t offset)
+static uint64_t syborg_timer_read(void *opaque, target_phys_addr_t offset,
+                                  unsigned size)
 {
     SyborgTimerState *s = (SyborgTimerState *)opaque;
 
@@ -114,7 +116,7 @@ static uint32_t syborg_timer_read(void *opaque, target_phys_addr_t offset)
 }
 
 static void syborg_timer_write(void *opaque, target_phys_addr_t offset,
-                               uint32_t value)
+                               uint64_t value, unsigned size)
 {
     SyborgTimerState *s = (SyborgTimerState *)opaque;
 
@@ -162,16 +164,10 @@ static void syborg_timer_write(void *opaque, target_phys_addr_t offset,
     }
 }
 
-static CPUReadMemoryFunc * const syborg_timer_readfn[] = {
-    syborg_timer_read,
-    syborg_timer_read,
-    syborg_timer_read
-};
-
-static CPUWriteMemoryFunc * const syborg_timer_writefn[] = {
-    syborg_timer_write,
-    syborg_timer_write,
-    syborg_timer_write
+static const MemoryRegionOps syborg_timer_ops = {
+    .read = syborg_timer_read,
+    .write = syborg_timer_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static const VMStateDescription vmstate_syborg_timer = {
@@ -194,17 +190,14 @@ static int syborg_timer_init(SysBusDevice *dev)
 {
     SyborgTimerState *s = FROM_SYSBUS(SyborgTimerState, dev);
     QEMUBH *bh;
-    int iomemtype;
 
     if (s->freq == 0) {
         fprintf(stderr, "syborg_timer: Zero/unset frequency\n");
         exit(1);
     }
     sysbus_init_irq(dev, &s->irq);
-    iomemtype = cpu_register_io_memory(syborg_timer_readfn,
-                                       syborg_timer_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &syborg_timer_ops, s, "timer", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
 
     bh = qemu_bh_new(syborg_timer_tick, s);
     s->timer = ptimer_init(bh);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 09/14] syborg_virtio: convert to memory API
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (7 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 08/14] syborg_timer: " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 10/14] pl181: add vmstate Benoît Canet
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/syborg_virtio.c |   26 ++++++++++----------------
 1 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/hw/syborg_virtio.c b/hw/syborg_virtio.c
index 00c7be8..af0c370 100644
--- a/hw/syborg_virtio.c
+++ b/hw/syborg_virtio.c
@@ -62,6 +62,7 @@ enum {
 typedef struct {
     SysBusDevice busdev;
     VirtIODevice *vdev;
+    MemoryRegion iomem;
     qemu_irq irq;
     uint32_t int_enable;
     uint32_t id;
@@ -223,16 +224,12 @@ static void syborg_virtio_writeb(void *opaque, target_phys_addr_t offset,
     BADF("Bad byte write offset 0x%x\n", (int)offset);
 }
 
-static CPUReadMemoryFunc * const syborg_virtio_readfn[] = {
-     syborg_virtio_readb,
-     syborg_virtio_readw,
-     syborg_virtio_readl
-};
-
-static CPUWriteMemoryFunc * const syborg_virtio_writefn[] = {
-     syborg_virtio_writeb,
-     syborg_virtio_writew,
-     syborg_virtio_writel
+static const MemoryRegionOps syborg_virtio_ops = {
+    .old_mmio = {
+        .read = { syborg_virtio_readb, syborg_virtio_readw, syborg_virtio_readl },
+        .write = { syborg_virtio_writeb, syborg_virtio_writew, syborg_virtio_writel },
+    },
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static void syborg_virtio_update_irq(void *opaque, uint16_t vector)
@@ -258,17 +255,14 @@ static VirtIOBindings syborg_virtio_bindings = {
 
 static int syborg_virtio_init(SyborgVirtIOProxy *proxy, VirtIODevice *vdev)
 {
-    int iomemtype;
-
     proxy->vdev = vdev;
 
     /* Don't support multiple vectors */
     proxy->vdev->nvectors = 0;
     sysbus_init_irq(&proxy->busdev, &proxy->irq);
-    iomemtype = cpu_register_io_memory(syborg_virtio_readfn,
-                                       syborg_virtio_writefn, proxy,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(&proxy->busdev, 0x1000, iomemtype);
+    memory_region_init_io(&proxy->iomem, &syborg_virtio_ops, proxy,
+                          "virtio", 0x1000);
+    sysbus_init_mmio_region(&proxy->busdev, &proxy->iomem);
 
     proxy->id = ((uint32_t)0x1af4 << 16) | vdev->device_id;
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 10/14] pl181: add vmstate
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (8 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 09/14] syborg_virtio: " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 11/14] bitbang_i2c: convert to VMState Benoît Canet
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/pl181.c |   40 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/hw/pl181.c b/hw/pl181.c
index e13ea8e..cef2530 100644
--- a/hw/pl181.c
+++ b/hw/pl181.c
@@ -38,20 +38,45 @@ typedef struct {
     uint32_t datacnt;
     uint32_t status;
     uint32_t mask[2];
-    int fifo_pos;
-    int fifo_len;
+    int32_t fifo_pos;
+    int32_t fifo_len;
     /* The linux 2.6.21 driver is buggy, and misbehaves if new data arrives
        while it is reading the FIFO.  We hack around this be defering
        subsequent transfers until after the driver polls the status word.
        http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=4446/1
      */
-    int linux_hack;
+    int32_t linux_hack;
     uint32_t fifo[PL181_FIFO_LEN];
     qemu_irq irq[2];
     /* GPIO outputs for 'card is readonly' and 'card inserted' */
     qemu_irq cardstatus[2];
 } pl181_state;
 
+static const VMStateDescription vmstate_pl181 = {
+    .name = "pl181",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT32(clock, pl181_state),
+        VMSTATE_UINT32(power, pl181_state),
+        VMSTATE_UINT32(cmdarg, pl181_state),
+        VMSTATE_UINT32(cmd, pl181_state),
+        VMSTATE_UINT32(datatimer, pl181_state),
+        VMSTATE_UINT32(datalength, pl181_state),
+        VMSTATE_UINT32(respcmd, pl181_state),
+        VMSTATE_UINT32_ARRAY(response, pl181_state, 4),
+        VMSTATE_UINT32(datactrl, pl181_state),
+        VMSTATE_UINT32(datacnt, pl181_state),
+        VMSTATE_UINT32(status, pl181_state),
+        VMSTATE_UINT32_ARRAY(mask, pl181_state, 2),
+        VMSTATE_INT32(fifo_pos, pl181_state),
+        VMSTATE_INT32(fifo_len, pl181_state),
+        VMSTATE_INT32(linux_hack, pl181_state),
+        VMSTATE_UINT32_ARRAY(fifo, pl181_state, PL181_FIFO_LEN),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 #define PL181_CMD_INDEX     0x3f
 #define PL181_CMD_RESPONSE  (1 << 6)
 #define PL181_CMD_LONGRESP  (1 << 7)
@@ -465,9 +490,16 @@ static int pl181_init(SysBusDevice *dev)
     return 0;
 }
 
+static SysBusDeviceInfo pl181_info = {
+    .init = pl181_init,
+    .qdev.name = "pl181",
+    .qdev.size = sizeof(pl181_state),
+    .qdev.vmsd = &vmstate_pl181,
+};
+
 static void pl181_register_devices(void)
 {
-    sysbus_register_dev("pl181", sizeof(pl181_state), pl181_init);
+    sysbus_register_withprop(&pl181_info);
 }
 
 device_init(pl181_register_devices)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 11/14] bitbang_i2c: convert to VMState
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (9 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 10/14] pl181: add vmstate Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 12/14] realview: convert realview i2c " Benoît Canet
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/bitbang_i2c.c |   92 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 61 insertions(+), 31 deletions(-)

diff --git a/hw/bitbang_i2c.c b/hw/bitbang_i2c.c
index 431359d..453f1da 100644
--- a/hw/bitbang_i2c.c
+++ b/hw/bitbang_i2c.c
@@ -19,37 +19,53 @@ do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } while (0)
 #define DPRINTF(fmt, ...) do {} while(0)
 #endif
 
-typedef enum bitbang_i2c_state {
+enum {
     STOPPED = 0,
-    SENDING_BIT7,
-    SENDING_BIT6,
-    SENDING_BIT5,
-    SENDING_BIT4,
-    SENDING_BIT3,
-    SENDING_BIT2,
-    SENDING_BIT1,
-    SENDING_BIT0,
-    WAITING_FOR_ACK,
-    RECEIVING_BIT7,
-    RECEIVING_BIT6,
-    RECEIVING_BIT5,
-    RECEIVING_BIT4,
-    RECEIVING_BIT3,
-    RECEIVING_BIT2,
-    RECEIVING_BIT1,
-    RECEIVING_BIT0,
-    SENDING_ACK,
-    SENT_NACK
-} bitbang_i2c_state;
+    SENDING_BIT7 = 1,
+    SENDING_BIT6 = 2,
+    SENDING_BIT5 = 3,
+    SENDING_BIT4 = 4,
+    SENDING_BIT3 = 5,
+    SENDING_BIT2 = 6,
+    SENDING_BIT1 = 7,
+    SENDING_BIT0 = 8,
+    WAITING_FOR_ACK = 9,
+    RECEIVING_BIT7 = 10,
+    RECEIVING_BIT6 = 11,
+    RECEIVING_BIT5 = 12,
+    RECEIVING_BIT4 = 13,
+    RECEIVING_BIT3 = 14,
+    RECEIVING_BIT2 = 15,
+    RECEIVING_BIT1 = 16,
+    RECEIVING_BIT0 = 17,
+    SENDING_ACK = 18,
+    SENT_NACK = 19
+};
 
 struct bitbang_i2c_interface {
     i2c_bus *bus;
-    bitbang_i2c_state state;
-    int last_data;
-    int last_clock;
-    int device_out;
+    uint8_t state;
+    int32_t last_data;
+    int32_t last_clock;
+    int32_t device_out;
     uint8_t buffer;
-    int current_addr;
+    int32_t current_addr;
+};
+
+const VMStateDescription vmstate_bitbang_i2c = {
+    .name = "bitbang_i2c",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_UINT8(state, bitbang_i2c_interface),
+        VMSTATE_INT32(last_data, bitbang_i2c_interface),
+        VMSTATE_INT32(last_clock, bitbang_i2c_interface),
+        VMSTATE_INT32(device_out, bitbang_i2c_interface),
+        VMSTATE_UINT8(buffer, bitbang_i2c_interface),
+        VMSTATE_INT32(current_addr, bitbang_i2c_interface),
+        VMSTATE_END_OF_LIST()
+    }
 };
 
 static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c)
@@ -62,7 +78,7 @@ static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c)
 }
 
 /* Set device data pin.  */
-static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level)
+static int32_t bitbang_i2c_ret(bitbang_i2c_interface *i2c, int32_t level)
 {
     i2c->device_out = level;
     //DPRINTF("%d %d %d\n", i2c->last_clock, i2c->last_data, i2c->device_out);
@@ -70,13 +86,13 @@ static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level)
 }
 
 /* Leave device data pin unodified.  */
-static int bitbang_i2c_nop(bitbang_i2c_interface *i2c)
+static int32_t bitbang_i2c_nop(bitbang_i2c_interface *i2c)
 {
     return bitbang_i2c_ret(i2c, i2c->device_out);
 }
 
 /* Returns data line level.  */
-int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level)
+int32_t bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int32_t level)
 {
     int data;
 
@@ -185,11 +201,24 @@ bitbang_i2c_interface *bitbang_i2c_init(i2c_bus *bus)
 typedef struct {
     SysBusDevice busdev;
     bitbang_i2c_interface *bitbang;
-    int last_level;
+    int32_t last_level;
     qemu_irq out;
 } GPIOI2CState;
 
-static void bitbang_i2c_gpio_set(void *opaque, int irq, int level)
+const VMStateDescription vmstate_gpio_i2c = {
+    .name = "gpio_i2c",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_STRUCT_POINTER(bitbang, GPIOI2CState, vmstate_bitbang_i2c,
+                       bitbang_i2c_interface *),
+        VMSTATE_INT32(last_level, GPIOI2CState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+static void bitbang_i2c_gpio_set(void *opaque, int irq, int32_t level)
 {
     GPIOI2CState *s = opaque;
 
@@ -221,6 +250,7 @@ static SysBusDeviceInfo gpio_i2c_info = {
     .qdev.name  = "gpio_i2c",
     .qdev.desc  = "Virtual GPIO to I2C bridge",
     .qdev.size  = sizeof(GPIOI2CState),
+    .qdev.vmsd  = &vmstate_gpio_i2c,
 };
 
 static void bitbang_i2c_register(void)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 12/14] realview: convert realview i2c to VMState
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (10 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 11/14] bitbang_i2c: convert to VMState Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 13/14] integratorcp: convert integratorcm " Benoît Canet
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/realview.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/hw/realview.c b/hw/realview.c
index 14281b0..4eb320e 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -26,10 +26,26 @@ typedef struct {
     SysBusDevice busdev;
     MemoryRegion iomem;
     bitbang_i2c_interface *bitbang;
-    int out;
-    int in;
+    int32_t out;
+    int32_t in;
 } RealViewI2CState;
 
+extern VMStateDescription vmstate_bitbang_i2c;
+
+const VMStateDescription vmstate_realview_i2c = {
+    .name = "realview_i2c",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_STRUCT_POINTER(bitbang, RealViewI2CState, vmstate_bitbang_i2c,
+                       bitbang_i2c_interface *),
+        VMSTATE_INT32(out, RealViewI2CState),
+        VMSTATE_INT32(in, RealViewI2CState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static uint64_t realview_i2c_read(void *opaque, target_phys_addr_t offset,
                                   unsigned size)
 {
@@ -85,6 +101,7 @@ static SysBusDeviceInfo realview_i2c_info = {
     .init = realview_i2c_init,
     .qdev.name  = "realview_i2c",
     .qdev.size  = sizeof(RealViewI2CState),
+    .qdev.vmsd  = &vmstate_realview_i2c,
 };
 
 static void realview_register_devices(void)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 13/14] integratorcp: convert integratorcm to VMState
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (11 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 12/14] realview: convert realview i2c " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 14/14] integratorcp: convert icp_pic " Benoît Canet
  2011-10-25  8:49 ` [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Avi Kivity
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/integratorcp.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index 7ad68b7..1ffe7d8 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -35,6 +35,29 @@ typedef struct {
     uint32_t fiq_enabled;
 } integratorcm_state;
 
+static const VMStateDescription vmstate_integratorcm = {
+    .name = "integratorcm",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField[]) {
+        VMSTATE_UINT32(memsz, integratorcm_state),
+        VMSTATE_BOOL(flash_mapped, integratorcm_state),
+        VMSTATE_UINT32(cm_osc, integratorcm_state),
+        VMSTATE_UINT32(cm_ctrl, integratorcm_state),
+        VMSTATE_UINT32(cm_lock, integratorcm_state),
+        VMSTATE_UINT32(cm_auxosc, integratorcm_state),
+        VMSTATE_UINT32(cm_sdram, integratorcm_state),
+        VMSTATE_UINT32(cm_init, integratorcm_state),
+        VMSTATE_UINT32(cm_flags, integratorcm_state),
+        VMSTATE_UINT32(cm_nvflags, integratorcm_state),
+        VMSTATE_UINT32(int_level, integratorcm_state),
+        VMSTATE_UINT32(irq_enabled, integratorcm_state),
+        VMSTATE_UINT32(fiq_enabled, integratorcm_state),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static uint8_t integrator_spd[128] = {
    128, 8, 4, 11, 9, 1, 64, 0,  2, 0xa0, 0xa0, 0, 0, 8, 0, 1,
    0xe, 4, 0x1c, 1, 2, 0x20, 0xc0, 0, 0, 0, 0, 0x30, 0x28, 0x30, 0x28, 0x40
@@ -536,6 +559,7 @@ static SysBusDeviceInfo core_info = {
     .init = integratorcm_init,
     .qdev.name  = "integrator_core",
     .qdev.size  = sizeof(integratorcm_state),
+    .qdev.vmsd = &vmstate_integratorcm,
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT32("memsz", integratorcm_state, memsz, 0),
         DEFINE_PROP_END_OF_LIST(),
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH 14/14] integratorcp: convert icp_pic to VMState
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (12 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 13/14] integratorcp: convert integratorcm " Benoît Canet
@ 2011-10-24 20:38 ` Benoît Canet
  2011-10-25  8:49 ` [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Avi Kivity
  14 siblings, 0 replies; 18+ messages in thread
From: Benoît Canet @ 2011-10-24 20:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Benoît Canet

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/integratorcp.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index 1ffe7d8..114907a 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -310,6 +310,19 @@ typedef struct icp_pic_state
   qemu_irq parent_fiq;
 } icp_pic_state;
 
+static const VMStateDescription vmstate_icp_pic = {
+    .name = "pic",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField[]) {
+        VMSTATE_UINT32(level, icp_pic_state),
+        VMSTATE_UINT32(irq_enabled, icp_pic_state),
+        VMSTATE_UINT32(fiq_enabled, icp_pic_state),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static void icp_pic_update(icp_pic_state *s)
 {
     uint32_t flags;
@@ -411,6 +424,7 @@ static int icp_pic_init(SysBusDevice *dev)
     sysbus_init_irq(dev, &s->parent_fiq);
     memory_region_init_io(&s->iomem, &icp_pic_ops, s, "icp-pic", 0x00800000);
     sysbus_init_mmio_region(dev, &s->iomem);
+    vmstate_register(&dev->qdev, -1, &vmstate_icp_pic, s);
     return 0;
 }
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion
  2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
                   ` (13 preceding siblings ...)
  2011-10-24 20:38 ` [Qemu-devel] [PATCH 14/14] integratorcp: convert icp_pic " Benoît Canet
@ 2011-10-25  8:49 ` Avi Kivity
  2011-10-25  9:03   ` Benoît Canet
  14 siblings, 1 reply; 18+ messages in thread
From: Avi Kivity @ 2011-10-25  8:49 UTC (permalink / raw)
  To: Benoît Canet; +Cc: peter.maydell, qemu-devel

On 10/24/2011 10:38 PM, Benoît Canet wrote:
> These patches apply against akivity memory/master.
> They convert syborg to memory API and various
> arm related component to VMState.
>
> Omap boards where not modified because Linaro is
> currently refactoring them.
>
> Xscale was left apart too.
>
>

At least one patch (the first) has tabs instead of spaces.  Please use
checkpatch to check for further errors.

I'm not sure what to do about patches 10-14 - they should go through Juan.

Please copy me in the future on memory API patches.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion
  2011-10-25  8:49 ` [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Avi Kivity
@ 2011-10-25  9:03   ` Benoît Canet
  2011-10-25 11:06     ` Avi Kivity
  0 siblings, 1 reply; 18+ messages in thread
From: Benoît Canet @ 2011-10-25  9:03 UTC (permalink / raw)
  To: Avi Kivity; +Cc: peter.maydell, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

The tab where used because the original source file is written with tabs.
I'll rewrite them as space if you want.

2011/10/25 Avi Kivity <avi@redhat.com>

> On 10/24/2011 10:38 PM, Benoît Canet wrote:
> > These patches apply against akivity memory/master.
> > They convert syborg to memory API and various
> > arm related component to VMState.
> >
> > Omap boards where not modified because Linaro is
> > currently refactoring them.
> >
> > Xscale was left apart too.
> >
> >
>
> At least one patch (the first) has tabs instead of spaces.  Please use
> checkpatch to check for further errors.
>
> I'm not sure what to do about patches 10-14 - they should go through Juan.
>
> Please copy me in the future on memory API patches.
>
> --
> I have a truly marvellous patch that fixes the bug which this
> signature is too narrow to contain.
>
>

[-- Attachment #2: Type: text/html, Size: 1279 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion
  2011-10-25  9:03   ` Benoît Canet
@ 2011-10-25 11:06     ` Avi Kivity
  0 siblings, 0 replies; 18+ messages in thread
From: Avi Kivity @ 2011-10-25 11:06 UTC (permalink / raw)
  To: Benoît Canet; +Cc: peter.maydell, qemu-devel

On 10/25/2011 11:03 AM, Benoît Canet wrote:
>
> The tab where used because the original source file is written with tabs.
> I'll rewrite them as space if you want.

New code should conform to CODING_STYLE.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-10-25 11:06 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 20:38 [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 01/14] mst_fpga: convert to memory API Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 02/14] syborg_fb: " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 03/14] syborg_interrupt: " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 04/14] syborg_keyboard: " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 05/14] syborg_pointer: " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 06/14] syborg_rtc: " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 07/14] syborg_serial: " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 08/14] syborg_timer: " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 09/14] syborg_virtio: " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 10/14] pl181: add vmstate Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 11/14] bitbang_i2c: convert to VMState Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 12/14] realview: convert realview i2c " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 13/14] integratorcp: convert integratorcm " Benoît Canet
2011-10-24 20:38 ` [Qemu-devel] [PATCH 14/14] integratorcp: convert icp_pic " Benoît Canet
2011-10-25  8:49 ` [Qemu-devel] [PATCH 00/14] arm: more memory API and VMState conversion Avi Kivity
2011-10-25  9:03   ` Benoît Canet
2011-10-25 11:06     ` Avi Kivity

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).