From patchwork Mon Feb 27 14:29:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 732909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vX56h2Mkrz9sCg for ; Tue, 28 Feb 2017 02:22:20 +1100 (AEDT) Received: from localhost ([::1]:53571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciN7x-0004B7-Md for incoming@patchwork.ozlabs.org; Mon, 27 Feb 2017 10:22:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMM0-00032w-FV for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLw-0008K1-RO for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:44 -0500 Received: from 9.mo6.mail-out.ovh.net ([87.98.171.146]:57243) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLw-0008Jf-Kb for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:40 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 87392B33D4 for ; Mon, 27 Feb 2017 15:32:39 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player761.ha.ovh.net (Postfix) with ESMTPSA id 1E5E94800C7; Mon, 27 Feb 2017 15:31:29 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:31 +0100 Message-Id: <1488205773-30436-25-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4054647041003785190 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 87.98.171.146 Subject: [Qemu-devel] [PATCH v4 24/26] ppc/xics: move ics-simple post_load under the machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- hw/intc/xics.c | 10 ---------- hw/ppc/spapr.c | 18 +++++++----------- include/hw/ppc/xics.h | 1 - 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 159cd131420a..ce6e8d75b891 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -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; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 1d0daef5ad3e..e097ff8de1a4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1285,6 +1285,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 @@ -2925,16 +2932,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); @@ -2980,7 +2977,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 = { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 2514cfd86ea9..007ee2f16d16 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -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