On Tue, 7 Jul 2020 at 11:40, Paolo Bonzini <pbonz...@redhat.com> wrote: > > On 03/07/20 20:58, Philippe Mathieu-Daudé wrote: > > The serial device mapped on the I/O bus hold a migratable > > SerialState. Keep the same version range from SerialState: > > > > 837 const VMStateDescription vmstate_serial = { > > 838 .name = "serial", > > 839 .version_id = 3, > > 840 .minimum_version_id = 2, > > > > Fixes: 10315a7089 ("serial: make SerialIO a sysbus device") > > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> > > --- > > hw/char/serial.c | 12 +++++++++++- > > 1 file changed, 11 insertions(+), 1 deletion(-) > > > > diff --git a/hw/char/serial.c b/hw/char/serial.c > > index 9eebcb27e7..c167b584fb 100644 > > --- a/hw/char/serial.c > > +++ b/hw/char/serial.c > > @@ -1002,12 +1002,22 @@ static void serial_io_realize(DeviceState *dev, > > Error **errp) > > sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq); > > } > > > > +static const VMStateDescription vmstate_serial_io = { > > + .name = "serial", > > + .version_id = 3, > > + .minimum_version_id = 2, > > + .fields = (VMStateField[]) { > > + VMSTATE_STRUCT(serial, SerialIO, 0, vmstate_serial, SerialState), > > + VMSTATE_END_OF_LIST() > > + } > > +}; > > + > > static void serial_io_class_init(ObjectClass *klass, void* data) > > { > > DeviceClass *dc = DEVICE_CLASS(klass); > > > > dc->realize = serial_io_realize; > > - /* No dc->vmsd: class has no migratable state */ > > + dc->vmsd = &vmstate_serial_io; > > } > > > > static void serial_io_instance_init(Object *o) > > > > Is there any difference between SerialMM and SerialIO at this point?
SerialIO insists on 1-byte wide accesses; SerialMM allows the creator of the device to specify the spacing between registers and the endianness. So I suppose SerialIO is kind of a subset of SerialMM. It looks like the only user of TYPE_SERIAL_IO is hw/mips/mipssim.c, Adding the migration state here would be a forwards migration compat break anyway, so I think we could just change that machine to use TYPE_SERIAL_MM and then delete TYPE_SERIAL_IO ? thanks -- PMM