From nobody Tue Feb 10 15:45:55 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 1528938430961201.75610314032315; Wed, 13 Jun 2018 18:07:10 -0700 (PDT) Received: from localhost ([::1]:37565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTGjG-000478-62 for importer@patchew.org; Wed, 13 Jun 2018 21:07:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTGh8-0002mu-Ti for qemu-devel@nongnu.org; Wed, 13 Jun 2018 21:05:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTGh7-0001f1-Gk for qemu-devel@nongnu.org; Wed, 13 Jun 2018 21:04:58 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:38227) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fTGh7-0001dI-22; Wed, 13 Jun 2018 21:04:57 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 415llR1GZfz9s5R; Thu, 14 Jun 2018 11:04:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1528938291; bh=gSNGh0EyJWwqn6pLIOcirIWxSQ7h4g79OvOAlppcP+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hx2EM7Wj2qs0DnxHemojMWxsuhH2AnpRf/e9UrwhUwsfyJ8Jt8b2LbohEZXyu8ekB akHD3mzVYe0dXJTIz6+bx1TFi0gxhhbnR98lOPFV14g2+0gJEFAYN3TVn7H1uMIA+h lw/UAdQeIdmSiiGapC9PPgM1OmHgtgif/KlXnObk= From: David Gibson To: groug@kaod.org Date: Thu, 14 Jun 2018 11:04:44 +1000 Message-Id: <20180614010446.30854-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614010446.30854-1-david@gibson.dropbear.id.au> References: <20180614010446.30854-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PATCHv2 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-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 f4c41d89d6..f7cf33f547 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -186,6 +186,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(), @@ -196,6 +216,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