From a7ff1212e99ff072dfb8db62d5e6d8ce9f4b486c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Mon, 27 Feb 2017 15:29:31 +0100 Subject: ppc/xics: move ics-simple post_load under the machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ICS object uses a post_load() handler which is implicitly relying on the fact that the internal state of the ICS and ICP objects has been restored but this is not guaranteed. So, let's move the code under the post_load() handler of the machine where we know the objects have been fully restored. The icp_resend() handler of the XICSFabric QOM interface is also removed as it is now obsolete. Signed-off-by: Cédric Le Goater Signed-off-by: David Gibson --- hw/ppc/spapr.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'hw/ppc/spapr.c') diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 653926095e..76596a35c5 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1341,6 +1341,13 @@ static int spapr_post_load(void *opaque, int version_id) sPAPRMachineState *spapr = (sPAPRMachineState *)opaque; int err = 0; + if (!object_dynamic_cast(OBJECT(spapr->ics), TYPE_ICS_KVM)) { + int i; + for (i = 0; i < spapr->nr_servers; i++) { + icp_resend(&spapr->icps[i]); + } + } + /* In earlier versions, there was no separate qdev for the PAPR * RTC, so the RTC offset was stored directly in sPAPREnvironment. * So when migrating from those versions, poke the incoming offset @@ -2981,16 +2988,6 @@ static ICPState *spapr_icp_get(XICSFabric *xi, int server) return (server < spapr->nr_servers) ? &spapr->icps[server] : NULL; } -static void spapr_icp_resend(XICSFabric *xi) -{ - sPAPRMachineState *spapr = SPAPR_MACHINE(xi); - int i; - - for (i = 0; i < spapr->nr_servers; i++) { - icp_resend(&spapr->icps[i]); - } -} - static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -3040,7 +3037,6 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) xic->ics_get = spapr_ics_get; xic->ics_resend = spapr_ics_resend; xic->icp_get = spapr_icp_get; - xic->icp_resend = spapr_icp_resend; } static const TypeInfo spapr_machine_info = { -- cgit v1.2.3