This adds a hook which will be used to reset ICS state before incoming migration.
Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> --- hw/intc/xics.c | 13 +++++++++++++ include/hw/ppc/xics.h | 1 + 2 files changed, 14 insertions(+) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 88ef9ef..39c33bc 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -550,6 +550,18 @@ static void ics_dispatch_pre_save(void *opaque) } } +static int ics_dispatch_pre_load(void *opaque) +{ + ICSState *ics = opaque; + ICSStateClass *info = ICS_GET_CLASS(ics); + + if (info->pre_load) { + return info->pre_load(ics); + } + + return 0; +} + static int ics_dispatch_post_load(void *opaque, int version_id) { ICSState *ics = opaque; @@ -582,6 +594,7 @@ static const VMStateDescription vmstate_ics = { .minimum_version_id = 1, .minimum_version_id_old = 1, .pre_save = ics_dispatch_pre_save, + .pre_load = ics_dispatch_pre_load, .post_load = ics_dispatch_post_load, .fields = (VMStateField []) { /* Sanity check */ diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 02bbe31..4b30e9a 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -126,6 +126,7 @@ struct ICSStateClass { DeviceClass parent_class; void (*pre_save)(ICSState *s); + int (*pre_load)(ICSState *s); int (*post_load)(ICSState *s, int version_id); }; -- 1.8.4.rc4