From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Cc: qemu-riscv@nongnu.org, "Anton Johansson" <anjo@rev.ng>,
qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Claudio Fontana" <cfontana@suse.de>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
qemu-arm@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Eric Blake" <eblake@redhat.com>,
"Song Gao" <gaosong@loongson.cn>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Weiwei Li" <liwei1518@gmail.com>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>
Subject: [RFC PATCH-for-9.1 21/21] qapi: Make @query-cpu-definitions target-agnostic
Date: Fri, 15 Mar 2024 14:09:09 +0100 [thread overview]
Message-ID: <20240315130910.15750-22-philmd@linaro.org> (raw)
In-Reply-To: <20240315130910.15750-1-philmd@linaro.org>
All targets use the generic_query_cpu_definitions() method,
which is not target-specific. Make the command target agnostic
by moving it to machine.json. Rename generic_query_cpu_definitions
as qmp_query_cpu_definitions.
This is an introspection change for the target that were not
implementing qmp_query_cpu_definitions(): now query-cpu-definitions
returns an their CPUs list.
Example with SH4 before:
{ "execute": "query-cpu-definitions" }
{ "error": {"class": "CommandNotFound", "desc": "The command query-cpu-definitions has not been found"} }
and after:
{ "execute": "query-cpu-definitions" }
{ "return": [
{"name": "sh7751r", "typename": "sh7751r-superh-cpu", "static": false, "deprecated": false},
{"name": "sh7750r", "typename": "sh7750r-superh-cpu", "static": false, "deprecated": false},
{"name": "sh7785", "typename": "sh7785-superh-cpu", "static": false, "deprecated": false}
]
}
However this allows heterogeneous emulation to return a correct list.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Well, not all target got converted, I left the s390x one for later :)
---
MAINTAINERS | 1 -
qapi/machine-target.json | 18 ------------------
qapi/machine.json | 11 +++++++++++
include/qapi/commands-target-compat.h | 14 --------------
system/cpu-qmp-cmds.c | 4 ++--
target/arm/arm-qmp-cmds.c | 6 ------
target/i386/cpu.c | 6 ------
target/loongarch/loongarch-qmp-cmds.c | 6 ------
target/mips/sysemu/mips-qmp-cmds.c | 9 ---------
target/ppc/ppc-qmp-cmds.c | 7 -------
target/riscv/riscv-qmp-cmds.c | 6 ------
11 files changed, 13 insertions(+), 75 deletions(-)
delete mode 100644 include/qapi/commands-target-compat.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 39d7c14d98..71f446311b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1895,7 +1895,6 @@ F: qapi/machine-target.json
F: include/hw/boards.h
F: include/hw/core/cpu.h
F: include/hw/cpu/cluster.h
-F: include/qapi/commands-target-compat.h
F: include/sysemu/numa.h
F: tests/unit/test-smp-parse.c
T: git https://gitlab.com/ehabkost/qemu.git machine-next
diff --git a/qapi/machine-target.json b/qapi/machine-target.json
index 7480921d33..2065972d8a 100644
--- a/qapi/machine-target.json
+++ b/qapi/machine-target.json
@@ -212,24 +212,6 @@
'TARGET_LOONGARCH64',
'TARGET_RISCV' ] } }
-##
-# @query-cpu-definitions:
-#
-# Return a list of supported virtual CPU definitions
-#
-# Returns: a list of CpuDefinitionInfo
-#
-# Since: 1.2
-##
-{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'],
- 'if': { 'any': [ 'TARGET_PPC',
- 'TARGET_ARM',
- 'TARGET_I386',
- 'TARGET_S390X',
- 'TARGET_MIPS',
- 'TARGET_LOONGARCH64',
- 'TARGET_RISCV' ] } }
-
##
# @CpuS390Polarization:
#
diff --git a/qapi/machine.json b/qapi/machine.json
index 9c44b8fa82..987c64f8e7 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -73,6 +73,17 @@
'deprecated' : 'bool' }
}
+##
+# @query-cpu-definitions:
+#
+# Return a list of supported virtual CPU definitions
+#
+# Returns: a list of CpuDefinitionInfo
+#
+# Since: 1.2
+##
+{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }
+
##
# @CpuModelInfo:
#
diff --git a/include/qapi/commands-target-compat.h b/include/qapi/commands-target-compat.h
deleted file mode 100644
index 86d45d8fcc..0000000000
--- a/include/qapi/commands-target-compat.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * QAPI helpers for target specific QMP commands
- *
- * SPDX-FileCopyrightText: 2024 Linaro Ltd.
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-#ifndef QAPI_COMPAT_TARGET_H
-#define QAPI_COMPAT_TARGET_H
-
-#include "qapi/qapi-types-machine.h"
-
-CpuDefinitionInfoList *generic_query_cpu_definitions(Error **errp);
-
-#endif
diff --git a/system/cpu-qmp-cmds.c b/system/cpu-qmp-cmds.c
index daeb131159..049e8b9d35 100644
--- a/system/cpu-qmp-cmds.c
+++ b/system/cpu-qmp-cmds.c
@@ -7,7 +7,7 @@
#include "qemu/osdep.h"
#include "qom/object.h"
-#include "qapi/commands-target-compat.h"
+#include "qapi/qapi-commands-machine.h"
#include "sysemu/arch_init.h"
#include "hw/core/cpu.h"
#include "hw/core/sysemu-cpu-ops.h"
@@ -53,7 +53,7 @@ static void arch_add_cpu_definitions(CpuDefinitionInfoList **cpu_list,
}
}
-CpuDefinitionInfoList *generic_query_cpu_definitions(Error **errp)
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
{
CpuDefinitionInfoList *cpu_list = NULL;
diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c
index c5091e64ec..ac8d890bc0 100644
--- a/target/arm/arm-qmp-cmds.c
+++ b/target/arm/arm-qmp-cmds.c
@@ -28,7 +28,6 @@
#include "qapi/qobject-input-visitor.h"
#include "qapi/qapi-commands-machine-target.h"
#include "qapi/qapi-commands-misc-target.h"
-#include "qapi/commands-target-compat.h"
#include "qapi/qmp/qdict.h"
#include "qom/qom-qobject.h"
@@ -220,8 +219,3 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
return expansion_info;
}
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
- return generic_query_cpu_definitions(errp);
-}
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index e5dbd307d8..f26adefd37 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -38,7 +38,6 @@
#ifndef CONFIG_USER_ONLY
#include "sysemu/reset.h"
#include "qapi/qapi-commands-machine-target.h"
-#include "qapi/commands-target-compat.h"
#include "exec/address-spaces.h"
#include "hw/boards.h"
#include "hw/i386/sgx-epc.h"
@@ -5666,11 +5665,6 @@ static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
QAPI_LIST_PREPEND(*cpu_list, info);
}
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
- return generic_query_cpu_definitions(errp);
-}
-
#endif /* !CONFIG_USER_ONLY */
uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c
index ef5aedc1cd..aaed7bbf93 100644
--- a/target/loongarch/loongarch-qmp-cmds.c
+++ b/target/loongarch/loongarch-qmp-cmds.c
@@ -9,17 +9,11 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-machine-target.h"
-#include "qapi/commands-target-compat.h"
#include "cpu.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qobject-input-visitor.h"
#include "qom/qom-qobject.h"
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
- return generic_query_cpu_definitions(errp);
-}
-
static const char *cpu_model_advertised_features[] = {
"lsx", "lasx", NULL
};
diff --git a/target/mips/sysemu/mips-qmp-cmds.c b/target/mips/sysemu/mips-qmp-cmds.c
index 329db3a028..c3c775acc6 100644
--- a/target/mips/sysemu/mips-qmp-cmds.c
+++ b/target/mips/sysemu/mips-qmp-cmds.c
@@ -5,12 +5,3 @@
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-
-#include "qemu/osdep.h"
-#include "qapi/qapi-commands-machine-target.h"
-#include "qapi/commands-target-compat.h"
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
- return generic_query_cpu_definitions(errp);
-}
diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c
index 267dd84718..f85c4560f9 100644
--- a/target/ppc/ppc-qmp-cmds.c
+++ b/target/ppc/ppc-qmp-cmds.c
@@ -28,8 +28,6 @@
#include "qemu/ctype.h"
#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
-#include "qapi/qapi-commands-machine-target.h"
-#include "qapi/commands-target-compat.h"
#include "cpu-models.h"
#include "cpu-qom.h"
@@ -195,8 +193,3 @@ void ppc_add_alias_definitions(CpuDefinitionInfoList **cpu_list)
QAPI_LIST_PREPEND(*cpu_list, info);
}
}
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
- return generic_query_cpu_definitions(errp);
-}
diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c
index 45adc90d3b..170d720b24 100644
--- a/target/riscv/riscv-qmp-cmds.c
+++ b/target/riscv/riscv-qmp-cmds.c
@@ -26,7 +26,6 @@
#include "qapi/error.h"
#include "qapi/qapi-commands-machine-target.h"
-#include "qapi/commands-target-compat.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qobject-input-visitor.h"
@@ -54,11 +53,6 @@ void riscv_cpu_add_definition(gpointer data, gpointer user_data)
QAPI_LIST_PREPEND(*cpu_list, info);
}
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
- return generic_query_cpu_definitions(errp);
-}
-
static void riscv_check_if_cpu_available(RISCVCPU *cpu, Error **errp)
{
if (!riscv_cpu_accelerator_compatible(cpu)) {
--
2.41.0
next prev parent reply other threads:[~2024-03-15 13:17 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 13:08 [RFC PATCH-for-9.1 00/21] qapi: Make @query-cpu-definitions command target-agnostic Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 01/21] target/i386: Declare CPU QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 02/21] target/mips: " Philippe Mathieu-Daudé
2024-03-18 8:13 ` Zhao Liu
2024-03-15 13:08 ` [PATCH-for-9.1 03/21] target/ppc: " Philippe Mathieu-Daudé
2024-03-18 8:15 ` Zhao Liu
2024-03-15 13:08 ` [PATCH-for-9.1 04/21] target/sparc: " Philippe Mathieu-Daudé
2024-03-18 8:16 ` Zhao Liu
2024-03-15 13:08 ` [PATCH-for-9.1 05/21] cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE() Philippe Mathieu-Daudé
2024-03-18 8:31 ` Zhao Liu
2024-03-15 13:08 ` [PATCH-for-9.1 06/21] target/i386: Make X86_CPU common to new I386_CPU / X86_64_CPU types Philippe Mathieu-Daudé
2024-03-18 8:47 ` Zhao Liu
2024-03-26 10:57 ` Markus Armbruster
2024-03-26 12:17 ` Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 07/21] target/mips: Make MIPS_CPU common to new MIPS32_CPU / MIPS64_CPU types Philippe Mathieu-Daudé
2024-03-19 18:12 ` Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 08/21] target/sparc: Make SPARC_CPU common to new SPARC32_CPU/SPARC64_CPU types Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 09/21] qapi: Merge machine-common.json with qapi/machine.json Philippe Mathieu-Daudé
2024-03-26 12:12 ` Markus Armbruster
2024-03-15 13:08 ` [PATCH-for-9.1 10/21] qapi: Make CpuModel* definitions target agnostic Philippe Mathieu-Daudé
2024-03-20 8:49 ` Philippe Mathieu-Daudé
2024-03-26 12:16 ` Markus Armbruster
2024-03-15 13:08 ` [PATCH-for-9.1 11/21] qapi: Make CpuDefinitionInfo " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [PATCH-for-9.1 12/21] system: Introduce QemuArchBit enum Philippe Mathieu-Daudé
2024-03-15 13:09 ` [PATCH-for-9.1 13/21] system: Introduce cpu_typename_by_arch_bit() Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 14/21] system: Introduce QMP generic_query_cpu_definitions() Philippe Mathieu-Daudé
2024-03-26 12:54 ` Markus Armbruster
2024-03-26 13:28 ` Markus Armbruster
2024-03-29 13:03 ` Philippe Mathieu-Daudé
2024-04-02 9:37 ` Markus Armbruster
2024-03-15 13:09 ` [RFC PATCH-for-9.1 15/21] target/arm: Use " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 16/21] target/loongarch: " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 17/21] target/riscv: " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 18/21] target/i386: " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [PATCH-for-9.1 19/21] target/ppc: Factor ppc_add_alias_definitions() out Philippe Mathieu-Daudé
2024-03-20 5:07 ` Nicholas Piggin
2024-03-15 13:09 ` [RFC PATCH-for-9.1 20/21] target/ppc: Use QMP generic_query_cpu_definitions() Philippe Mathieu-Daudé
2024-03-15 13:09 ` Philippe Mathieu-Daudé [this message]
2024-03-26 13:32 ` [RFC PATCH-for-9.1 21/21] qapi: Make @query-cpu-definitions target-agnostic Markus Armbruster
2024-03-26 10:18 ` [RFC PATCH-for-9.1 00/21] qapi: Make @query-cpu-definitions command target-agnostic Markus Armbruster
2024-03-26 13:37 ` Markus Armbruster
2025-03-11 7:56 ` Philippe Mathieu-Daudé
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=20240315130910.15750-22-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=alex.bennee@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=anjo@rev.ng \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=bin.meng@windriver.com \
--cc=cfontana@suse.de \
--cc=chenhuacai@kernel.org \
--cc=danielhb413@gmail.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=gaosong@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=liwei1518@gmail.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
--cc=zhiwei_liu@linux.alibaba.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).