[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 14/52] hw/smbios: Use generic topology name and helper
From: |
Zhao Liu |
Subject: |
[RFC 14/52] hw/smbios: Use generic topology name and helper |
Date: |
Mon, 13 Feb 2023 17:49:57 +0800 |
From: Zhao Liu <zhao1.liu@intel.com>
As the generic code, smbios should respect the different topologies: smp
or hybrid.
So rename smbios_smp_sockets to smbios_topo_sockets to decouple with smp
topology.
And use generic topology helpers to get topology information.
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Ani Sinha <ani@anisinha.ca>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
hw/smbios/smbios.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index cd4aa331cb3e..2ce1f2b1d94e 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -70,7 +70,8 @@ static SmbiosEntryPoint ep;
static int smbios_type4_count = 0;
static bool smbios_immutable;
static bool smbios_have_defaults;
-static uint32_t smbios_cpuid_version, smbios_cpuid_features,
smbios_smp_sockets;
+static uint32_t smbios_cpuid_version, smbios_cpuid_features;
+static uint32_t smbios_topo_sockets;
static DECLARE_BITMAP(have_binfile_bitmap, SMBIOS_MAX_TYPE+1);
static DECLARE_BITMAP(have_fields_bitmap, SMBIOS_MAX_TYPE+1);
@@ -461,7 +462,7 @@ opts_init(smbios_register_config);
static void smbios_validate_table(MachineState *ms)
{
uint32_t expect_t4_count = smbios_legacy ?
- ms->smp.cpus : smbios_smp_sockets;
+ machine_topo_get_cpus(ms) : smbios_topo_sockets;
if (smbios_type4_count && smbios_type4_count != expect_t4_count) {
error_report("Expected %d SMBIOS Type 4 tables, got %d instead",
@@ -713,8 +714,8 @@ static void smbios_build_type_4_table(MachineState *ms,
unsigned instance)
{
char sock_str[128];
size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
- unsigned cpus_per_socket = ms->smp.max_cpus / ms->smp.sockets;
- unsigned cores_per_socket = cpus_per_socket / ms->smp.threads;
+ unsigned cpus_per_socket = machine_topo_get_threads_per_socket(ms);
+ unsigned cores_per_socket = machine_topo_get_cores_per_socket(ms);
if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -1088,10 +1089,10 @@ void smbios_get_tables(MachineState *ms,
smbios_build_type_2_table();
smbios_build_type_3_table();
- smbios_smp_sockets = ms->smp.sockets;
- assert(smbios_smp_sockets >= 1);
+ smbios_topo_sockets = machine_topo_get_sockets(ms);
+ assert(smbios_topo_sockets >= 1);
- for (i = 0; i < smbios_smp_sockets; i++) {
+ for (i = 0; i < smbios_topo_sockets; i++) {
smbios_build_type_4_table(ms, i);
}
--
2.34.1
- Re: [RFC 09/52] hw/machine: Introduce core type for hybrid topology, (continued)
- [RFC 14/52] hw/smbios: Use generic topology name and helper,
Zhao Liu <=
- [RFC 13/52] cpu/core: Use generic topology helper for "help" to set nr_threads, Zhao Liu, 2023/02/13
- [RFC 15/52] migration/postcopy-ram: Use generic topology name and helper, Zhao Liu, 2023/02/13
- [RFC 16/52] plugins: Use generic topology name and helper, Zhao Liu, 2023/02/13
- [RFC 17/52] softmmu/cpus: Use generic topology helper in vcpus initialization, Zhao Liu, 2023/02/13
- [RFC 18/52] general: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 19/52] i386: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13