From nobody Fri Dec 19 07:15:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636625062; cv=none; d=zohomail.com; s=zohoarc; b=UPt0P4i2xh6XD8zXL9l8dfo2wxH3h2l3qoosSk2Ep/hNkllNI6B2yXo1Bk9W/f6nm2zROv29sPJ7e4sYKHULX+kLO1kcFVw5SpqHhIfCW9eUZJKVghdhavW5ogY+ASzyR2JE8r8DobxTvieTZBQX3ZEpH/p8wMQoTFjIiBPiqjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636625062; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=K6REFy2Z9s6d+bG385Dx3esh0VGm1oiX7Asv3HUk+NQ=; b=VBIJ3kZb38vgDt3Yo4dRKHlzzrpiXwLhfKzq4BqVW8pUUn+UPxczXW9ClAygiux93hBh7CeerL40p+Qy0oX5H21pOnZgNPjcXc0KKII4koz7a1LHxmM24DQGs5gLwbrIMXej73w3yPxVDVoija5P33pfei6k2/J94IdZxiQdg54= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1636625062590569.7903088919338; Thu, 11 Nov 2021 02:04:22 -0800 (PST) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-F1vVyFZPMJuSGIsUIBuY4A-1; Thu, 11 Nov 2021 05:04:20 -0500 Received: by mail-wr1-f71.google.com with SMTP id f3-20020a5d50c3000000b00183ce1379feso922181wrt.5 for ; Thu, 11 Nov 2021 02:04:20 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id c1sm2499021wrt.14.2021.11.11.02.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 02:04:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636625061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K6REFy2Z9s6d+bG385Dx3esh0VGm1oiX7Asv3HUk+NQ=; b=NdRSpMtJmIQbxSNiSkygNV8XFYZgPnSuLh5VjQmjJqM9JI4519jXJr8OBO/DT/DJQ4MWVA OIsfI6NdHORsNecumDVjGT2lTHfMvLM94Cv9XhNRkZ5hnOFRW95ToEo8anmkwSNHn8Yokv sIl/zicNpmZUBeAvE58sv5K4qRzFPm0= X-MC-Unique: F1vVyFZPMJuSGIsUIBuY4A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K6REFy2Z9s6d+bG385Dx3esh0VGm1oiX7Asv3HUk+NQ=; b=2d1vAlghv2og7uYIpvsE7ZNnoAuMmytH7NxP9Q4yHB6wtmuxlZxt9xIkBRXqYgvmIT wTI3JoK4A4+1BRvzSRJBf+xnM8F2bQrhDm3oZ6d+jmWWI2um6F5ThBTDLTx3L8Anz7TC dODS0DZWJ2Xmv0Y8HQyAThT7pybmL5P1kExCwMLv9tzk6fR12JjzcDv3yM5VDuH4RLzp yjmgNk+c97nCABBDdNBAFw+utuezfqNjj0mzgsqcEGEzGIx6W+RprX9VuVrl752Txamq t2YmarZ5VMv6bkRaagxNwpkNjAlNpCd20f1cfIko0ub0oQ8mKPET6Nb1r7aKHZYPU48+ w54A== X-Gm-Message-State: AOAM532pOoUnFlSGMx0UmjjSZmDDJ5+cEDkI2YA4HhINi4WZy3Qmdfbp PBxedgHTgL+pTkoLTO4lPQwlp3ztieUq5ttskucEjHEggit8r5mDkSDifZ3nY++6ygS6y0ZaVsv ZIIzGE/uU0GNC2g== X-Received: by 2002:a5d:4cd1:: with SMTP id c17mr7402543wrt.31.1636625059368; Thu, 11 Nov 2021 02:04:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYPottiScYoGYWMuBHI1kt1CFDM3B+TKHa93TDks3lkapvWVBg4p8N7CqCNRRw0CvNn/bbEQ== X-Received: by 2002:a5d:4cd1:: with SMTP id c17mr7402513wrt.31.1636625059207; Thu, 11 Nov 2021 02:04:19 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Yanan Wang , Marcel Apfelbaum , Eduardo Habkost , Andrew Jones Subject: [PATCH-for-6.2 v3 6/6] hw/core: Rename smp_parse() -> machine_parse_smp_config() Date: Thu, 11 Nov 2021 11:03:51 +0100 Message-Id: <20211111100351.2153662-7-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111100351.2153662-1-philmd@redhat.com> References: <20211111100351.2153662-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636625063160100001 All methods related to MachineState are prefixed with "machine_". smp_parse() does not need to be an exception. Rename it and const'ify the SMPConfiguration argument, since it doesn't need to be modified. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang --- include/hw/boards.h | 3 ++- hw/core/machine-smp.c | 6 ++++-- hw/core/machine.c | 2 +- tests/unit/test-smp-parse.c | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 9c1c1901046..7597cec4400 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -34,7 +34,8 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(Mach= ineState *machine); void machine_set_cpu_numa_node(MachineState *machine, const CpuInstanceProperties *props, Error **errp); -void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp); +void machine_parse_smp_config(MachineState *ms, + const SMPConfiguration *config, Error **errp= ); =20 /** * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devic= es diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index 116a0cbbfab..2cbfd574293 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -44,7 +44,8 @@ static char *cpu_hierarchy_to_string(MachineState *ms) } =20 /* - * smp_parse - Generic function used to parse the given SMP configuration + * machine_parse_smp_config: Generic function used to parse the given + * SMP configuration * * Any missing parameter in "cpus/maxcpus/sockets/cores/threads" will be * automatically computed based on the provided ones. @@ -63,7 +64,8 @@ static char *cpu_hierarchy_to_string(MachineState *ms) * introduced topology members which are likely to be target specific shou= ld * be directly set as 1 if they are omitted (e.g. dies for PC since 4.1). */ -void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp) +void machine_parse_smp_config(MachineState *ms, + const SMPConfiguration *config, Error **errp) { MachineClass *mc =3D MACHINE_GET_CLASS(ms); unsigned cpus =3D config->has_cpus ? config->cpus : 0; diff --git a/hw/core/machine.c b/hw/core/machine.c index 26ec54e7261..a2d3c9969d9 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -760,7 +760,7 @@ static void machine_set_smp(Object *obj, Visitor *v, co= nst char *name, return; } =20 - smp_parse(ms, config, errp); + machine_parse_smp_config(ms, config, errp); } =20 static void machine_class_init(ObjectClass *oc, void *data) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 11109752799..b158ebb16b1 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -337,7 +337,7 @@ static const struct SMPTestData data_with_dies_invalid[= ] =3D { }, }; =20 -static char *smp_config_to_string(SMPConfiguration *config) +static char *smp_config_to_string(const SMPConfiguration *config) { return g_strdup_printf( "(SMPConfiguration) {\n" @@ -371,7 +371,7 @@ static char *cpu_topology_to_string(const CpuTopology *= topo) topo->cores, topo->threads, topo->max_cpus); } =20 -static void check_parse(MachineState *ms, SMPConfiguration *config, +static void check_parse(MachineState *ms, const SMPConfiguration *config, const CpuTopology *expect_topo, const char *expect= _err, bool is_valid) { @@ -380,8 +380,8 @@ static void check_parse(MachineState *ms, SMPConfigurat= ion *config, g_autofree char *output_topo_str =3D NULL; Error *err =3D NULL; =20 - /* call the generic parser smp_parse() */ - smp_parse(ms, config, &err); + /* call the generic parser */ + machine_parse_smp_config(ms, config, &err); =20 output_topo_str =3D cpu_topology_to_string(&ms->smp); =20 --=20 2.31.1