[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 07/37] serial: register vmsd with DeviceClass
From: |
Marc-André Lureau |
Subject: |
[PATCH v4 07/37] serial: register vmsd with DeviceClass |
Date: |
Wed, 20 Nov 2019 19:24:12 +0400 |
Migration from old to new code works, however the other way fails for
devices that use serial_init/serial_mm_init with "base", used as
instance_id previously.
(with qdev_set_legacy_instance_id, the alias_id is only used in
savevm.c:find_se(), and thus can only be used to match against
"legacy" instance id values. On new code, instance_id is generated
incrementally from 0 with calculate_new_instance_id(), based on
"qdev-path/vmsd-name")
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/char/serial.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index e0a5bec290..0c7b9ae45a 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -990,8 +990,7 @@ SerialState *serial_init(int base, qemu_irq irq, int
baudbase,
s->baudbase = baudbase;
qemu_chr_fe_init(&s->chr, chr, &error_abort);
serial_realize_core(s, &error_fatal);
-
- vmstate_register(NULL, base, &vmstate_serial, s);
+ qdev_set_legacy_instance_id(dev, base, 2);
qdev_init_nofail(dev);
memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8);
@@ -1005,6 +1004,7 @@ static void serial_class_init(ObjectClass *klass, void
*data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->user_creatable = false;
+ dc->vmsd = &vmstate_serial;
}
static const TypeInfo serial_info = {
@@ -1068,7 +1068,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
qemu_chr_fe_init(&s->chr, chr, &error_abort);
serial_realize_core(s, &error_fatal);
- vmstate_register(NULL, base, &vmstate_serial, s);
+ qdev_set_legacy_instance_id(dev, base, 2);
qdev_init_nofail(dev);
memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], s,
--
2.24.0
- [PATCH v4 00/37] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR, Marc-André Lureau, 2019/11/20
- [PATCH v4 01/37] qdev: remove unused qdev_prop_int64, Marc-André Lureau, 2019/11/20
- [PATCH v4 02/37] sysbus: remove unused sysbus_try_create*, Marc-André Lureau, 2019/11/20
- [PATCH v4 03/37] sysbus: remove outdated comment, Marc-André Lureau, 2019/11/20
- [PATCH v4 04/37] chardev: generate an internal id when none given, Marc-André Lureau, 2019/11/20
- [PATCH v4 06/37] serial: initial qom-ification, Marc-André Lureau, 2019/11/20
- [PATCH v4 07/37] serial: register vmsd with DeviceClass,
Marc-André Lureau <=
- [PATCH v4 05/37] serial-pci-multi: factor out multi_serial_get_port_count(), Marc-André Lureau, 2019/11/20
- [PATCH v4 08/37] serial: add "chardev" property, Marc-André Lureau, 2019/11/20
- [PATCH v4 09/37] serial: add "baudbase" property, Marc-André Lureau, 2019/11/20
- [PATCH v4 10/37] serial: realize the serial device, Marc-André Lureau, 2019/11/20
- [PATCH v4 11/37] serial: replace serial_exit_core() with unrealize, Marc-André Lureau, 2019/11/20
- [PATCH v4 12/37] serial: start making SerialMM a sysbus device, Marc-André Lureau, 2019/11/20