From: Zhao Liu <zhao1.liu@linux.intel.com>
To: "Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Zhenyu Wang <zhenyu.z.wang@intel.com>,
Dapeng Mi <dapeng1.mi@intel.com>,
Zhuocheng Ding <zhuocheng.ding@intel.com>,
Robert Hoo <robert.hu@linux.intel.com>,
Sean Christopherson <seanjc@google.com>,
Like Xu <like.xu.linux@gmail.com>, Zhao Liu <zhao1.liu@intel.com>
Subject: [RFC 43/52] hw/machine: Rename MachineClass.smp_props to MachineClass.topo_props
Date: Mon, 13 Feb 2023 17:50:26 +0800 [thread overview]
Message-ID: <20230213095035.158240-44-zhao1.liu@linux.intel.com> (raw)
In-Reply-To: <20230213095035.158240-1-zhao1.liu@linux.intel.com>
From: Zhao Liu <zhao1.liu@intel.com>
MachineClass.topo_props is better to be compatible with both hybrid
topology and smp topology properties.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
hw/acpi/aml-build.c | 2 +-
hw/arm/virt.c | 6 +++---
hw/core/machine-topo.c | 12 ++++++------
hw/i386/pc.c | 4 ++--
hw/i386/pc_piix.c | 2 +-
hw/i386/pc_q35.c | 2 +-
hw/ppc/spapr.c | 2 +-
hw/s390x/s390-virtio-ccw.c | 2 +-
include/hw/boards.h | 2 +-
tests/unit/test-smp-parse.c | 12 ++++++------
10 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 693bd8833d10..51634cfd2776 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -2030,7 +2030,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
0, socket_id, NULL, 0);
}
- if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) {
+ if (mc->topo_props.clusters_supported && mc->topo_props.has_clusters) {
if (cpus->cpus[n].props.cluster_id != cluster_id) {
assert(cpus->cpus[n].props.cluster_id > cluster_id);
cluster_id = cpus->cpus[n].props.cluster_id;
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index ae65ba2c929c..5f0517423d8f 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2687,7 +2687,7 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)
ms->possible_cpus->cpus[n].arch_id =
virt_cpu_mp_affinity(vms, n);
- assert(!mc->smp_props.dies_supported);
+ assert(!mc->topo_props.dies_supported);
ms->possible_cpus->cpus[n].props.has_socket_id = true;
ms->possible_cpus->cpus[n].props.socket_id =
n / (smp_clusters * smp_cores * smp_threads);
@@ -3029,7 +3029,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
hc->unplug_request = virt_machine_device_unplug_request_cb;
hc->unplug = virt_machine_device_unplug_cb;
mc->nvdimm_supported = true;
- mc->smp_props.clusters_supported = true;
+ mc->topo_props.clusters_supported = true;
mc->auto_enable_numa_with_memhp = true;
mc->auto_enable_numa_with_memdev = true;
mc->default_ram_id = "mach-virt.ram";
@@ -3280,7 +3280,7 @@ static void virt_machine_6_1_options(MachineClass *mc)
virt_machine_6_2_options(mc);
compat_props_add(mc->compat_props, hw_compat_6_1, hw_compat_6_1_len);
- mc->smp_props.prefer_sockets = true;
+ mc->topo_props.prefer_sockets = true;
vmc->no_cpu_topology = true;
/* qemu ITS was introduced with 6.2 */
diff --git a/hw/core/machine-topo.c b/hw/core/machine-topo.c
index f9ab08a1252e..8540b473b8db 100644
--- a/hw/core/machine-topo.c
+++ b/hw/core/machine-topo.c
@@ -187,11 +187,11 @@ static char *cpu_hierarchy_to_string(MachineState *ms)
g_string_append_printf(s, "sockets (%u)", machine_topo_get_sockets(ms));
- if (mc->smp_props.dies_supported) {
+ if (mc->topo_props.dies_supported) {
g_string_append_printf(s, " * dies (%u)", machine_topo_get_dies(ms));
}
- if (mc->smp_props.clusters_supported) {
+ if (mc->topo_props.clusters_supported) {
g_string_append_printf(s, " * clusters (%u)",
machine_topo_get_clusters(ms));
}
@@ -256,11 +256,11 @@ void machine_parse_smp_config(MachineState *ms,
* If not supported by the machine, a topology parameter must be
* omitted or specified equal to 1.
*/
- if (!mc->smp_props.dies_supported && dies > 1) {
+ if (!mc->topo_props.dies_supported && dies > 1) {
error_setg(errp, "dies not supported by this machine's CPU topology");
return;
}
- if (!mc->smp_props.clusters_supported && clusters > 1) {
+ if (!mc->topo_props.clusters_supported && clusters > 1) {
error_setg(errp, "clusters not supported by this machine's CPU topology");
return;
}
@@ -276,7 +276,7 @@ void machine_parse_smp_config(MachineState *ms,
} else {
maxcpus = maxcpus > 0 ? maxcpus : cpus;
- if (mc->smp_props.prefer_sockets) {
+ if (mc->topo_props.prefer_sockets) {
/* prefer sockets over cores before 6.2 */
if (sockets == 0) {
cores = cores > 0 ? cores : 1;
@@ -315,7 +315,7 @@ void machine_parse_smp_config(MachineState *ms,
ms->topo.smp.cores = cores;
ms->topo.smp.threads = threads;
- mc->smp_props.has_clusters = config->has_clusters;
+ mc->topo_props.has_clusters = config->has_clusters;
/* sanity-check of the computed topology */
if (sockets * dies * clusters * cores * threads != maxcpus) {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c329df56ebd2..9a7ee0affd87 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1928,8 +1928,8 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
hc->unplug = pc_machine_device_unplug_cb;
mc->default_cpu_type = TARGET_DEFAULT_CPU_TYPE;
mc->nvdimm_supported = true;
- mc->smp_props.dies_supported = true;
- mc->smp_props.clusters_supported = true;
+ mc->topo_props.dies_supported = true;
+ mc->topo_props.clusters_supported = true;
mc->default_ram_id = "pc.ram";
object_class_property_add(oc, PC_MACHINE_MAX_RAM_BELOW_4G, "size",
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index df64dd8dcc66..ce725b3d2927 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -513,7 +513,7 @@ static void pc_i440fx_6_1_machine_options(MachineClass *m)
pc_i440fx_6_2_machine_options(m);
compat_props_add(m->compat_props, hw_compat_6_1, hw_compat_6_1_len);
compat_props_add(m->compat_props, pc_compat_6_1, pc_compat_6_1_len);
- m->smp_props.prefer_sockets = true;
+ m->topo_props.prefer_sockets = true;
}
DEFINE_I440FX_MACHINE(v6_1, "pc-i440fx-6.1", NULL,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 66cd718b7081..94352f2b8ea8 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -432,7 +432,7 @@ static void pc_q35_6_1_machine_options(MachineClass *m)
pc_q35_6_2_machine_options(m);
compat_props_add(m->compat_props, hw_compat_6_1, hw_compat_6_1_len);
compat_props_add(m->compat_props, pc_compat_6_1, pc_compat_6_1_len);
- m->smp_props.prefer_sockets = true;
+ m->topo_props.prefer_sockets = true;
}
DEFINE_Q35_MACHINE(v6_1, "pc-q35-6.1", NULL,
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 6faad75afd70..b2e2420af870 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4801,7 +4801,7 @@ static void spapr_machine_6_1_class_options(MachineClass *mc)
spapr_machine_6_2_class_options(mc);
compat_props_add(mc->compat_props, hw_compat_6_1, hw_compat_6_1_len);
smc->pre_6_2_numa_affinity = true;
- mc->smp_props.prefer_sockets = true;
+ mc->topo_props.prefer_sockets = true;
}
DEFINE_SPAPR_MACHINE(6_1, "6.1", false);
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 9b5020a0d395..28cc3c048d78 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -912,7 +912,7 @@ static void ccw_machine_6_1_class_options(MachineClass *mc)
{
ccw_machine_6_2_class_options(mc);
compat_props_add(mc->compat_props, hw_compat_6_1, hw_compat_6_1_len);
- mc->smp_props.prefer_sockets = true;
+ mc->topo_props.prefer_sockets = true;
}
DEFINE_CCW_MACHINE(6_1, "6.1", false);
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 17be3485e823..48444ab7275b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -288,7 +288,7 @@ struct MachineClass {
bool nvdimm_supported;
bool numa_mem_supported;
bool auto_enable_numa;
- TopoCompatProps smp_props;
+ TopoCompatProps topo_props;
const char *default_ram_id;
HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c
index d6816f109084..b6dd5fafd3dd 100644
--- a/tests/unit/test-smp-parse.c
+++ b/tests/unit/test-smp-parse.c
@@ -500,11 +500,11 @@ static void smp_parse_test(MachineState *ms, SMPTestData *data, bool is_valid)
{
MachineClass *mc = MACHINE_GET_CLASS(ms);
- mc->smp_props.prefer_sockets = true;
+ mc->topo_props.prefer_sockets = true;
check_parse(ms, &data->config, &data->expect_prefer_sockets,
data->expect_error, is_valid);
- mc->smp_props.prefer_sockets = false;
+ mc->topo_props.prefer_sockets = false;
check_parse(ms, &data->config, &data->expect_prefer_cores,
data->expect_error, is_valid);
}
@@ -512,12 +512,12 @@ static void smp_parse_test(MachineState *ms, SMPTestData *data, bool is_valid)
/* The parsed results of the unsupported parameters should be 1 */
static void unsupported_params_init(const MachineClass *mc, SMPTestData *data)
{
- if (!mc->smp_props.dies_supported) {
+ if (!mc->topo_props.dies_supported) {
data->expect_prefer_sockets.smp.dies = 1;
data->expect_prefer_cores.smp.dies = 1;
}
- if (!mc->smp_props.clusters_supported) {
+ if (!mc->topo_props.clusters_supported) {
data->expect_prefer_sockets.smp.clusters = 1;
data->expect_prefer_cores.smp.clusters = 1;
}
@@ -553,14 +553,14 @@ static void machine_with_dies_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
- mc->smp_props.dies_supported = true;
+ mc->topo_props.dies_supported = true;
}
static void machine_with_clusters_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
- mc->smp_props.clusters_supported = true;
+ mc->topo_props.clusters_supported = true;
}
static void test_generic_valid(const void *opaque)
--
2.34.1
next prev parent reply other threads:[~2023-02-13 9:52 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 9:49 [RFC 00/52] Introduce hybrid CPU topology Zhao Liu
2023-02-13 9:49 ` [RFC 01/52] hw/smbios: Fix smbios_smp_sockets caculation Zhao Liu
2023-02-13 9:49 ` [RFC 02/52] hw/smbios: Fix thread count in type4 Zhao Liu
2023-02-13 9:49 ` [RFC 03/52] hw/smbios: Fix core " Zhao Liu
2023-02-13 9:49 ` [RFC 04/52] i386/WHPX: Fix error message when fail to set ProcessorCount Zhao Liu
2023-02-13 13:41 ` Daniel P. Berrangé
2023-02-15 2:29 ` Zhao Liu
2023-02-13 9:49 ` [RFC 05/52] hw/core/machine: Rename machine-smp.c to machine-topo.c Zhao Liu
2023-02-13 12:52 ` wangyanan (Y) via
2023-02-14 8:50 ` Zhao Liu
2023-02-13 9:49 ` [RFC 06/52] hw/cpu: Introduce hybrid CPU topology Zhao Liu
2023-02-13 13:10 ` Philippe Mathieu-Daudé
2023-02-14 9:30 ` Zhao Liu
2023-02-14 9:27 ` Philippe Mathieu-Daudé
2023-02-15 3:15 ` Zhao Liu
2023-02-13 13:18 ` wangyanan (Y) via
2023-02-14 10:16 ` Zhao Liu
2023-02-14 11:23 ` wangyanan (Y) via
2023-02-15 3:22 ` Zhao Liu
2023-02-13 9:49 ` [RFC 07/52] hw/core/machine: Add the new topology support in MachineState Zhao Liu
2023-02-13 9:49 ` [RFC 08/52] machine: Add helpers to get cpu topology info from MachineState.topo Zhao Liu
2023-02-14 1:12 ` Mi, Dapeng1
2023-02-15 2:31 ` Zhao Liu
2023-02-16 8:38 ` wangyanan (Y) via
2023-02-17 3:07 ` Zhao Liu
2023-02-17 7:41 ` wangyanan (Y) via
2023-02-17 9:07 ` Zhao Liu
2023-02-13 9:49 ` [RFC 09/52] hw/machine: Introduce core type for hybrid topology Zhao Liu
2023-02-13 13:13 ` Philippe Mathieu-Daudé
2023-02-14 9:41 ` Zhao Liu
2023-02-14 1:14 ` Mi, Dapeng1
2023-02-15 2:40 ` Zhao Liu
2023-02-13 9:49 ` [RFC 10/52] machine: Replace MachineState.topo.smp access with topology helpers Zhao Liu
2023-02-13 9:49 ` [RFC 11/52] accel/kvm: Add hybrid info when check cpu num Zhao Liu
2023-02-13 9:49 ` [RFC 12/52] hw/acpi: Replace MachineState.smp access with topology helpers Zhao Liu
2023-02-16 9:31 ` wangyanan (Y) via
2023-02-17 3:14 ` Zhao Liu
2023-02-17 7:54 ` wangyanan (Y) via
2023-02-13 9:49 ` [RFC 13/52] cpu/core: Use generic topology helper for "help" to set nr_threads Zhao Liu
2023-02-13 9:49 ` [RFC 14/52] hw/smbios: Use generic topology name and helper Zhao Liu
2023-02-13 9:49 ` [RFC 15/52] migration/postcopy-ram: " Zhao Liu
2023-02-13 10:07 ` Juan Quintela
2023-02-14 8:12 ` Zhao Liu
2023-02-13 10:16 ` Juan Quintela
2023-02-14 8:16 ` Zhao Liu
2023-02-13 9:49 ` [RFC 16/52] plugins: " Zhao Liu
2023-02-13 9:50 ` [RFC 17/52] softmmu/cpus: Use generic topology helper in vcpus initialization Zhao Liu
2023-02-13 9:50 ` [RFC 18/52] general: Replace MachineState.smp access with topology helpers Zhao Liu
2023-02-13 9:50 ` [RFC 19/52] i386: " Zhao Liu
2023-02-13 9:50 ` [RFC 20/52] s390x: " Zhao Liu
2023-02-16 13:38 ` Thomas Huth
2023-02-17 3:38 ` Zhao Liu
2023-02-13 9:50 ` [RFC 21/52] ppc: " Zhao Liu
2023-02-13 9:50 ` [RFC 22/52] riscv: " Zhao Liu
2023-02-14 2:17 ` Mi, Dapeng1
2023-02-15 2:57 ` Zhao Liu
2023-03-01 23:43 ` Palmer Dabbelt
2023-02-13 9:50 ` [RFC 23/52] arm: " Zhao Liu
2023-02-16 10:46 ` wangyanan (Y) via
2023-02-17 3:21 ` Zhao Liu
2023-02-13 9:50 ` [RFC 24/52] loongarch: " Zhao Liu
2023-02-13 9:50 ` [RFC 25/52] mips: " Zhao Liu
2023-02-14 3:40 ` Mi, Dapeng1
2023-02-15 3:08 ` Zhao Liu
2023-02-13 9:50 ` [RFC 26/52] hw: Replace MachineState.smp access with topology helpers for all remaining archs Zhao Liu
2023-02-13 9:50 ` [RFC 27/52] test/test-smp-parse: Check fields of MachineState.topo.smp Zhao Liu
2023-02-13 9:50 ` [RFC 28/52] hw/core/machine: Remove support of MachineState.smp Zhao Liu
2023-02-13 9:50 ` [RFC 29/52] hw/core/cpu: Introduce TopologyState in CPUState Zhao Liu
2023-02-13 9:50 ` [RFC 30/52] i386: Drop nr_dies and nr_modules CPUX86State Zhao Liu
2023-02-13 13:22 ` Philippe Mathieu-Daudé
2023-02-13 9:50 ` [RFC 31/52] i386/cpu: Use CPUState.topo to replace X86CPUTopoInfo to get topology info Zhao Liu
2023-02-13 9:50 ` [RFC 32/52] i386: Rename X86CPUTopoInfo and its members to reflect relationship with APIC ID Zhao Liu
2023-02-13 13:25 ` Philippe Mathieu-Daudé
2023-02-13 9:50 ` [RFC 33/52] i386: Rename init_topo_info() to init_apic_topo_info() Zhao Liu
2023-02-13 13:27 ` Philippe Mathieu-Daudé
2023-02-14 10:20 ` Zhao Liu
2023-02-13 9:50 ` [RFC 34/52] i386: Rename variable topo_info to apicid_topo Zhao Liu
2023-02-13 13:28 ` Philippe Mathieu-Daudé
2023-02-14 10:18 ` Zhao Liu
2023-02-13 9:50 ` [RFC 35/52] i386: Support APIC ID topology for hybrid CPU topology Zhao Liu
2023-02-13 9:50 ` [RFC 36/52] i386: Use init_apicid_topo_info() to initialize APIC ID topology for system emulator Zhao Liu
2023-02-13 9:50 ` [RFC 37/52] i386: Update X86CPUTopoIDs generating rule for hybrid topology Zhao Liu
2023-02-13 9:50 ` [RFC 38/52] i386: Introduce hybrid_core_type to CPUX86State Zhao Liu
2023-02-13 9:50 ` [RFC 39/52] i386/cpu: Add Intel hybrid related CPUID support Zhao Liu
2023-02-13 9:50 ` [RFC 40/52] qapi: Introduce hybrid options Zhao Liu
2023-02-13 9:50 ` [RFC 41/52] machine: Introduce core_type() hook Zhao Liu
2023-02-13 13:33 ` Philippe Mathieu-Daudé
2023-02-14 14:33 ` Zhao Liu
2023-02-13 13:35 ` Philippe Mathieu-Daudé
2023-02-14 14:51 ` Zhao Liu
2023-02-16 12:15 ` wangyanan (Y) via
2023-02-17 3:26 ` Zhao Liu
2023-02-17 7:51 ` wangyanan (Y) via
2023-02-13 9:50 ` [RFC 42/52] hw/machine: Add hybrid_supported in generic topo properties Zhao Liu
2023-02-14 1:46 ` wangyanan (Y) via
2023-02-15 2:53 ` Zhao Liu
2023-02-16 12:28 ` wangyanan (Y) via
2023-02-17 3:28 ` Zhao Liu
2023-02-13 9:50 ` Zhao Liu [this message]
2023-02-13 9:50 ` [RFC 44/52] machine: Add "-hybrid" parsing rule Zhao Liu
2023-02-13 9:50 ` [RFC 45/52] hw/machine: Add hybrid cpu topology validation Zhao Liu
2023-02-13 9:50 ` [RFC 46/52] hw/machine: build core level hybrid topology form HybridCorePack Zhao Liu
2023-02-13 9:50 ` [RFC 47/52] hw/machine: Use opts_visitor to parse hybrid topo Zhao Liu
2023-02-13 9:50 ` [RFC 48/52] machine: Support "-hybrid" command Zhao Liu
2023-02-13 9:50 ` [RFC 49/52] i386/pc: Support hybrid cpu topology Zhao Liu
2023-02-13 9:50 ` [RFC 50/52] qemu-options: Add the document of hybrid command Zhao Liu
2023-02-13 9:50 ` [RFC 51/52] qapi: Expose CPU topology info in query_cpus_fast Zhao Liu
2023-02-13 9:50 ` [RFC 52/52] i386: Support cpu_index_to_core_type() for x86 Zhao Liu
2023-02-13 10:14 ` [RFC 00/52] Introduce hybrid CPU topology Alex Bennée
2023-02-14 8:48 ` Zhao Liu
2023-02-13 13:38 ` Daniel P. Berrangé
2023-02-14 17:14 ` Zhao Liu
2023-08-04 13:43 ` Zhao Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230213095035.158240-44-zhao1.liu@linux.intel.com \
--to=zhao1.liu@linux.intel.com \
--cc=armbru@redhat.com \
--cc=dapeng1.mi@intel.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=like.xu.linux@gmail.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=robert.hu@linux.intel.com \
--cc=seanjc@google.com \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
--cc=zhenyu.z.wang@intel.com \
--cc=zhuocheng.ding@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).