From nobody Tue Feb 10 04:13:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1676281509; cv=none; d=zohomail.com; s=zohoarc; b=KL4fh4/gIDxLEEPAmJDDgfdHYRwzEzohXKr0joF12Kay5UjMxRSuL/i1ZK8/hPxJWpcKGkZHdreMHjP7ZS2Gp5/lq/TV6OfdAZFn9eINcZcplFdqa5wwHz2JlrOryKSeZFhUZOVtxhoVZjDAa2z2hOKtBrLzf/Mz+ndzJEsFkZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676281509; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zgVnUMK9+pIT3W/8j2WSrbf3HAOPn+BO7lZPJvpPank=; b=YEUAlBPWdFD0AJYXaHeozmtaqV/Ej7yqRdRhjGwtd+xeB3rh7n+9wpwbX7VFaqeoo7I/1WFAEu1ynId5FKlW8IIwb1/U6xzPVhaLj+fhl1P1bnCmpsJaVbnXuFn85kfE29TXT9Q/iV8jCMY3pFdal4R92Ley1GlnlLfhh28l2/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676281509328274.6026967863411; Mon, 13 Feb 2023 01:45:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRVNJ-00048G-78; Mon, 13 Feb 2023 04:43:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRVND-0003uz-6s for qemu-devel@nongnu.org; Mon, 13 Feb 2023 04:43:48 -0500 Received: from mga12.intel.com ([192.55.52.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRVN7-0002cM-5N for qemu-devel@nongnu.org; Mon, 13 Feb 2023 04:43:46 -0500 Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2023 01:43:40 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.112]) by fmsmga007.fm.intel.com with ESMTP; 13 Feb 2023 01:43:37 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676281421; x=1707817421; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JL9RDMAGfXlkn3TxhWlBENp4siXFvnya68ifaAVkhsY=; b=KG9bRQf384hZ39tobD3wvaQZDzF+vB0W+J2d7w4bYjYzsyuzdatJBRvx W+xMAmUb33DnzV8fAlMd1ohCAJfeRLYZBr77z/sM4s07YtQE35LtUbeFF I88G+4RWjFSmzBIvGDlO8AkUy7wgZGUBMSLDo56iW+kQK1IA3NWv3GRSw TcX78hjqmUtLM0zEDD/J/dR9thRjCFcUjxyGcQkqaffytpRfixTvlP5xt WJXxpgLwYwXRuU98ibPQvLmv60VY0EOBi68GEXZ0zNuN5dZMUfl1l9zqJ sElxq9kgLwyO3RGZdJn//wpDaCSA5gLU6BJWfRu4OLXE0Yj6/Vs5elH0X Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="310486470" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="310486470" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="670759842" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="670759842" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , "Michael S . Tsirkin" , Richard Henderson , Paolo Bonzini , Eric Blake , Markus Armbruster Cc: qemu-devel@nongnu.org, Zhenyu Wang , Dapeng Mi , Zhuocheng Ding , Robert Hoo , Sean Christopherson , Like Xu , Zhao Liu Subject: [RFC 10/52] machine: Replace MachineState.topo.smp access with topology helpers Date: Mon, 13 Feb 2023 17:49:53 +0800 Message-Id: <20230213095035.158240-11-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230213095035.158240-1-zhao1.liu@linux.intel.com> References: <20230213095035.158240-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=192.55.52.136; envelope-from=zhao1.liu@linux.intel.com; helo=mga12.intel.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1676281510468100001 Content-Type: text/plain; charset="utf-8" From: Zhao Liu In cpu_hierarchy_to_string(), the access to MachineState.topo.smp can be replaced by topology helpers. But because machine_parse_smp_config() is used to adjust MachineState.topo.smp, there's no need to replace with helpers. Signed-off-by: Zhao Liu --- hw/core/machine-topo.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/core/machine-topo.c b/hw/core/machine-topo.c index e0ec07b53d42..cdbe65ffd9fd 100644 --- a/hw/core/machine-topo.c +++ b/hw/core/machine-topo.c @@ -185,18 +185,20 @@ static char *cpu_hierarchy_to_string(MachineState *ms) MachineClass *mc =3D MACHINE_GET_CLASS(ms); GString *s =3D g_string_new(NULL); =20 - g_string_append_printf(s, "sockets (%u)", ms->topo.smp.sockets); + g_string_append_printf(s, "sockets (%u)", machine_topo_get_sockets(ms)= ); =20 if (mc->smp_props.dies_supported) { - g_string_append_printf(s, " * dies (%u)", ms->topo.smp.dies); + g_string_append_printf(s, " * dies (%u)", machine_topo_get_dies(ms= )); } =20 if (mc->smp_props.clusters_supported) { - g_string_append_printf(s, " * clusters (%u)", ms->topo.smp.cluster= s); + g_string_append_printf(s, " * clusters (%u)", + machine_topo_get_clusters(ms)); } =20 - g_string_append_printf(s, " * cores (%u)", ms->topo.smp.cores); - g_string_append_printf(s, " * threads (%u)", ms->topo.smp.threads); + g_string_append_printf(s, " * cores (%u)", machine_topo_get_smp_cores(= ms)); + g_string_append_printf(s, " * threads (%u)", + machine_topo_get_smp_threads(ms)); =20 return g_string_free(s, false); } --=20 2.34.1