Skip to content

RFC qapi: Make @query-cpu-definitions command target-agnostic

Philippe Mathieu-Daudé qemu-arm qemu-devel qemu-riscv 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest21 patches 20 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21target/i386: Declare CPU QOM types using DEFINE_TYPES() macrotarget/i386/cpu.c+23 -270 replies
2/21target/mips: Declare CPU QOM types using DEFINE_TYPES() macrotarget/mips/cpu.c+13 -101 reply
3/21target/ppc: Declare CPU QOM types using DEFINE_TYPES() macrotarget/ppc/cpu_init.c+23 -291 reply
4/21target/sparc: Declare CPU QOM types using DEFINE_TYPES() macrotarget/sparc/cpu.c+13 -101 reply
5/21cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE()include/hw/core/cpu.h+6 -11 reply
6/21target/i386: Make X86_CPU common to new I386_CPU / X86_64_CPU typestarget/i386/cpu-qom.h target/i386/cpu.c tests/qtest/cpu-plug-test.c+29 -93 replies
7/21target/mips: Make MIPS_CPU common to new MIPS32_CPU / MIPS64_CPU typestarget/mips/cpu-qom.h target/mips/cpu.c target/mips/sysemu/mips-qmp-cmds.c+19 -311 reply
8/21target/sparc: Make SPARC_CPU common to new SPARC32_CPU/SPARC64_CPU typestarget/sparc/cpu-qom.h target/sparc/cpu.c+16 -50 replies
9/21qapi: Merge machine-common.json with qapi/machine.jsonMAINTAINERS qapi/machine-common.json qapi/machine-target.json +4 more+14 -271 reply
10/21qapi: Make CpuModel* definitions target agnosticqapi/machine-target.json qapi/machine.json+79 -782 replies
11/21qapi: Make CpuDefinitionInfo target agnosticqapi/machine-target.json qapi/machine.json+63 -690 replies
12/21system: Introduce QemuArchBit enuminclude/sysemu/arch_init.h+47 -220 replies
13/21system: Introduce cpu_typename_by_arch_bit()MAINTAINERS include/sysemu/arch_init.h system/cpu-qom-helpers.c +1 more+62 -00 replies
14/21system: Introduce QMP generic_query_cpu_definitions()MAINTAINERS include/hw/core/sysemu-cpu-ops.h include/qapi/commands-target-compat.h +2 more+102 -04 replies
15/21target/arm: Use QMP generic_query_cpu_definitions()target/arm/arm-qmp-cmds.c+2 -230 replies
16/21target/loongarch: Use QMP generic_query_cpu_definitions()target/loongarch/loongarch-qmp-cmds.c+2 -210 replies
17/21target/riscv: Use QMP generic_query_cpu_definitions()target/riscv/cpu.c target/riscv/cpu.h target/riscv/riscv-qmp-cmds.c+6 -80 replies
18/21target/i386: Use QMP generic_query_cpu_definitions()target/i386/cpu.c+4 -50 replies
19/21target/ppc: Factor ppc_add_alias_definitions() outtarget/ppc/cpu-models.h target/ppc/ppc-qmp-cmds.c+19 -111 reply
20/21target/ppc: Use QMP generic_query_cpu_definitions()target/ppc/cpu_init.c target/ppc/ppc-qmp-cmds.c+3 -240 replies
21/21qapi: Make @query-cpu-definitions target-agnosticMAINTAINERS include/qapi/commands-target-compat.h qapi/machine-target.json +8 more+13 -751 reply

Reviews trailers per patch

8 of 21 patches have a Reviewed-by or Acked-by.

PatchRichard HendersonZhao LiuMark Cave-AylandNicholas Piggin
1/21R-b R-b
2/21R-b R-b
3/21R-b R-b
4/21R-b R-b R-b
5/21A-b
6/21A-b
7/21
8/21R-b
9/21
10/21
11/21
12/21
13/21
14/21
15/21
16/21
17/21
18/21
19/21R-b
20/21
21/21

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [RFC PATCH-for-9.1 00/21] qapi: Make @query-cpu-definitions command target-agnostic

