From nobody Wed Nov 5 02:10:51 2025 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.zohomail.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 1501005916746328.9946461897714; Tue, 25 Jul 2017 11:05:16 -0700 (PDT) Received: from localhost ([::1]:33903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da4Cn-00063W-Dm for importer@patchew.org; Tue, 25 Jul 2017 14:05:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da47g-0001eV-Hp for qemu-devel@nongnu.org; Tue, 25 Jul 2017 13:59:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1da47d-0001Nw-Hh for qemu-devel@nongnu.org; Tue, 25 Jul 2017 13:59:56 -0400 Received: from 15.mo5.mail-out.ovh.net ([178.33.107.29]:55023) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1da47d-0001NH-B3 for qemu-devel@nongnu.org; Tue, 25 Jul 2017 13:59:53 -0400 Received: from player760.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id C38C01164EB for ; Tue, 25 Jul 2017 19:59:51 +0200 (CEST) Received: from [192.168.0.243] (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139]) (Authenticated sender: groug@kaod.org) by player760.ha.ovh.net (Postfix) with ESMTPA id 5EE3320077; Tue, 25 Jul 2017 19:59:44 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 25 Jul 2017 19:59:44 +0200 Message-ID: <150100558414.27487.6550654617210440325.stgit@bahia> In-Reply-To: <150100547373.27487.3154210751350595400.stgit@bahia> References: <150100547373.27487.3154210751350595400.stgit@bahia> 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: 9734249121385322969 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelkedrheehgdduvddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.107.29 Subject: [Qemu-devel] [for-2.11 PATCH 08/26] spapr_drc: add unrealize method to physical DRC class 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: "Michael S. Tsirkin" , Michael Roth , qemu-ppc@nongnu.org, Bharata B Rao , Paolo Bonzini , Daniel Henrique Barboza , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 When hot-unplugging a PHB, all its PCI DRC connectors get unrealized. This patch adds an unrealize method to the physical DRC class, in order to undo registrations performed in realize_physical(). Signed-off-by: Greg Kurz --- hw/ppc/spapr_drc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index d72453bcb42f..105ce85b6d04 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -626,12 +626,28 @@ static void realize_physical(DeviceState *d, Error **= errp) qemu_register_reset(drc_physical_reset, drcp); } =20 +static void unrealize_physical(DeviceState *d, Error **errp) +{ + sPAPRDRCPhysical *drcp =3D SPAPR_DRC_PHYSICAL(d); + Error *local_err =3D NULL; + + unrealize(d, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + vmstate_unregister(DEVICE(drcp), &vmstate_spapr_drc_physical, drcp); + qemu_unregister_reset(drc_physical_reset, drcp); +} + static void spapr_drc_physical_class_init(ObjectClass *k, void *data) { DeviceClass *dk =3D DEVICE_CLASS(k); sPAPRDRConnectorClass *drck =3D SPAPR_DR_CONNECTOR_CLASS(k); =20 dk->realize =3D realize_physical; + dk->unrealize =3D unrealize_physical; drck->dr_entity_sense =3D physical_entity_sense; drck->isolate =3D drc_isolate_physical; drck->unisolate =3D drc_unisolate_physical;