From nobody Wed Nov 5 05:26:59 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 1505163261999692.1341992028598; Mon, 11 Sep 2017 13:54:21 -0700 (PDT) Received: from localhost ([::1]:60514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drVin-0007tC-CQ for importer@patchew.org; Mon, 11 Sep 2017 16:54:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drVhW-000763-2f for qemu-devel@nongnu.org; Mon, 11 Sep 2017 16:53:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drVhR-0006Is-8x for qemu-devel@nongnu.org; Mon, 11 Sep 2017 16:53:02 -0400 Received: from 2.mo1.mail-out.ovh.net ([178.32.119.250]:38371) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drVhR-0006IH-27 for qemu-devel@nongnu.org; Mon, 11 Sep 2017 16:52:57 -0400 Received: from player169.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 8BB7B93148 for ; Mon, 11 Sep 2017 22:52:55 +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 47129580082; Mon, 11 Sep 2017 22:52:52 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Mon, 11 Sep 2017 22:52:52 +0200 Message-ID: <150516317201.28067.2144053652052053337.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: 17845232048495696357 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrgedtgdduiedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.119.250 Subject: [Qemu-devel] [PATCH] 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 --- 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..e26279116736 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; }