Hi Alex, Markus,

Markus mentioned QAPI problems with the heterogeneous emulation binary. My understanding is, while QAPI can use host-specific conditional (OS, library available, configure option), it shouldn't use target-specific ones.

This series is an example on how to remove target specific bits from the @query-cpu-definitions command. Target specific code is registered as CPUClass handlers, then a generic method is used, iterating over all targets built in.

The first set of patches were already posted / reviewed last year.

The PPC and S390X targets still need work (help welcomed), however the code is useful enough to be tested and see if this is a good approach.

The only drawback is a change in QAPI introspection, because targets not implementing @query-cpu-definitions were returning "CommandNotFound". My view is this was an incomplete implementation, rather than a feature.

Regards,

Phil.

Philippe Mathieu-Daudé (21):
target/i386: Declare CPU QOM types using DEFINE_TYPES() macro target/mips: Declare CPU QOM types using DEFINE_TYPES() macro target/ppc: Declare CPU QOM types using DEFINE_TYPES() macro target/sparc: Declare CPU QOM types using DEFINE_TYPES() macro
cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE() target/i386: Make X86_CPU common to new I386_CPU / X86_64_CPU types target/mips: Make MIPS_CPU common to new MIPS32_CPU / MIPS64_CPU types target/sparc: Make SPARC_CPU common to new SPARC32_CPU/SPARC64_CPU
types
qapi: Merge machine-common.json with qapi/machine.json
qapi: Make CpuModel* definitions target agnostic
qapi: Make CpuDefinitionInfo target agnostic
system: Introduce QemuArchBit enum
system: Introduce cpu_typename_by_arch_bit()
system: Introduce QMP generic_query_cpu_definitions() target/arm: Use QMP generic_query_cpu_definitions() target/loongarch: Use QMP generic_query_cpu_definitions() target/riscv: Use QMP generic_query_cpu_definitions() target/i386: Use QMP generic_query_cpu_definitions() target/ppc: Factor ppc_add_alias_definitions() out target/ppc: Use QMP generic_query_cpu_definitions()
qapi: Make @query-cpu-definitions target-agnostic

 MAINTAINERS                           |   3 +-
 qapi/machine-common.json              |  21 ----
 qapi/machine-target.json              | 167 +-------------------------
 qapi/machine.json                     | 166 ++++++++++++++++++++++++-
 qapi/qapi-schema.json                 |   1 -
 include/hw/core/cpu.h                 |   7 +-
 include/hw/core/sysemu-cpu-ops.h      |  14 +++
 include/sysemu/arch_init.h            |  71 +++++++----
 target/i386/cpu-qom.h                 |  16 ++-
 target/mips/cpu-qom.h                 |  13 +-
 target/ppc/cpu-models.h               |   4 +
 target/riscv/cpu.h                    |   2 +
 target/s390x/cpu.h                    |   2 +-
 target/sparc/cpu-qom.h                |   9 +-
 system/cpu-qmp-cmds.c                 |  71 +++++++++++
 system/cpu-qom-helpers.c              |  58 +++++++++
 target/arm/arm-qmp-cmds.c             |  27 -----
 target/i386/cpu.c                     |  77 ++++++------
 target/loongarch/loongarch-qmp-cmds.c |  25 ----
 target/mips/cpu.c                     |  34 ++++--
 target/mips/sysemu/mips-qmp-cmds.c    |  31 -----
 target/ppc/cpu_init.c                 |  53 ++++----
 target/ppc/ppc-qmp-cmds.c             |  31 +----
 target/riscv/cpu.c                    |   1 +
 target/riscv/riscv-qmp-cmds.c         |  13 +-
 target/sparc/cpu.c                    |  35 ++++--
 tests/qtest/cpu-plug-test.c           |   2 +-
 qapi/meson.build                      |   1 -
 system/meson.build                    |   2 +
 29 files changed, 515 insertions(+), 442 deletions(-)
 delete mode 100644 qapi/machine-common.json
 create mode 100644 system/cpu-qmp-cmds.c
 create mode 100644 system/cpu-qom-helpers.c
Signature · 1 line
2.41.0