From: Zhao Liu <zhao1.liu@intel.com>
As the generic code, here we should respect the different topologies:
smp or hybrid.
So rename qemu_info_t.system.smp_vcpus to qemu_info_t.system.vcpus to
decouple with smp topology.
And use generic topology helpers to get topology information.
Cc: Alex Bennée <alex.bennee@linaro.org>
Cc: Alexandre Iooss <erdnaxe@crans.org>
Cc: Mahmoud Mandour <ma.mandourr@gmail.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
contrib/plugins/hwprofile.c | 2 +-
include/qemu/qemu-plugin.h | 4 ++--
plugins/api.c | 4 ++--
plugins/loader.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/contrib/plugins/hwprofile.c b/contrib/plugins/hwprofile.c
index 691d4edb0c67..839175396932 100644
--- a/contrib/plugins/hwprofile.c
+++ b/contrib/plugins/hwprofile.c
@@ -307,7 +307,7 @@ int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info,
}
/* Just warn about overflow */
- if (info->system.smp_vcpus > 64 ||
+ if (info->system.vcpus > 64 ||
info->system.max_vcpus > 64) {
fprintf(stderr, "hwprofile: can only track up to 64 CPUs\n");
}
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index d0e9d03adfe3..529fcc54e43e 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -74,8 +74,8 @@ typedef struct qemu_info_t {
union {
/** @system: information relevant to system emulation */
struct {
- /** @system.smp_vcpus: initial number of vCPUs */
- int smp_vcpus;
+ /** @system.vcpus: initial number of vCPUs */
+ int vcpus;
/** @system.max_vcpus: maximum possible number of vCPUs */
int max_vcpus;
} system;
diff --git a/plugins/api.c b/plugins/api.c
index 2078b16edb02..22018083d0cd 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -374,7 +374,7 @@ int qemu_plugin_n_vcpus(void)
#ifdef CONFIG_USER_ONLY
return -1;
#else
- return get_ms()->smp.cpus;
+ return machine_topo_get_cpus(get_ms());
#endif
}
@@ -383,7 +383,7 @@ int qemu_plugin_n_max_vcpus(void)
#ifdef CONFIG_USER_ONLY
return -1;
#else
- return get_ms()->smp.max_cpus;
+ return machine_topo_get_max_cpus(get_ms());
#endif
}
diff --git a/plugins/loader.c b/plugins/loader.c
index 88c30bde2d6a..c17ece9acc49 100644
--- a/plugins/loader.c
+++ b/plugins/loader.c
@@ -298,8 +298,8 @@ int qemu_plugin_load_list(QemuPluginList *head, Error **errp)
#ifndef CONFIG_USER_ONLY
MachineState *ms = MACHINE(qdev_get_machine());
info->system_emulation = true;
- info->system.smp_vcpus = ms->smp.cpus;
- info->system.max_vcpus = ms->smp.max_cpus;
+ info->system.vcpus = machine_topo_get_cpus(ms);
+ info->system.max_vcpus = machine_topo_get_max_cpus(ms);
#else
info->system_emulation = false;
#endif
--
2.34.1