[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 06/22] virtio-serial: implement per-device migrat
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH v9 06/22] virtio-serial: implement per-device migration calls |
Date: |
Tue, 24 Jun 2014 19:19:48 +0200 |
User-agent: |
StGit/0.17-dirty |
Signed-off-by: Greg Kurz <address@hidden>
Reviewed-by: Alexander Graf <address@hidden>
---
hw/char/virtio-serial-bus.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 9f1df84..3989722 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -521,14 +521,17 @@ static void vser_reset(VirtIODevice *vdev)
static void virtio_serial_save(QEMUFile *f, void *opaque)
{
- VirtIOSerial *s = VIRTIO_SERIAL(opaque);
+ /* The virtio device */
+ virtio_save(VIRTIO_DEVICE(opaque), f);
+}
+
+static void virtio_serial_save_device(VirtIODevice *vdev, QEMUFile *f)
+{
+ VirtIOSerial *s = VIRTIO_SERIAL(vdev);
VirtIOSerialPort *port;
uint32_t nr_active_ports;
unsigned int i, max_nr_ports;
- /* The virtio device */
- virtio_save(VIRTIO_DEVICE(s), f);
-
/* The config space */
qemu_put_be16s(f, &s->config.cols);
qemu_put_be16s(f, &s->config.rows);
@@ -666,21 +669,22 @@ static int fetch_active_ports_list(QEMUFile *f, int
version_id,
static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
{
- VirtIOSerial *s = VIRTIO_SERIAL(opaque);
- uint32_t max_nr_ports, nr_active_ports, ports_map;
- unsigned int i;
- int ret;
- uint32_t tmp;
-
if (version_id > 3) {
return -EINVAL;
}
/* The virtio device */
- ret = virtio_load(VIRTIO_DEVICE(s), f, version_id);
- if (ret) {
- return ret;
- }
+ return virtio_load(VIRTIO_DEVICE(opaque), f, version_id);
+}
+
+static int virtio_serial_load_device(VirtIODevice *vdev, QEMUFile *f,
+ int version_id)
+{
+ VirtIOSerial *s = VIRTIO_SERIAL(vdev);
+ uint32_t max_nr_ports, nr_active_ports, ports_map;
+ unsigned int i;
+ int ret;
+ uint32_t tmp;
if (version_id < 2) {
return 0;
@@ -1023,6 +1027,8 @@ static void virtio_serial_class_init(ObjectClass *klass,
void *data)
vdc->set_config = set_config;
vdc->set_status = set_status;
vdc->reset = vser_reset;
+ vdc->save = virtio_serial_save_device;
+ vdc->load = virtio_serial_load_device;
}
static const TypeInfo virtio_device_info = {
- [Qemu-devel] [PATCH v9 00/22] legacy virtio support for cross-endian targets, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 01/22] virtio-net: byteswap virtio-net header, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 02/22] virtio-serial: don't migrate the config space, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 03/22] virtio: introduce device specific migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 04/22] virtio-net: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 05/22] virtio-blk: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 06/22] virtio-serial: implement per-device migration calls,
Greg Kurz <=
- [Qemu-devel] [PATCH v9 07/22] virtio-balloon: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 08/22] virtio-rng: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 09/22] virtio: add subsections to the migration stream, Greg Kurz, 2014/06/24
- Re: [Qemu-devel] [PATCH v9 00/22] legacy virtio support for cross-endian targets, Michael S. Tsirkin, 2014/06/24
- [Qemu-devel] [PATCH v9 10/22] exec: introduce target_words_bigendian() helper, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 11/22] cpu: introduce CPUClass::virtio_is_big_endian(), Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 12/22] virtio: add endian-ambivalent support to VirtIODevice, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 13/22] virtio: memory accessors for endian-ambivalent targets, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 14/22] virtio: allow byte swapping for vring, Greg Kurz, 2014/06/24