Patchwork [20/58] vmstate: port pxa2xx_pic

login
register
mail settings
Submitter Juan Quintela
Date Feb. 24, 2011, 5:57 p.m.
Message ID <24489c764dcf44f398a1e745801fd9044dd573e2.1298569508.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/84454/
State New
Headers show

Comments

Juan Quintela - Feb. 24, 2011, 5:57 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/pxa2xx_pic.c |   52 ++++++++++++++++++++--------------------------------
 1 files changed, 20 insertions(+), 32 deletions(-)
andrzej zaborowski - March 3, 2011, 2:24 p.m.
On 24 February 2011 18:57, Juan Quintela <quintela@redhat.com> wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/pxa2xx_pic.c |   52 ++++++++++++++++++++--------------------------------
>  1 files changed, 20 insertions(+), 32 deletions(-)

Hi Juan,

I pushed an earlier patch from Dmitry Eremin-Solenikov that converted
this device, so this patch can be skipped.  Unfortunately some of your
other patches may need rebasing now.

Cheers
Juan Quintela - March 9, 2011, 11:42 a.m.
andrzej zaborowski <balrogg@gmail.com> wrote:
> On 24 February 2011 18:57, Juan Quintela <quintela@redhat.com> wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  hw/pxa2xx_pic.c |   52 ++++++++++++++++++++--------------------------------
>>  1 files changed, 20 insertions(+), 32 deletions(-)
>
> Hi Juan,

Hi andrzej

> I pushed an earlier patch from Dmitry Eremin-Solenikov that converted
> this device, so this patch can be skipped.  Unfortunately some of your
> other patches may need rebasing now.

Remove from my tree.  Please take a look at the other pxa2xx* patches if you are
planning to port the other devices.

Later, Juan.
andrzej zaborowski - March 10, 2011, 4:44 a.m.
On 9 March 2011 12:42, Juan Quintela <quintela@redhat.com> wrote:
> andrzej zaborowski <balrogg@gmail.com> wrote:
>> I pushed an earlier patch from Dmitry Eremin-Solenikov that converted
>> this device, so this patch can be skipped.  Unfortunately some of your
>> other patches may need rebasing now.
>
> Remove from my tree.  Please take a look at the other pxa2xx* patches if you are
> planning to port the other devices.

All of the other patches I looked at, looked good to me.

Cheers

Patch

diff --git a/hw/pxa2xx_pic.c b/hw/pxa2xx_pic.c
index a36da23..d1015ab 100644
--- a/hw/pxa2xx_pic.c
+++ b/hw/pxa2xx_pic.c
@@ -241,41 +241,30 @@  static CPUWriteMemoryFunc * const pxa2xx_pic_writefn[] = {
     pxa2xx_pic_mem_write,
 };

-static void pxa2xx_pic_save(QEMUFile *f, void *opaque)
+static int pxa2xx_pic_post_load(void *opaque, int version_id)
 {
-    PXA2xxPICState *s = (PXA2xxPICState *) opaque;
-    int i;
-
-    for (i = 0; i < 2; i ++)
-        qemu_put_be32s(f, &s->int_enabled[i]);
-    for (i = 0; i < 2; i ++)
-        qemu_put_be32s(f, &s->int_pending[i]);
-    for (i = 0; i < 2; i ++)
-        qemu_put_be32s(f, &s->is_fiq[i]);
-    qemu_put_be32s(f, &s->int_idle);
-    for (i = 0; i < PXA2XX_PIC_SRCS; i ++)
-        qemu_put_be32s(f, &s->priority[i]);
-}
-
-static int pxa2xx_pic_load(QEMUFile *f, void *opaque, int version_id)
-{
-    PXA2xxPICState *s = (PXA2xxPICState *) opaque;
-    int i;
-
-    for (i = 0; i < 2; i ++)
-        qemu_get_be32s(f, &s->int_enabled[i]);
-    for (i = 0; i < 2; i ++)
-        qemu_get_be32s(f, &s->int_pending[i]);
-    for (i = 0; i < 2; i ++)
-        qemu_get_be32s(f, &s->is_fiq[i]);
-    qemu_get_be32s(f, &s->int_idle);
-    for (i = 0; i < PXA2XX_PIC_SRCS; i ++)
-        qemu_get_be32s(f, &s->priority[i]);
+    PXA2xxPICState *s = opaque;

-    pxa2xx_pic_update(opaque);
+    pxa2xx_pic_update(s);
     return 0;
 }

+static const VMStateDescription vmstate_pxa2xx_pic = {
+    .name = "pxa2xx_mmci",
+    .version_id = 0,
+    .minimum_version_id = 0,
+    .minimum_version_id_old = 0,
+    .post_load = pxa2xx_pic_post_load,
+    .fields      = (VMStateField[]) {
+        VMSTATE_UINT32_ARRAY(int_enabled, PXA2xxPICState, 2),
+        VMSTATE_UINT32_ARRAY(int_pending, PXA2xxPICState, 2),
+        VMSTATE_UINT32_ARRAY(is_fiq, PXA2xxPICState, 2),
+        VMSTATE_UINT32(int_idle, PXA2xxPICState),
+        VMSTATE_UINT32_ARRAY(priority, PXA2xxPICState, PXA2XX_PIC_SRCS),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 qemu_irq *pxa2xx_pic_init(target_phys_addr_t base, CPUState *env)
 {
     PXA2xxPICState *s;
@@ -306,8 +295,7 @@  qemu_irq *pxa2xx_pic_init(target_phys_addr_t base, CPUState *env)
     /* Enable IC coprocessor access.  */
     cpu_arm_set_cp_io(env, 6, pxa2xx_pic_cp_read, pxa2xx_pic_cp_write, s);

-    register_savevm(NULL, "pxa2xx_pic", 0, 0, pxa2xx_pic_save,
-                    pxa2xx_pic_load, s);
+    vmstate_register(NULL, 0, &vmstate_pxa2xx_pic, s);

     return qi;
 }