diff options
author | Thomas Huth <thuth@redhat.com> | 2023-04-24 18:04:32 +0200 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2023-05-16 09:14:18 +0200 |
commit | 5503da4a0c9e7f6853a175f5e273897680cd12df (patch) | |
tree | 752e566cb853a89bd25ec77b4abf8fe6a5f3cf8b /hw/core | |
parent | c70bb9a771d467302d1c7df5c5bd56b48f42716e (diff) | |
download | qemu-5503da4a0c9e7f6853a175f5e273897680cd12df.zip qemu-5503da4a0c9e7f6853a175f5e273897680cd12df.tar.gz qemu-5503da4a0c9e7f6853a175f5e273897680cd12df.tar.bz2 |
hw/core: Use a callback for target specific query-cpus-fast information
For being able to create a universal QEMU binary one day, core
files like machine-qmp-cmds.c must not contain any "#ifdef TARGET_..."
parts. Thus let's provide the target specific function via a
function pointer in CPUClass instead, as a first step towards
making this file target independent.
Message-Id: <20230424160434.331175-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'hw/core')
-rw-r--r-- | hw/core/machine-qmp-cmds.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index b98ff15..c158c02 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -28,18 +28,6 @@ #include "sysemu/runstate.h" #include "sysemu/sysemu.h" -static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cpu) -{ -#ifdef TARGET_S390X - S390CPU *s390_cpu = S390_CPU(cpu); - CPUS390XState *env = &s390_cpu->env; - - info->cpu_state = env->cpu_state; -#else - abort(); -#endif -} - /* * fast means: we NEVER interrupt vCPU threads to retrieve * information from KVM. @@ -68,8 +56,8 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) } value->target = target; - if (target == SYS_EMU_TARGET_S390X) { - cpustate_to_cpuinfo_s390(&value->u.s390x, cpu); + if (cpu->cc->query_cpu_fast) { + cpu->cc->query_cpu_fast(cpu, value); } QAPI_LIST_APPEND(tail, value); |