From nobody Tue Feb 10 11:55: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.zohomail.com; dkim=fail; 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 1528873308411304.1143290163934; Wed, 13 Jun 2018 00:01:48 -0700 (PDT) Received: from localhost ([::1]:60278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSzmq-00063d-BS for importer@patchew.org; Wed, 13 Jun 2018 03:01:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSzic-0002xK-B3 for qemu-devel@nongnu.org; Wed, 13 Jun 2018 02:57:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSziZ-0006a1-Rk for qemu-devel@nongnu.org; Wed, 13 Jun 2018 02:57:22 -0400 Received: from ozlabs.org ([203.11.71.1]:42469) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSziZ-0006XE-FM; Wed, 13 Jun 2018 02:57:19 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 415HcT5Qntz9s5N; Wed, 13 Jun 2018 16:57:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1528873033; bh=VB7RM/qAOXmwnX8iVcTJRRAIeMF9Fr0+jIopit6BXxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPC6lkC3A9bNYsVN5V2HYR51WHdbmvLedMPgKxHaQN3+iEED4Iu1K3Ye2e3BE1ZeW GQ4DDBDin+/xU1JqGpPwNQ/cXV3iOzbe23Rnn7WbzrKV5HYUJXhoeiTgy6sNZD00aM qsFHgAKXlRJqpkz4dDyV4TLIqmPt1saiesALGQsU= From: David Gibson To: groug@kaod.org Date: Wed, 13 Jun 2018 16:57:05 +1000 Message-Id: <20180613065707.30766-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613065707.30766-1-david@gibson.dropbear.id.au> References: <20180613065707.30766-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PATCH 5/7] pnv: Add cpu unrealize path 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: David Gibson , qemu-ppc@nongnu.org, clg@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently we don't have any unrealize path for pnv cpu cores. We get away with this because we don't yet support cpu hotplug for pnv. However, we're going to want it eventually, and in the meantime, it makes it non-obvious why there are a bunch of allocations on the realize() path that don't have matching frees. So, implement the missing unrealize path. Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- hw/ppc/pnv_core.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index c9648fd1ad..c70dbbe056 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -192,6 +192,26 @@ err: error_propagate(errp, local_err); } =20 +static void pnv_unrealize_vcpu(PowerPCCPU *cpu) +{ + qemu_unregister_reset(pnv_cpu_reset, cpu); + object_unparent(cpu->intc); + cpu_remove_sync(CPU(cpu)); + object_unparent(OBJECT(cpu)); +} + +static void pnv_core_unrealize(DeviceState *dev, Error **errp) +{ + PnvCore *pc =3D PNV_CORE(dev); + CPUCore *cc =3D CPU_CORE(dev); + int i; + + for (i =3D 0; i < cc->nr_threads; i++) { + pnv_unrealize_vcpu(pc->threads[i]); + } + g_free(pc->threads); +} + static Property pnv_core_properties[] =3D { DEFINE_PROP_UINT32("pir", PnvCore, pir, 0), DEFINE_PROP_END_OF_LIST(), @@ -202,6 +222,7 @@ static void pnv_core_class_init(ObjectClass *oc, void *= data) DeviceClass *dc =3D DEVICE_CLASS(oc); =20 dc->realize =3D pnv_core_realize; + dc->unrealize =3D pnv_core_unrealize; dc->props =3D pnv_core_properties; } =20 --=20 2.17.1