[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 28/52] hw/core/machine: Remove support of MachineState.smp
From: |
Zhao Liu |
Subject: |
[RFC 28/52] hw/core/machine: Remove support of MachineState.smp |
Date: |
Mon, 13 Feb 2023 17:50:11 +0800 |
From: Zhao Liu <zhao1.liu@intel.com>
Now the all uses of MachineState.smp are replaced by MachineState.topo.
It's time to completely remove smp field.
And clean up the struct CpuTopology in include/hw/boards.h.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
hw/core/machine-topo.c | 8 --------
hw/core/machine.c | 9 +--------
include/hw/boards.h | 23 +----------------------
include/hw/cpu/cpu-topology.h | 11 +++--------
4 files changed, 5 insertions(+), 46 deletions(-)
diff --git a/hw/core/machine-topo.c b/hw/core/machine-topo.c
index cdbe65ffd9fd..12c05510c1b5 100644
--- a/hw/core/machine-topo.c
+++ b/hw/core/machine-topo.c
@@ -307,14 +307,6 @@ void machine_parse_smp_config(MachineState *ms,
maxcpus = maxcpus > 0 ? maxcpus : sockets * dies * clusters * cores *
threads;
cpus = cpus > 0 ? cpus : maxcpus;
- ms->smp.cpus = cpus;
- ms->smp.sockets = sockets;
- ms->smp.dies = dies;
- ms->smp.clusters = clusters;
- ms->smp.cores = cores;
- ms->smp.threads = threads;
- ms->smp.max_cpus = maxcpus;
-
ms->topo.cpus = cpus;
ms->topo.max_cpus = maxcpus;
ms->topo.smp.sockets = sockets;
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 56e796c18873..fad990f49b03 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1093,16 +1093,9 @@ static void machine_initfn(Object *obj)
}
/* default to mc->default_cpus */
- ms->smp.cpus = mc->default_cpus;
- ms->smp.max_cpus = mc->default_cpus;
- ms->smp.sockets = 1;
- ms->smp.dies = 1;
- ms->smp.clusters = 1;
- ms->smp.cores = 1;
- ms->smp.threads = 1;
-
ms->topo.cpus = mc->default_cpus;
ms->topo.max_cpus = mc->default_cpus;
+
ms->topo.topo_type = CPU_TOPO_TYPE_SMP;
ms->topo.smp.sockets = 1;
ms->topo.smp.dies = 1;
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 78e52af38cb1..9364c90d5f1a 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -299,26 +299,6 @@ typedef struct DeviceMemoryState {
MemoryRegion mr;
} DeviceMemoryState;
-/**
- * CpuTopology:
- * @cpus: the number of present logical processors on the machine
- * @sockets: the number of sockets on the machine
- * @dies: the number of dies in one socket
- * @clusters: the number of clusters in one die
- * @cores: the number of cores in one cluster
- * @threads: the number of threads in one core
- * @max_cpus: the maximum number of logical processors on the machine
- */
-typedef struct CpuTopology {
- unsigned int cpus;
- unsigned int sockets;
- unsigned int dies;
- unsigned int clusters;
- unsigned int cores;
- unsigned int threads;
- unsigned int max_cpus;
-} CpuTopology;
-
/**
* MachineState:
*/
@@ -360,8 +340,7 @@ struct MachineState {
const char *cpu_type;
AccelState *accelerator;
CPUArchIdList *possible_cpus;
- CpuTopology smp;
- GeneralCpuTopology topo; /* TODO: Completely replace MachineState.smp */
+ CpuTopology topo;
struct NVDIMMState *nvdimms_state;
struct NumaState *numa_state;
};
diff --git a/include/hw/cpu/cpu-topology.h b/include/hw/cpu/cpu-topology.h
index 87d832556229..829f98d3a73f 100644
--- a/include/hw/cpu/cpu-topology.h
+++ b/include/hw/cpu/cpu-topology.h
@@ -88,7 +88,7 @@ typedef struct HybridCpuTopology {
} HybridCpuTopology;
/**
- * GeneralCpuTopology - General cpu topology defination.
+ * CpuTopology - General cpu topology defination.
*
* It supports one of two topologies: smp topology or hybrid topology.
*
@@ -101,7 +101,7 @@ typedef struct HybridCpuTopology {
* @hybrid: the hybrid cpu topology informantion. Only valid when
* topo_type is CPU_TOPO_TYPE_HYBRID.
*/
-typedef struct GeneralCpuTopology {
+typedef struct CpuTopology {
unsigned int cpus;
unsigned int max_cpus;
CpuTopoType topo_type;
@@ -109,11 +109,6 @@ typedef struct GeneralCpuTopology {
SmpCpuTopology smp;
HybridCpuTopology hybrid;
};
-} GeneralCpuTopology; /*
- * TODO: This name is temporary, just to distinguish it
- * from the CpuTopology in boards.h. When CpuTopology in
- * boards.h is merged here, it will be uniformly named as
- * CpuTopology.
- */
+} CpuTopology;
#endif /* CPU_TOPOLOGY_H */
--
2.34.1
- [RFC 17/52] softmmu/cpus: Use generic topology helper in vcpus initialization, (continued)
- [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
- [RFC 20/52] s390x: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 21/52] ppc: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 22/52] riscv: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 23/52] arm: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 25/52] mips: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 26/52] hw: Replace MachineState.smp access with topology helpers for all remaining archs, Zhao Liu, 2023/02/13
- [RFC 27/52] test/test-smp-parse: Check fields of MachineState.topo.smp, Zhao Liu, 2023/02/13
- [RFC 28/52] hw/core/machine: Remove support of MachineState.smp,
Zhao Liu <=
- [RFC 24/52] loongarch: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 30/52] i386: Drop nr_dies and nr_modules CPUX86State, Zhao Liu, 2023/02/13
- [RFC 29/52] hw/core/cpu: Introduce TopologyState in CPUState, Zhao Liu, 2023/02/13
- [RFC 31/52] i386/cpu: Use CPUState.topo to replace X86CPUTopoInfo to get topology info, Zhao Liu, 2023/02/13
- [RFC 32/52] i386: Rename X86CPUTopoInfo and its members to reflect relationship with APIC ID, Zhao Liu, 2023/02/13
- [RFC 35/52] i386: Support APIC ID topology for hybrid CPU topology, Zhao Liu, 2023/02/13
- [RFC 33/52] i386: Rename init_topo_info() to init_apic_topo_info(), Zhao Liu, 2023/02/13