On Thu, 23 Sept 2021 at 11:29, Philippe Mathieu-Daudé <f4...@amsat.org> wrote: > > On 9/23/21 07:16, Bin Meng wrote:> On Sun, Sep 19, 2021 at 2:07 AM > Philippe Mathieu-Daudé <f4...@amsat.org> wrote: > >> +static void mchp_pfsoc_mmuart_realize(DeviceState *dev, Error **errp) > >> +{ > >> + MchpPfSoCMMUartState *s = MCHP_PFSOC_UART(dev); > >> + > >> + qdev_prop_set_uint8(DEVICE(&s->serial_mm), "regshift", 2); > >> + qdev_prop_set_uint32(DEVICE(&s->serial_mm), "baudbase", 399193); > >> + qdev_prop_set_uint8(DEVICE(&s->serial_mm), "endianness", > >> + DEVICE_LITTLE_ENDIAN); > > > > It looks like serial_mm_init() does one more thing: > > > > qdev_set_legacy_instance_id(DEVICE(smm), base, 2); > > > > I am not sure what that is. > > I'll defer on Paolo / Marc-André for that part, I think this is for > migrating legacy (x86?) machines, which is not the case.
Yes, this is only needed for backwards-compatibility of incoming migration data with old versions of QEMU which implemented migration of devices with hand-rolled code. If a device didn't previously handle migration at all then it should not now be setting the legacy instance ID. Speaking of migration, I notice that this QOM conversion does not add a vmstate, which usually we do as part of the QOM conversion. The device is also missing a reset method. thanks -- PMM