From: Markus Armbruster <armbru@redhat.com>
To: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH 8/8] qmp: reimplement qmp_query_cpu_definitions as a dispatcher function
Date: Thu, 15 Oct 2026 07:57:29 +0200 [thread overview]
Message-ID: <87cxtbbj5i.fsf@pond.sub.org> (raw)
In-Reply-To: <20261015005355.62406-9-pierrick.bouvier@oss.qualcomm.com> (Pierrick Bouvier's message of "Thu, 15 Oct 2026 00:53:55 +0000")
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> writes:
> Now that we have per target implementations of this function, we simply
> dispatch the call to relevant implementation.
> This eliminates duplication of qmp_query_cpu_definitions symbol.
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
> hw/core/machine-qmp-cmds.c | 32 +++++++++++++++++++++++++++
> stubs/meson.build | 6 +++++
> stubs/qmp-cpu-arm.c | 9 ++++++++
> stubs/qmp-cpu-i386.c | 9 ++++++++
> stubs/qmp-cpu-loongarch.c | 9 ++++++++
> stubs/qmp-cpu-mips.c | 9 ++++++++
> stubs/qmp-cpu-ppc.c | 9 ++++++++
> stubs/qmp-cpu-riscv.c | 9 ++++++++
> stubs/qmp-cpu-s390x.c | 6 +++++
> stubs/qmp-cpu.c | 7 ------
> target/arm/arm-qmp-cmds.c | 5 -----
> target/i386/cpu.c | 5 -----
> target/loongarch/loongarch-qmp-cmds.c | 5 -----
> target/mips/system/mips-qmp-cmds.c | 5 -----
> target/ppc/ppc-qmp-cmds.c | 5 -----
> target/riscv/riscv-qmp-cmds.c | 5 -----
> target/s390x/cpu_models_system.c | 5 -----
> 17 files changed, 98 insertions(+), 42 deletions(-)
> create mode 100644 stubs/qmp-cpu-arm.c
> create mode 100644 stubs/qmp-cpu-i386.c
> create mode 100644 stubs/qmp-cpu-loongarch.c
> create mode 100644 stubs/qmp-cpu-mips.c
> create mode 100644 stubs/qmp-cpu-ppc.c
> create mode 100644 stubs/qmp-cpu-riscv.c
>
> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
> index 9c08b17510a..3fee45d568d 100644
> --- a/hw/core/machine-qmp-cmds.c
> +++ b/hw/core/machine-qmp-cmds.c
> @@ -27,6 +27,7 @@
> #include "system/hostmem.h"
> #include "system/hw_accel.h"
> #include "system/numa.h"
> +#include "system/qmp-cpu.h"
> #include "system/ramlist.h"
> #include "system/runstate.h"
> #include "system/system.h"
> @@ -93,6 +94,37 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
> return head;
> }
>
> +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
> +{
> + switch (target_arch()) {
> + case SYS_EMU_TARGET_AARCH64:
> + case SYS_EMU_TARGET_ARM:
> + return qmp_query_arm_cpu_definitions(errp);
> + case SYS_EMU_TARGET_I386:
> + case SYS_EMU_TARGET_X86_64:
> + return qmp_query_i386_cpu_definitions(errp);
> + case SYS_EMU_TARGET_LOONGARCH64:
> + return qmp_query_loongarch_cpu_definitions(errp);
> + case SYS_EMU_TARGET_MIPS:
> + case SYS_EMU_TARGET_MIPS64:
> + case SYS_EMU_TARGET_MIPS64EL:
> + case SYS_EMU_TARGET_MIPSEL:
> + return qmp_query_mips_cpu_definitions(errp);
> + case SYS_EMU_TARGET_PPC:
> + case SYS_EMU_TARGET_PPC64:
> + return qmp_query_ppc_cpu_definitions(errp);
> + case SYS_EMU_TARGET_RISCV32:
> + case SYS_EMU_TARGET_RISCV64:
> + return qmp_query_riscv_cpu_definitions(errp);
> + case SYS_EMU_TARGET_S390X:
> + return qmp_query_s390x_cpu_definitions(errp);
> + default:
> + error_setg(errp,
> + "CPU model definitions are not supported on this target");
> + return NULL;
> + }
> +}
> +
> MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,
> Error **errp)
> {
> diff --git a/stubs/meson.build b/stubs/meson.build
> index 29b6644b254..dcb67ce5295 100644
> --- a/stubs/meson.build
> +++ b/stubs/meson.build
> @@ -86,6 +86,12 @@ if have_system
> stub_ss.add(files('qmp-i386-sgx.c'))
> stub_ss.add(files('qmp-i386-xen.c'))
> stub_ss.add(files('qmp-cpu.c'))
> + stub_ss.add(files('qmp-cpu-arm.c'))
> + stub_ss.add(files('qmp-cpu-i386.c'))
> + stub_ss.add(files('qmp-cpu-loongarch.c'))
> + stub_ss.add(files('qmp-cpu-mips.c'))
> + stub_ss.add(files('qmp-cpu-ppc.c'))
> + stub_ss.add(files('qmp-cpu-riscv.c'))
> stub_ss.add(files('qmp-cpu-s390x.c'))
> stub_ss.add(files('qmp-cpu-s390x-kvm.c'))
> if have_hmp
> diff --git a/stubs/qmp-cpu-arm.c b/stubs/qmp-cpu-arm.c
> new file mode 100644
> index 00000000000..6249d7bde8d
> --- /dev/null
> +++ b/stubs/qmp-cpu-arm.c
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#include "qemu/osdep.h"
> +#include "system/qmp-cpu.h"
> +
> +CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp)
> +{
> + g_assert_not_reached();
> +}
> diff --git a/stubs/qmp-cpu-i386.c b/stubs/qmp-cpu-i386.c
> new file mode 100644
> index 00000000000..4858951f8c2
> --- /dev/null
> +++ b/stubs/qmp-cpu-i386.c
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#include "qemu/osdep.h"
> +#include "system/qmp-cpu.h"
> +
> +CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp)
> +{
> + g_assert_not_reached();
> +}
> diff --git a/stubs/qmp-cpu-loongarch.c b/stubs/qmp-cpu-loongarch.c
> new file mode 100644
> index 00000000000..695b6558d7e
> --- /dev/null
> +++ b/stubs/qmp-cpu-loongarch.c
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#include "qemu/osdep.h"
> +#include "system/qmp-cpu.h"
> +
> +CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp)
> +{
> + g_assert_not_reached();
> +}
> diff --git a/stubs/qmp-cpu-mips.c b/stubs/qmp-cpu-mips.c
> new file mode 100644
> index 00000000000..4d251d5f078
> --- /dev/null
> +++ b/stubs/qmp-cpu-mips.c
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#include "qemu/osdep.h"
> +#include "system/qmp-cpu.h"
> +
> +CpuDefinitionInfoList *qmp_query_mips_cpu_definitions(Error **errp)
> +{
> + g_assert_not_reached();
> +}
> diff --git a/stubs/qmp-cpu-ppc.c b/stubs/qmp-cpu-ppc.c
> new file mode 100644
> index 00000000000..315461c7db7
> --- /dev/null
> +++ b/stubs/qmp-cpu-ppc.c
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#include "qemu/osdep.h"
> +#include "system/qmp-cpu.h"
> +
> +CpuDefinitionInfoList *qmp_query_ppc_cpu_definitions(Error **errp)
> +{
> + g_assert_not_reached();
> +}
> diff --git a/stubs/qmp-cpu-riscv.c b/stubs/qmp-cpu-riscv.c
> new file mode 100644
> index 00000000000..ce500ffa3f3
> --- /dev/null
> +++ b/stubs/qmp-cpu-riscv.c
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#include "qemu/osdep.h"
> +#include "system/qmp-cpu.h"
> +
> +CpuDefinitionInfoList *qmp_query_riscv_cpu_definitions(Error **errp)
> +{
> + g_assert_not_reached();
> +}
> diff --git a/stubs/qmp-cpu-s390x.c b/stubs/qmp-cpu-s390x.c
> index 71e794482b5..4556072a226 100644
> --- a/stubs/qmp-cpu-s390x.c
> +++ b/stubs/qmp-cpu-s390x.c
> @@ -3,6 +3,12 @@
> #include "qemu/osdep.h"
> #include "qapi/error.h"
> #include "qapi/qapi-commands-machine.h"
> +#include "system/qmp-cpu.h"
> +
> +CpuDefinitionInfoList *qmp_query_s390x_cpu_definitions(Error **errp)
> +{
> + g_assert_not_reached();
> +}
>
> CpuModelCompareInfo *
> qmp_query_cpu_model_comparison(CpuModelInfo *infoa,
I believe the stubs are needed to make hw/core/machine-qmp-cmds.c link
when targets are compiled out. Suggest to briefly explain that in the
commit message.
[...]
next prev parent reply other threads:[~2026-10-15 6:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 0:53 [PATCH 0/8] multi-target: remove qmp_query_cpu_definitions duplication Pierrick Bouvier
2026-10-15 0:53 ` [PATCH 1/8] target/arm: rename qmp_query_cpu_definitions to qmp_query_arm_cpu_definitions Pierrick Bouvier
2026-10-15 0:53 ` [PATCH 2/8] target/i386: rename qmp_query_cpu_definitions to qmp_query_i386_cpu_definitions Pierrick Bouvier
2026-10-15 0:53 ` [PATCH 3/8] target/loongarch: rename to qmp_query_loongarch_cpu_definitions Pierrick Bouvier
2026-10-15 0:53 ` [PATCH 4/8] target/mips: rename qmp_query_cpu_definitions to qmp_query_mips_cpu_definitions Pierrick Bouvier
2026-10-15 0:53 ` [PATCH 5/8] target/ppc: rename qmp_query_cpu_definitions to qmp_query_ppc_cpu_definitions Pierrick Bouvier
2026-10-15 0:53 ` [PATCH 6/8] target/riscv: rename to qmp_query_cpu_definitions to qmp_query_riscv_cpu_definitions Pierrick Bouvier
2026-10-15 0:53 ` [PATCH 7/8] target/s390x: rename qmp_query_cpu_definitions to qmp_query_s390x_cpu_definitions Pierrick Bouvier
2026-10-15 0:53 ` [PATCH 8/8] qmp: reimplement qmp_query_cpu_definitions as a dispatcher function Pierrick Bouvier
2026-10-15 5:57 ` Markus Armbruster [this message]
2026-10-15 6:14 ` Pierrick Bouvier
2026-10-15 2:20 ` [PATCH 0/8] multi-target: remove qmp_query_cpu_definitions duplication Yonggang Luo
2026-10-15 4:46 ` Yonggang Luo
2026-10-15 5:58 ` Markus Armbruster
2026-10-15 6:13 ` Pierrick Bouvier
2026-10-15 6:36 ` Yonggang Luo
2026-10-15 7:57 ` Daniel P. Berrangé
2026-10-15 7:59 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cxtbbj5i.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.