From 517ff12c7d000fa1f5b1e989b22fb86a286f9cc2 Mon Sep 17 00:00:00 2001 From: Halil Pasic Date: Mon, 3 Jul 2017 23:34:14 +0200 Subject: s390x: vmstatify config migration for virtio-ccw 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 is 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 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Reviewed-by: Cornelia Huck Message-Id: <20170703213414.94298-1-pasic@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger --- hw/intc/s390_flic.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'hw/intc') diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index a26e90670f..a99a350d8e 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -17,6 +17,7 @@ #include "trace.h" #include "hw/qdev.h" #include "qapi/error.h" +#include "hw/s390x/s390-virtio-ccw.h" S390FLICState *s390_get_flic(void) { @@ -136,3 +137,30 @@ static void qemu_s390_flic_register_types(void) } type_init(qemu_s390_flic_register_types) + +const VMStateDescription vmstate_adapter_info = { + .name = "s390_adapter_info", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64(ind_offset, AdapterInfo), + /* + * We do not have to migrate neither the id nor the addresses. + * The id is set by css_register_io_adapter and the addresses + * are set based on the IndAddr objects after those get mapped. + */ + VMSTATE_END_OF_LIST() + }, +}; + +const VMStateDescription vmstate_adapter_routes = { + + .name = "s390_adapter_routes", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_STRUCT(adapter, AdapterRoutes, 1, vmstate_adapter_info, + AdapterInfo), + VMSTATE_END_OF_LIST() + } +}; -- cgit 1.4.1