qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: quintela@redhat.com, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: amit.shah@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] openpic: convert to vmstate
Date: Mon, 09 Feb 2015 13:43:23 +0100	[thread overview]
Message-ID: <54D8AB6B.1010901@suse.de> (raw)
In-Reply-To: <87mw4n1cp4.fsf@neno.neno>



On 09.02.15 13:39, Juan Quintela wrote:
> Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> wrote:
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>  hw/intc/openpic.c |  253 +++++++++++++++++++++++++----------------------------
>>  1 file changed, 119 insertions(+), 134 deletions(-)
>>
> 
>> +static const VMStateDescription vmstate_openpic_irq_queue = {
>> +    .name = "openpic_irq_queue",
>> +    .version_id = 0,
>> +    .minimum_version_id = 0,
>> +    .fields = (VMStateField[]) {
>> +        VMSTATE_BITMAP(queue, IRQQueue, 0, queue_size),
> 
> Can I assume that this layout is compatible with the one given by:
> 
> -    for (i = 0; i < BITS_TO_LONGS(IRQQUEUE_SIZE_BITS); i++) {
> -        /* Always put the lower half of a 64-bit long first, in case we
> -         * restore on a 32-bit host.  The least significant bits correspond
> -         * to lower IRQ numbers in the bitmap.
> -         */
> -        qemu_put_be32(f, (uint32_t)q->queue[i]);
> -#if LONG_MAX > 0x7FFFFFFF
> -        qemu_put_be32(f, (uint32_t)(q->queue[i] >> 32));
> -#endif
> -    }
> 
> 
>> +        VMSTATE_INT32(next, IRQQueue),
>> +        VMSTATE_INT32(priority, IRQQueue),
>> +        VMSTATE_END_OF_LIST()
>> +    }
>> +};
>> +
>> +static const VMStateDescription vmstate_openpic_irqdest = {
>> +    .name = "openpic_irqdest",
>> +    .version_id = 0,
>> +    .minimum_version_id = 0,
>> +    .fields = (VMStateField[]) {
>> +        VMSTATE_INT32(ctpr, IRQDest),
>> +        VMSTATE_STRUCT(raised, IRQDest, 0, vmstate_openpic_irq_queue,
>> +                       IRQQueue),
>> +        VMSTATE_STRUCT(servicing, IRQDest, 0, vmstate_openpic_irq_queue,
>> +                       IRQQueue),
>> +        VMSTATE_UINT32_ARRAY(outputs_active, IRQDest, OPENPIC_OUTPUT_NB),
> 
> This change would make big/little endian migration unhappy. (no, I don't
> know if it is more correct the new or the old code, just that they give
> different results).
> 
>> +        VMSTATE_END_OF_LIST()
>> +    }
>> +};
> 
>> +static const VMStateDescription vmstate_openpic = {
>> +    .name = "openpic",
>        .version_id = 2,
>        .minimum_version_id = 2
>> +    .post_load = openpic_post_load,
>> +    .fields = (VMStateField[]) {
>> +        VMSTATE_UINT32(gcr, OpenPICState),
>> +        VMSTATE_UINT32(vir, OpenPICState),
>> +        VMSTATE_UINT32(pir, OpenPICState),
>> +        VMSTATE_UINT32(spve, OpenPICState),
>> +        VMSTATE_UINT32(tfrr, OpenPICState),
>> +        VMSTATE_UINT32(max_irq, OpenPICState),
> 
>            VMSTATE_UINT32_EQUAL(nb_cpus, OpenPICState),
> 
>            VMSTATE_STRUCT_VARRAY_UINT32(dst, OpenPICState, nb_cpus, 0,
>                                         vmstate_openpic_irqdest, IRQDest),
> 
>            VMSTATE_STRUCT_ARRAY(timers, OpenPICState, OPENPIC_MAX_TMR, 0,
>                                 vmstate_openpic_timer, OpenPICTimer),
> 
>            VMSTATE_STRUCT_VARRAY_UINT32(src, OpenPICState, max_irq, 0,
>                                         vmstate_openpic_irqsource, IRQSource),
>> +        VMSTATE_END_OF_LIST()
>> +    }
>> +};
> 
> If you do this changes, this should get the v2 format working, right?
> Notice the two questions that I asked above, if that is true, we can go
> from here making the change compatible.
> 
> If so, we could go from here about ading the following ones with a
> subsection or so.
> 
> 
>> +        VMSTATE_STRUCT_ARRAY(msi, OpenPICState, MAX_MSI, 0,
>> +                             vmstate_openpic_msi, OpenPICMSI),
>> +        VMSTATE_UINT32(irq_ipi0, OpenPICState),
>> +        VMSTATE_UINT32(irq_tim0, OpenPICState),
>> +        VMSTATE_UINT32(irq_msi, OpenPICState),
>> +        VMSTATE_END_OF_LIST()
>> +    }
>> +};
> 
> If this is only used when MSI is used, and there is a check for that, we
> could use a new subsection.  If it always used, we should change format
> version to three.

Yes, please, just bump the version number and ignore all the legacy
cruft. OpenPIC state saving is broken for years, any old state that we
could potentially save is not usable anyway :)


Alex

> 
> Anyways, spliting this patch in two would make clear what is the
> equivalent of the old code and what is new.
> 
> What do you think?
> 
> Later, Juan.
> 

  reply	other threads:[~2015-02-09 12:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06 14:36 [Qemu-devel] [PATCH 0/2] openpic: convert to vmstate Mark Cave-Ayland
2015-02-06 14:36 ` [Qemu-devel] [PATCH 1/2] openpic: switch IRQQueue queue from inline to bitmap Mark Cave-Ayland
2015-02-06 14:36 ` [Qemu-devel] [PATCH 2/2] openpic: convert to vmstate Mark Cave-Ayland
2015-02-09 12:39   ` Juan Quintela
2015-02-09 12:43     ` Alexander Graf [this message]
2015-02-09 13:26       ` [Qemu-devel] [Qemu-ppc] " Mark Cave-Ayland
2015-02-09 13:50         ` Juan Quintela
2015-02-09 20:05           ` Mark Cave-Ayland
2015-02-09 13:47       ` Juan Quintela
2015-02-09 13:48       ` Juan Quintela
2015-02-06 14:51 ` [Qemu-devel] [Qemu-ppc] [PATCH 0/2] " Alexander Graf
2015-02-06 15:41   ` Mark Cave-Ayland
2015-02-11 11:51     ` Amit Shah

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=54D8AB6B.1010901@suse.de \
    --to=agraf@suse.de \
    --cc=amit.shah@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=quintela@redhat.com \
    /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).