]> git.proxmox.com Git - mirror_qemu.git/commitdiff
ppc/xics: move ics-simple post_load under the machine
authorCédric Le Goater <clg@kaod.org>
Mon, 27 Feb 2017 14:29:31 +0000 (15:29 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 1 Mar 2017 00:23:40 +0000 (11:23 +1100)
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 <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/intc/xics.c
hw/ppc/spapr.c
include/hw/ppc/xics.h

index 159cd131420a2f4d080af5e611b653adf9342fab..ce6e8d75b8916f78c8c796e7c43df6c19f7d9c44 100644 (file)
@@ -551,15 +551,6 @@ static void ics_simple_reset(DeviceState *dev)
     }
 }
 
-static int ics_simple_post_load(ICSState *ics, int version_id)
-{
-    XICSFabric *xi = ics->xics;
-    XICSFabricClass *xic = XICS_FABRIC_GET_CLASS(xi);
-
-    xic->icp_resend(xi);
-    return 0;
-}
-
 static void ics_simple_dispatch_pre_save(void *opaque)
 {
     ICSState *ics = opaque;
@@ -647,7 +638,6 @@ static void ics_simple_class_init(ObjectClass *klass, void *data)
     dc->props = ics_simple_properties;
     dc->vmsd = &vmstate_ics_simple;
     dc->reset = ics_simple_reset;
-    isc->post_load = ics_simple_post_load;
     isc->reject = ics_simple_reject;
     isc->resend = ics_simple_resend;
     isc->eoi = ics_simple_eoi;
index 653926095e59dd100ba17cb380a7ea4dc25b6e92..76596a35c5fb75b0696ad96b25ff97fd85bdb6a4 100644 (file)
@@ -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 = {
index 2514cfd86ea990f10cb503a991609fd5772d61ee..007ee2f16d1616cf95e6c71a39437ee5330456ac 100644 (file)
@@ -156,7 +156,6 @@ typedef struct XICSFabricClass {
     ICSState *(*ics_get)(XICSFabric *xi, int irq);
     void (*ics_resend)(XICSFabric *xi);
     ICPState *(*icp_get)(XICSFabric *xi, int server);
-    void (*icp_resend)(XICSFabric *xi);
 } XICSFabricClass;
 
 #define XICS_IRQS_SPAPR               1024