Halil Pasic <pa...@linux.vnet.ibm.com> wrote: > Let's vmstatify virtio_ccw_save_config and virtio_ccw_load_config for > flexibility (extending using subsections) and for fun. > > To achieve this we need to hack the config_vector, which is VirtIODevice > (that is common virtio) state, in the middle of the VirtioCcwDevice state > representation. This somewhat ugly, but we have no choice because the > stream format needs to be preserved. > > Almost no changes in behavior. Exception is everything that comes with > vmstate like extra bookkeeping about what's in the stream, and maybe some > extra checks and better error reporting. > > Signed-off-by: Halil Pasic <pa...@linux.vnet.ibm.com>
Reviewed-by: Juan Quintela <quint...@redhat.com> > +static void subch_dev_pre_save(void *opaque) > +{ > + SubchDev *s = opaque; > + > + /* Prepare remote_schid for save */ > + s->migrated_schid = s->schid; > +} > + > +static int subch_dev_post_load(void *opaque, int version_id) > +{ > + > + SubchDev *s = opaque; > + > + /* Re-assign the subchannel to remote_schid if necessary */ > + if (s->migrated_schid != s->schid) { > + if (css_find_subch(true, s->cssid, s->ssid, s->schid) == s) { I am assuming this is somehow similar to old_s = channel_subsys.css[s->cssid]->sch_set[s->ssid]->sch[old_schid]; > - qemu_put_be32(f, s->curr_status.pmcw.intparm); > - qemu_put_be16(f, s->curr_status.pmcw.flags); > - qemu_put_be16(f, s->curr_status.pmcw.devno); > - qemu_put_byte(f, s->curr_status.pmcw.lpm); > - qemu_put_byte(f, s->curr_status.pmcw.pnom); > - qemu_put_byte(f, s->curr_status.pmcw.lpum); > - qemu_put_byte(f, s->curr_status.pmcw.pim); > - qemu_put_be16(f, s->curr_status.pmcw.mbi); > - qemu_put_byte(f, s->curr_status.pmcw.pom); > - qemu_put_byte(f, s->curr_status.pmcw.pam); I hope it somehow makes sense, I am having trouble following that you have fields named: pim, pam, pom, pnom, lpm, lpum, mda, mba ..... looks like hell for reviewing O:-) And I thought that x86 was weird because it used all three letters acronyms O:-) Later, Juan.