All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <bonzini@gnu.org>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 0/4] Fix VMState design flaws
Date: Mon, 14 Sep 2009 23:30:21 +0200	[thread overview]
Message-ID: <4AAEB5ED.8040809@gnu.org> (raw)
In-Reply-To: <m31vm9jlob.fsf@neno.mitica>

On 09/14/2009 10:50 PM, Juan Quintela wrote:
> Paolo Bonzini<bonzini@gnu.org>  wrote:
>>>     * Add version_id field to post_load().  Now we can assign default values
>>>       in post_load for old versions of the state (ps2_kbd as example).
>>
>> While this is a good idea, why don't we first reset the devices upon
>> load, which would also set the default values?...
>
> It is safe to do that unconditionally?
> If so, I am all for it.  We can:
> - add reset field to vmstate
> - add default values to some fields, if it makse sense (haven't yet
>    looked at reset code).

The PS2 reset is this:

static void ps2_common_reset(PS2State *s)
{
     PS2Queue *q;
     s->write_cmd = -1;
     q = &s->queue;
     q->rptr = 0;
     q->wptr = 0;
     q->count = 0;
     s->update_irq(s->update_arg, 0); // calls kbd_update_kbd_irq
}

static void ps2_kbd_reset(void *opaque)
{
     PS2KbdState *s = (PS2KbdState *) opaque;

     ps2_common_reset(&s->common);
     s->scan_enabled = 0;
     s->translate = 0;
     s->scancode_set = 0;
}

All of these are later reset by load.  The update_irq may seem unsafe, 
but maybe deasserting an IRQ is better than leaving it in whatever state 
it was left by the previous VM...

Paolo

      reply	other threads:[~2009-09-14 21:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 20:15 [Qemu-devel] [PATCH 0/4] Fix VMState design flaws Juan Quintela
2009-09-14 20:15 ` [Qemu-devel] [PATCH 1/4] vmstate: remove const for put operations Juan Quintela
2009-09-14 20:15 ` [Qemu-devel] [PATCH 2/4] vmstate: add version_id argument to post_load Juan Quintela
2009-09-14 20:15 ` [Qemu-devel] [PATCH 3/4] vmstate: remove ps2_kbd_load_old() Juan Quintela
2009-09-14 20:45   ` [Qemu-devel] " Paolo Bonzini
2009-09-14 20:48     ` Juan Quintela
2009-09-14 20:15 ` [Qemu-devel] [PATCH 4/4] vmstate: Add support for sending partial arrays Juan Quintela
2009-09-14 20:48 ` [Qemu-devel] Re: [PATCH 0/4] Fix VMState design flaws Paolo Bonzini
2009-09-14 20:50   ` Juan Quintela
2009-09-14 21:30     ` Paolo Bonzini [this message]

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=4AAEB5ED.8040809@gnu.org \
    --to=bonzini@gnu.org \
    --cc=qemu-devel@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 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.