From nobody Tue Feb 10 10:19:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496856214947563.9701585974102; Wed, 7 Jun 2017 10:23:34 -0700 (PDT) Received: from localhost ([::1]:45361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIeg3-0006nh-8e for importer@patchew.org; Wed, 07 Jun 2017 13:23:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIeaE-0000lU-US for qemu-devel@nongnu.org; Wed, 07 Jun 2017 13:17:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIeaA-0000k5-Tp for qemu-devel@nongnu.org; Wed, 07 Jun 2017 13:17:26 -0400 Received: from 6.mo178.mail-out.ovh.net ([46.105.53.132]:36627) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIeaA-0000j2-Nl for qemu-devel@nongnu.org; Wed, 07 Jun 2017 13:17:22 -0400 Received: from player728.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id 4241D3DCC5 for ; Wed, 7 Jun 2017 19:17:21 +0200 (CEST) Received: from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139]) (Authenticated sender: groug@kaod.org) by player728.ha.ovh.net (Postfix) with ESMTPA id 0571754007E; Wed, 7 Jun 2017 19:17:17 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Wed, 07 Jun 2017 19:17:17 +0200 Message-ID: <149685583778.12025.272004316108066026.stgit@bahia.lan> In-Reply-To: <149685579678.12025.9278446121024037161.stgit@bahia.lan> References: <149685579678.12025.9278446121024037161.stgit@bahia.lan> User-Agent: StGit/0.17.1-20-gc0b1b-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 3828341159950064102 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeljedriedugdduuddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.53.132 Subject: [Qemu-devel] [PATCH v3 4/5] xics: directly register ICPState objects to vmstate 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, Cedric Le Goater , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 The ICPState objects are currently registered to vmstate as qdev objects. Their instance ids are hence computed automatically in the migration code, and thus depends on the order the CPU cores were plugged. If the destination had its CPU cores plugged in a different order than the source, then ICPState objects will have different instance_ids and load the wrong state. Since CPU objects have a reliable cpu_index which is already used as instance_id in vmstate, let's use it for ICPState as well. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 330441ff7fe8..3d76b43876c5 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -348,10 +348,14 @@ static void icp_realize(DeviceState *dev, Error **err= p) } =20 qemu_register_reset(icp_reset, dev); + vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); } =20 static void icp_unrealize(DeviceState *dev, Error **errp) { + ICPState *icp =3D ICP(dev); + + vmstate_unregister(NULL, &vmstate_icp_server, icp); qemu_unregister_reset(icp_reset, dev); } =20 @@ -359,7 +363,6 @@ static void icp_class_init(ObjectClass *klass, void *da= ta) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - dc->vmsd =3D &vmstate_icp_server; dc->realize =3D icp_realize; dc->unrealize =3D icp_unrealize; }