[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 16/52] plugins: Use generic topology name and helper
From: |
Zhao Liu |
Subject: |
[RFC 16/52] plugins: Use generic topology name and helper |
Date: |
Mon, 13 Feb 2023 17:49:59 +0800 |
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
- [RFC 12/52] hw/acpi: Replace MachineState.smp access with topology helpers, (continued)
- [RFC 12/52] hw/acpi: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 14/52] hw/smbios: Use generic topology name and helper, Zhao Liu, 2023/02/13
- [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 <=
- [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