From: Zhao Liu <zhao1....@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....@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