diff options
-rw-r--r-- | hw/core/machine-smp.c | 10 | ||||
-rw-r--r-- | include/hw/boards.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index b39ed21e65..903834c0db 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -193,3 +193,13 @@ void machine_parse_smp_config(MachineState *ms, return; } } + +unsigned int machine_topo_get_cores_per_socket(const MachineState *ms) +{ + return ms->smp.cores * ms->smp.clusters * ms->smp.dies; +} + +unsigned int machine_topo_get_threads_per_socket(const MachineState *ms) +{ + return ms->smp.threads * machine_topo_get_cores_per_socket(ms); +} diff --git a/include/hw/boards.h b/include/hw/boards.h index 90f1dd3aeb..ca2f0d3592 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -36,6 +36,8 @@ void machine_set_cpu_numa_node(MachineState *machine, Error **errp); void machine_parse_smp_config(MachineState *ms, const SMPConfiguration *config, Error **errp); +unsigned int machine_topo_get_cores_per_socket(const MachineState *ms); +unsigned int machine_topo_get_threads_per_socket(const MachineState *ms); /** * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices |