From: Juan Quintela <quintela@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 21/23] Port PCIDevice state to VMState
Date: Fri, 21 Aug 2009 11:30:05 +0200 [thread overview]
Message-ID: <m3fxblwm3m.fsf@neno.mitica> (raw)
In-Reply-To: <4A8E657D.4040604@redhat.com> (Gerd Hoffmann's message of "Fri, 21 Aug 2009 11:14:37 +0200")
Gerd Hoffmann <kraxel@redhat.com> wrote:
> On 08/21/09 11:01, Juan Quintela wrote:
>> I agree that the INT32_EQUAL is a bad idea. But that is how
>> the current code is done.
>
> Consider changing the code then ;)
>
>>> Beside that we'll have to think about how to handle versioning of
>>> structs. Do we want vmstate_pci_device (and all others) have its own
>>> version? Probably makes sense. Handling this should go into the
>>> generic code then and not be hacked into each structure using
>>> VMSTATE_INT32_LE().
>>
>> Proper solution here is to use subsections.
>> Each time that you call VMSTATE_PCI_DEVICE() it sends a subsection
>> there. Then we get the versioning by free. This is how I am thinking
>> it is the right way to do it.
>
> Yep, something like this.
>
>> virtio stuff: the more than I think about it, the easier way is to just
>> get rid of the whole mess and do something that is sensible.
>
> You are talking about VirtIOPCIProxy I guess?
> Yea, that is messy ...
I am talking about virtio_load() actually. How do you translate this to
a table?
- If at the beggining (and that load_config() reads the config from the
savevm
- and another if in the middle of a for
int virtio_load(VirtIODevice *vdev, QEMUFile *f)
{
int num, i, ret;
if (vdev->binding->load_config) {
ret = vdev->binding->load_config(vdev->binding_opaque, f);
if (ret)
return ret;
}
qemu_get_8s(f, &vdev->status);
qemu_get_8s(f, &vdev->isr);
qemu_get_be16s(f, &vdev->queue_sel);
qemu_get_be32s(f, &vdev->features);
vdev->config_len = qemu_get_be32(f);
qemu_get_buffer(f, vdev->config, vdev->config_len);
num = qemu_get_be32(f);
for (i = 0; i < num; i++) {
vdev->vq[i].vring.num = qemu_get_be32(f);
vdev->vq[i].pa = qemu_get_be64(f);
qemu_get_be16s(f, &vdev->vq[i].last_avail_idx);
if (vdev->vq[i].pa) {
virtqueue_init(&vdev->vq[i]);
}
if (vdev->binding->load_queue) {
ret = vdev->binding->load_queue(vdev->binding_opaque, i, f);
if (ret)
return ret;
}
}
virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
return 0;
}
Can we have something saner like:
int virtio_load(VirtIODevice *vdev, QEMUFile *f)
{
int num, i, ret;
qemu_get_be32s(f, &vdev->config_load_size);
qemu_get_buffer(f, &vdev->config_load_value, &vdev->config_load_size);
qemu_get_8s(f, &vdev->status);
qemu_get_8s(f, &vdev->isr);
qemu_get_be16s(f, &vdev->queue_sel);
qemu_get_be32s(f, &vdev->features);
vdev->config_len = qemu_get_be32(f);
qemu_get_buffer(f, vdev->config, vdev->config_len);
num = qemu_get_be32(f);
for (i = 0; i < num; i++) {
vdev->vq[i].vring.num = qemu_get_be32(f);
vdev->vq[i].pa = qemu_get_be64(f);
qemu_get_be16s(f, &vdev->vq[i].last_avail_idx);
qemu_get_be32s(f, &vdev->queue_size[i]);
qemu_get_buffer(f, &vdev->queue_value, &vdev->queue_size[i]);
}
/* load of state has ended, time to start configuring things */
if (vdev->binding->load_config) {
ret = vdev->binding->load_config(vdev->binding_opaque, f);
if (ret)
return ret;
}
for (i = 0; i < num; i++) {
if (vdev->vq[i].pa) {
virtqueue_init(&vdev->vq[i]);
if (vdev->binding->load_queue) {
ret = vdev->binding->load_queue(vdev->binding_opaque, i, f);
if (ret)
return ret;
}
}
}
virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
return 0;
}
I.e. we just reserved the space to load the stuff (0 is ok), and after
loading, We initialize things at virtio maintainers pace. Obviously the
load_queue/config stuff has to be changed to work from a local variable
instead of the savevm stream.
Later, Juan.
next prev parent reply other threads:[~2009-08-21 9:32 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-20 17:42 [Qemu-devel] [PATCH 00/23] New VMState table based load/save infrastructure Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 01/23] move useful type definitons to osdep.h Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 02/23] split do_loadvm() into do_loadvm() and load_vmstate() Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 03/23] move do_loadvm() to monitor.c Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 04/23] make load_vmstate() return errors Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 05/23] Use return value from load_state() call back Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 06/23] Add vmstate_load() and vmstate_save() functions Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 07/23] New VMstate save/load infrastructure Juan Quintela
2009-09-09 6:38 ` Michael S. Tsirkin
2009-08-20 17:42 ` [Qemu-devel] [PATCH 08/23] Add VMState support for pointers Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 09/23] Add VMState support for arrays Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 10/23] Port apic to new VMState design Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 11/23] Add VMState support for structs Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 12/23] Add VMState support for arrays of structs Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 13/23] Port i8254 to new VMState design Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 14/23] Add VMState support for int32_t check value Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 15/23] Add VMState support for variable sized arrays Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 16/23] Port PCI Bus to VMState design Juan Quintela
2009-08-21 8:32 ` Gerd Hoffmann
2009-08-21 9:04 ` [Qemu-devel] " Juan Quintela
2009-08-21 9:23 ` Gerd Hoffmann
2009-08-20 17:42 ` [Qemu-devel] [PATCH 17/23] Add VMState support for static sized buffers (uint_8) Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 18/23] Port PS2 devices to VMState design Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 19/23] Add VMState support for int32_t check value Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 20/23] Add version_id to PCIDevice Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 21/23] Port PCIDevice state to VMState Juan Quintela
2009-08-21 8:52 ` Gerd Hoffmann
2009-08-21 9:01 ` [Qemu-devel] " Juan Quintela
2009-08-21 9:14 ` Gerd Hoffmann
2009-08-21 9:30 ` Juan Quintela [this message]
2009-08-21 10:07 ` Gerd Hoffmann
2009-08-20 17:42 ` [Qemu-devel] [PATCH 22/23] Add VMState support to run a function after load Juan Quintela
2009-08-20 17:42 ` [Qemu-devel] [PATCH 23/23] Port ACPI to VMState Juan Quintela
2009-08-21 8:58 ` [Qemu-devel] [PATCH 00/23] New VMState table based load/save infrastructure Gerd Hoffmann
2009-08-21 9:12 ` [Qemu-devel] " Juan Quintela
2009-08-21 9:28 ` Gerd Hoffmann
2009-08-21 9:31 ` Juan Quintela
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=m3fxblwm3m.fsf@neno.mitica \
--to=quintela@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@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 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.