From nobody Tue Nov 4 01:06:12 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 15051643727661008.2615830425228; Mon, 11 Sep 2017 14:12:52 -0700 (PDT) Received: from localhost ([::1]:60603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drW0h-00005A-Jq for importer@patchew.org; Mon, 11 Sep 2017 17:12:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drVz0-0007SL-NC for qemu-devel@nongnu.org; Mon, 11 Sep 2017 17:11:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drVyw-00014t-Ky for qemu-devel@nongnu.org; Mon, 11 Sep 2017 17:11:06 -0400 Received: from 16.mo1.mail-out.ovh.net ([178.33.104.224]:34636) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drVyw-000145-Dc for qemu-devel@nongnu.org; Mon, 11 Sep 2017 17:11:02 -0400 Received: from player169.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 090A7931F4 for ; Mon, 11 Sep 2017 23:11:01 +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 player169.ha.ovh.net (Postfix) with ESMTPA id B91C2580075; Mon, 11 Sep 2017 23:10:57 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Mon, 11 Sep 2017 23:10:57 +0200 Message-ID: <150516425752.1593.1536226898929735667.stgit@bahia.lan> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 18150632398564792805 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrgedtgdduieegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.104.224 Subject: [Qemu-devel] [PATCH v2] spapr_cpu_core: cleaning up qdev_get_machine() calls 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: Daniel Henrique Barboza , qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 This patch removes the qdev_get_machine() calls that are made in spapr_cpu_core.c in situations where we can get an existing pointer for the MachineState by either passing it as an argument to the function or by using other already available pointers. Credits to Daniel Henrique Barboza for the idea and the changelog text. Signed-off-by: Greg Kurz --- v2: - fixed typo in spapr_cpu_reset() --- hw/ppc/spapr_cpu_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index dc9df0d393d1..0f32532abe99 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -73,8 +73,8 @@ void spapr_cpu_parse_features(sPAPRMachineState *spapr) =20 static void spapr_cpu_reset(void *opaque) { - sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); PowerPCCPU *cpu =3D opaque; + sPAPRMachineState *spapr =3D SPAPR_MACHINE(cpu->vhyp); CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; =20 @@ -162,10 +162,10 @@ static void spapr_cpu_core_unrealizefn(DeviceState *d= ev, Error **errp) g_free(sc->threads); } =20 -static void spapr_cpu_core_realize_child(Object *child, Error **errp) +static void spapr_cpu_core_realize_child(Object *child, + sPAPRMachineState *spapr, Error *= *errp) { Error *local_err =3D NULL; - sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); CPUState *cs =3D CPU(child); PowerPCCPU *cpu =3D POWERPC_CPU(cs); Object *obj; @@ -254,7 +254,7 @@ static void spapr_cpu_core_realize(DeviceState *dev, Er= ror **errp) for (j =3D 0; j < cc->nr_threads; j++) { obj =3D sc->threads + j * size; =20 - spapr_cpu_core_realize_child(obj, &local_err); + spapr_cpu_core_realize_child(obj, spapr, &local_err); if (local_err) { goto err; }