* [PATCH 00/13] single-binary: make QAPI generated files common
@ 2025-05-07 23:14 Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json Pierrick Bouvier
` (12 more replies)
0 siblings, 13 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
This series compiles QAPI generated once, while keeping the same schema and
commands exposed to the QAPI consumer.
Steps:
- Introduce a new json entry, named 'runtime_if' (name is not definitive,
see patch 1), to allow dynamic check about exposing a given entry/command or
not.
- Conditionally expose the QMP schema based on those conditionals.
- Conditonally register commands
- Conditinally visit fields during JSON marshalling
- Extend existing qemu/target-info.h with the helpers needed.
- Modify QAPI json to use runtime conditionals
- Compile QAPI generated code as common - no more target specifics
Note: A final annex (do not merge) is included to see the differences in the
generated QAPI code, so you don't need to pull and see it by yourself.
Original RFC (and context)
--------------------------
https://patchew.org/QEMU/20250424183350.1798746-1-pierrick.bouvier@linaro.org/
Pierrick Bouvier (13):
qapi: introduce 'runtime_if' for QAPI json
qapi/introspect: generate schema as a QObject directly
qobject/qlit: allow to hide dict or list entries
qapi/introspect: hide fields in schema
qapi/commands: register commands conditionally
qapi/visit: hide fields in JSON marshalling
qapi: add access to qemu/target-info.h
qemu/target-info: implement missing helpers
qapi: transform target specific 'if' in runtime checks
qapi: add weak stubs for target specific commands
qapi: make all generated files common
[ANNEX] build/qapi: reference
[ANNEX] build/qapi: after series
meson.build | 2 +-
qapi/machine-target.json | 84 +-
qapi/misc-target.json | 48 +-
build/qapi/qapi-builtin-types.h | 184 +
build/qapi/qapi-builtin-visit.h | 68 +
build/qapi/qapi-commands-acpi.h | 21 +
build/qapi/qapi-commands-audio.h | 21 +
build/qapi/qapi-commands-authz.h | 19 +
build/qapi/qapi-commands-block-core.h | 105 +
build/qapi/qapi-commands-block-export.h | 35 +
build/qapi/qapi-commands-block.h | 38 +
build/qapi/qapi-commands-char.h | 36 +
build/qapi/qapi-commands-common.h | 19 +
build/qapi/qapi-commands-compat.h | 19 +
build/qapi/qapi-commands-control.h | 27 +
build/qapi/qapi-commands-crypto.h | 19 +
build/qapi/qapi-commands-cryptodev.h | 21 +
build/qapi/qapi-commands-cxl.h | 35 +
build/qapi/qapi-commands-dump.h | 25 +
build/qapi/qapi-commands-ebpf.h | 23 +
build/qapi/qapi-commands-error.h | 19 +
build/qapi/qapi-commands-introspect.h | 21 +
build/qapi/qapi-commands-job.h | 33 +
build/qapi/qapi-commands-machine-common.h | 19 +
build/qapi/qapi-commands-machine-target.h | 32 +
build/qapi/qapi-commands-machine.h | 89 +
build/qapi/qapi-commands-migration.h | 89 +
build/qapi/qapi-commands-misc-target.h | 41 +
build/qapi/qapi-commands-misc.h | 52 +
build/qapi/qapi-commands-net.h | 30 +
build/qapi/qapi-commands-pci.h | 21 +
build/qapi/qapi-commands-pragma.h | 19 +
build/qapi/qapi-commands-qdev.h | 26 +
build/qapi/qapi-commands-qom.h | 37 +
build/qapi/qapi-commands-replay.h | 28 +
build/qapi/qapi-commands-rocker.h | 27 +
build/qapi/qapi-commands-run-state.h | 25 +
build/qapi/qapi-commands-sockets.h | 19 +
build/qapi/qapi-commands-stats.h | 23 +
build/qapi/qapi-commands-tpm.h | 31 +
build/qapi/qapi-commands-trace.h | 23 +
build/qapi/qapi-commands-transaction.h | 22 +
build/qapi/qapi-commands-uefi.h | 19 +
build/qapi/qapi-commands-ui.h | 59 +
build/qapi/qapi-commands-vfio.h | 19 +
build/qapi/qapi-commands-virtio.h | 29 +
build/qapi/qapi-commands-yank.h | 23 +
build/qapi/qapi-commands.h | 60 +
build/qapi/qapi-emit-events.h | 85 +
build/qapi/qapi-events-acpi.h | 21 +
build/qapi/qapi-events-audio.h | 19 +
build/qapi/qapi-events-authz.h | 19 +
build/qapi/qapi-events-block-core.h | 43 +
build/qapi/qapi-events-block-export.h | 23 +
build/qapi/qapi-events-block.h | 24 +
build/qapi/qapi-events-char.h | 22 +
build/qapi/qapi-events-common.h | 19 +
build/qapi/qapi-events-compat.h | 19 +
build/qapi/qapi-events-control.h | 19 +
build/qapi/qapi-events-crypto.h | 19 +
build/qapi/qapi-events-cryptodev.h | 19 +
build/qapi/qapi-events-cxl.h | 19 +
build/qapi/qapi-events-dump.h | 21 +
build/qapi/qapi-events-ebpf.h | 19 +
build/qapi/qapi-events-error.h | 19 +
build/qapi/qapi-events-introspect.h | 19 +
build/qapi/qapi-events-job.h | 21 +
build/qapi/qapi-events-machine-common.h | 19 +
build/qapi/qapi-events-machine-target.h | 22 +
build/qapi/qapi-events-machine.h | 27 +
build/qapi/qapi-events-migration.h | 29 +
build/qapi/qapi-events-misc-target.h | 19 +
build/qapi/qapi-events-misc.h | 24 +
build/qapi/qapi-events-net.h | 32 +
build/qapi/qapi-events-pci.h | 19 +
build/qapi/qapi-events-pragma.h | 19 +
build/qapi/qapi-events-qdev.h | 24 +
build/qapi/qapi-events-qom.h | 23 +
build/qapi/qapi-events-replay.h | 20 +
build/qapi/qapi-events-rocker.h | 19 +
build/qapi/qapi-events-run-state.h | 45 +
build/qapi/qapi-events-sockets.h | 19 +
build/qapi/qapi-events-stats.h | 19 +
build/qapi/qapi-events-tpm.h | 19 +
build/qapi/qapi-events-trace.h | 19 +
build/qapi/qapi-events-transaction.h | 20 +
build/qapi/qapi-events-uefi.h | 19 +
build/qapi/qapi-events-ui.h | 49 +
build/qapi/qapi-events-vfio.h | 21 +
build/qapi/qapi-events-virtio.h | 19 +
build/qapi/qapi-events-yank.h | 19 +
build/qapi/qapi-events.h | 60 +
build/qapi/qapi-features.h | 28 +
build/qapi/qapi-init-commands.h | 20 +
build/qapi/qapi-introspect.h | 19 +
build/qapi/qapi-types-acpi.h | 78 +
build/qapi/qapi-types-audio.h | 537 +
build/qapi/qapi-types-authz.h | 103 +
build/qapi/qapi-types-block-core.h | 3643 ++
build/qapi/qapi-types-block-export.h | 313 +
build/qapi/qapi-types-block.h | 161 +
build/qapi/qapi-types-char.h | 728 +
build/qapi/qapi-types-common.h | 175 +
build/qapi/qapi-types-compat.h | 57 +
build/qapi/qapi-types-control.h | 110 +
build/qapi/qapi-types-crypto.h | 527 +
build/qapi/qapi-types-cryptodev.h | 106 +
build/qapi/qapi-types-cxl.h | 247 +
build/qapi/qapi-types-dump.h | 100 +
build/qapi/qapi-types-ebpf.h | 55 +
build/qapi/qapi-types-error.h | 32 +
build/qapi/qapi-types-introspect.h | 244 +
build/qapi/qapi-types-job.h | 140 +
build/qapi/qapi-types-machine-common.h | 91 +
build/qapi/qapi-types-machine-target.h | 172 +
build/qapi/qapi-types-machine.h | 922 +
build/qapi/qapi-types-migration.h | 900 +
build/qapi/qapi-types-misc-target.h | 238 +
build/qapi/qapi-types-misc.h | 241 +
build/qapi/qapi-types-net.h | 549 +
build/qapi/qapi-types-pci.h | 152 +
build/qapi/qapi-types-pragma.h | 18 +
build/qapi/qapi-types-qdev.h | 59 +
build/qapi/qapi-types-qom.h | 1049 +
build/qapi/qapi-types-replay.h | 54 +
build/qapi/qapi-types-rocker.h | 231 +
build/qapi/qapi-types-run-state.h | 312 +
build/qapi/qapi-types-sockets.h | 220 +
build/qapi/qapi-types-stats.h | 231 +
build/qapi/qapi-types-tpm.h | 194 +
build/qapi/qapi-types-trace.h | 65 +
build/qapi/qapi-types-transaction.h | 197 +
build/qapi/qapi-types-uefi.h | 52 +
build/qapi/qapi-types-ui.h | 1263 +
build/qapi/qapi-types-vfio.h | 42 +
build/qapi/qapi-types-virtio.h | 307 +
build/qapi/qapi-types-yank.h | 83 +
build/qapi/qapi-types.h | 59 +
build/qapi/qapi-visit-acpi.h | 38 +
build/qapi/qapi-visit-audio.h | 136 +
build/qapi/qapi-visit-authz.h | 54 +
build/qapi/qapi-visit-block-core.h | 962 +
build/qapi/qapi-visit-block-export.h | 99 +
build/qapi/qapi-visit-block.h | 56 +
build/qapi/qapi-visit-char.h | 235 +
build/qapi/qapi-visit-common.h | 58 +
build/qapi/qapi-visit-compat.h | 31 +
build/qapi/qapi-visit-control.h | 54 +
build/qapi/qapi-visit-crypto.h | 165 +
build/qapi/qapi-visit-cryptodev.h | 48 +
build/qapi/qapi-visit-cxl.h | 67 +
build/qapi/qapi-visit-dump.h | 43 +
build/qapi/qapi-visit-ebpf.h | 36 +
build/qapi/qapi-visit-error.h | 23 +
build/qapi/qapi-visit-introspect.h | 103 +
build/qapi/qapi-visit-job.h | 51 +
build/qapi/qapi-visit-machine-common.h | 42 +
build/qapi/qapi-visit-machine-target.h | 73 +
build/qapi/qapi-visit-machine.h | 311 +
build/qapi/qapi-visit-migration.h | 241 +
build/qapi/qapi-visit-misc-target.h | 96 +
build/qapi/qapi-visit-misc.h | 98 +
build/qapi/qapi-visit-net.h | 171 +
build/qapi/qapi-visit-pci.h | 69 +
build/qapi/qapi-visit-pragma.h | 20 +
build/qapi/qapi-visit-qdev.h | 33 +
build/qapi/qapi-visit-qom.h | 263 +
build/qapi/qapi-visit-replay.h | 33 +
build/qapi/qapi-visit-rocker.h | 78 +
build/qapi/qapi-visit-run-state.h | 99 +
build/qapi/qapi-visit-sockets.h | 91 +
build/qapi/qapi-visit-stats.h | 89 +
build/qapi/qapi-visit-tpm.h | 91 +
build/qapi/qapi-visit-trace.h | 35 +
build/qapi/qapi-visit-transaction.h | 94 +
build/qapi/qapi-visit-uefi.h | 33 +
build/qapi/qapi-visit-ui.h | 370 +
build/qapi/qapi-visit-vfio.h | 25 +
build/qapi/qapi-visit-virtio.h | 113 +
build/qapi/qapi-visit-yank.h | 45 +
build/qapi/qapi-visit.h | 61 +
include/qemu/target-info.h | 14 +
include/qobject/qlit.h | 12 +
build/qapi/qapi-builtin-types.c | 227 +
build/qapi/qapi-builtin-visit.c | 448 +
build/qapi/qapi-commands-acpi.c | 87 +
build/qapi/qapi-commands-audio.c | 87 +
build/qapi/qapi-commands-authz.c | 26 +
build/qapi/qapi-commands-block-core.c | 1931 +
build/qapi/qapi-commands-block-export.c | 341 +
build/qapi/qapi-commands-block.c | 431 +
build/qapi/qapi-commands-char.c | 457 +
build/qapi/qapi-commands-common.c | 26 +
build/qapi/qapi-commands-compat.c | 26 +
build/qapi/qapi-commands-control.c | 230 +
build/qapi/qapi-commands-crypto.c | 26 +
build/qapi/qapi-commands-cryptodev.c | 87 +
build/qapi/qapi-commands-cxl.c | 370 +
build/qapi/qapi-commands-dump.c | 191 +
build/qapi/qapi-commands-ebpf.c | 95 +
build/qapi/qapi-commands-error.c | 26 +
build/qapi/qapi-commands-introspect.c | 87 +
build/qapi/qapi-commands-job.c | 345 +
build/qapi/qapi-commands-machine-common.c | 26 +
build/qapi/qapi-commands-machine-target.c | 386 +
build/qapi/qapi-commands-machine.c | 1626 +
build/qapi/qapi-commands-migration.c | 1415 +
build/qapi/qapi-commands-misc-target.c | 628 +
build/qapi/qapi-commands-misc.c | 740 +
build/qapi/qapi-commands-net.c | 263 +
build/qapi/qapi-commands-pci.c | 87 +
build/qapi/qapi-commands-pragma.c | 26 +
build/qapi/qapi-commands-qdev.c | 177 +
build/qapi/qapi-commands-qom.c | 400 +
build/qapi/qapi-commands-replay.c | 212 +
build/qapi/qapi-commands-rocker.c | 286 +
build/qapi/qapi-commands-run-state.c | 173 +
build/qapi/qapi-commands-sockets.c | 26 +
build/qapi/qapi-commands-stats.c | 156 +
build/qapi/qapi-commands-tpm.c | 221 +
build/qapi/qapi-commands-trace.c | 134 +
build/qapi/qapi-commands-transaction.c | 69 +
build/qapi/qapi-commands-uefi.c | 26 +
build/qapi/qapi-commands-ui.c | 734 +
build/qapi/qapi-commands-vfio.c | 26 +
build/qapi/qapi-commands-virtio.c | 347 +
build/qapi/qapi-commands-yank.c | 130 +
build/qapi/qapi-commands.c | 24 +
build/qapi/qapi-emit-events.c | 79 +
build/qapi/qapi-events-acpi.c | 53 +
build/qapi/qapi-events-audio.c | 23 +
build/qapi/qapi-events-authz.c | 23 +
build/qapi/qapi-events-block-core.c | 323 +
build/qapi/qapi-events-block-export.c | 53 +
build/qapi/qapi-events-block.c | 83 +
build/qapi/qapi-events-char.c | 53 +
build/qapi/qapi-events-common.c | 23 +
build/qapi/qapi-events-compat.c | 23 +
build/qapi/qapi-events-control.c | 23 +
build/qapi/qapi-events-crypto.c | 23 +
build/qapi/qapi-events-cryptodev.c | 23 +
build/qapi/qapi-events-cxl.c | 23 +
build/qapi/qapi-events-dump.c | 53 +
build/qapi/qapi-events-ebpf.c | 23 +
build/qapi/qapi-events-error.c | 23 +
build/qapi/qapi-events-introspect.c | 23 +
build/qapi/qapi-events-job.c | 53 +
build/qapi/qapi-events-machine-common.c | 23 +
build/qapi/qapi-events-machine-target.c | 57 +
build/qapi/qapi-events-machine.c | 110 +
build/qapi/qapi-events-migration.c | 143 +
build/qapi/qapi-events-misc-target.c | 23 +
build/qapi/qapi-events-misc.c | 83 +
build/qapi/qapi-events-net.c | 203 +
build/qapi/qapi-events-pci.c | 23 +
build/qapi/qapi-events-pragma.c | 23 +
build/qapi/qapi-events-qdev.c | 83 +
build/qapi/qapi-events-qom.c | 23 +
build/qapi/qapi-events-replay.c | 23 +
build/qapi/qapi-events-rocker.c | 23 +
build/qapi/qapi-events-run-state.c | 280 +
build/qapi/qapi-events-sockets.c | 23 +
build/qapi/qapi-events-stats.c | 23 +
build/qapi/qapi-events-tpm.c | 23 +
build/qapi/qapi-events-trace.c | 23 +
build/qapi/qapi-events-transaction.c | 23 +
build/qapi/qapi-events-uefi.c | 23 +
build/qapi/qapi-events-ui.c | 228 +
build/qapi/qapi-events-vfio.c | 53 +
build/qapi/qapi-events-virtio.c | 23 +
build/qapi/qapi-events-yank.c | 23 +
build/qapi/qapi-events.c | 23 +
build/qapi/qapi-features.c | 14 +
build/qapi/qapi-init-commands.c | 576 +
build/qapi/qapi-introspect.c | 32177 ++++++++++++++++
build/qapi/qapi-types-acpi.c | 67 +
build/qapi/qapi-types-audio.c | 360 +
build/qapi/qapi-types-authz.c | 114 +
build/qapi/qapi-types-block-core.c | 2488 ++
build/qapi/qapi-types-block-export.c | 211 +
build/qapi/qapi-types-block.c | 77 +
build/qapi/qapi-types-char.c | 560 +
build/qapi/qapi-types-common.c | 151 +
build/qapi/qapi-types-compat.c | 50 +
build/qapi/qapi-types-control.c | 113 +
build/qapi/qapi-types-crypto.c | 415 +
build/qapi/qapi-types-cryptodev.c | 113 +
build/qapi/qapi-types-cxl.c | 134 +
build/qapi/qapi-types-dump.c | 83 +
build/qapi/qapi-types-ebpf.c | 44 +
build/qapi/qapi-types-error.c | 31 +
build/qapi/qapi-types-introspect.c | 268 +
build/qapi/qapi-types-job.c | 92 +
build/qapi/qapi-types-machine-common.c | 94 +
build/qapi/qapi-types-machine-target.c | 137 +
build/qapi/qapi-types-machine.c | 811 +
build/qapi/qapi-types-migration.c | 606 +
build/qapi/qapi-types-misc-target.c | 221 +
build/qapi/qapi-types-misc.c | 186 +
build/qapi/qapi-types-net.c | 378 +
build/qapi/qapi-types-pci.c | 163 +
build/qapi/qapi-types-pragma.c | 20 +
build/qapi/qapi-types-qdev.c | 20 +
build/qapi/qapi-types-qom.c | 659 +
build/qapi/qapi-types-replay.c | 42 +
build/qapi/qapi-types-rocker.c | 166 +
build/qapi/qapi-types-run-state.c | 218 +
build/qapi/qapi-types-sockets.c | 210 +
build/qapi/qapi-types-stats.c | 227 +
build/qapi/qapi-types-tpm.c | 176 +
build/qapi/qapi-types-trace.c | 55 +
build/qapi/qapi-types-transaction.c | 218 +
build/qapi/qapi-types-uefi.c | 59 +
build/qapi/qapi-types-ui.c | 987 +
build/qapi/qapi-types-vfio.c | 33 +
build/qapi/qapi-types-virtio.c | 261 +
build/qapi/qapi-types-yank.c | 81 +
build/qapi/qapi-types.c | 20 +
build/qapi/qapi-visit-acpi.c | 200 +
build/qapi/qapi-visit-audio.c | 1183 +
build/qapi/qapi-visit-authz.c | 261 +
build/qapi/qapi-visit-block-core.c | 9436 +++++
build/qapi/qapi-visit-block-export.c | 667 +
build/qapi/qapi-visit-block.c | 311 +
build/qapi/qapi-visit-char.c | 1625 +
build/qapi/qapi-visit-common.c | 187 +
build/qapi/qapi-visit-compat.c | 90 +
build/qapi/qapi-visit-control.c | 270 +
build/qapi/qapi-visit-crypto.c | 1112 +
build/qapi/qapi-visit-cryptodev.c | 210 +
build/qapi/qapi-visit-cxl.c | 452 +
build/qapi/qapi-visit-dump.c | 188 +
build/qapi/qapi-visit-ebpf.c | 78 +
build/qapi/qapi-visit-error.c | 29 +
build/qapi/qapi-visit-introspect.c | 683 +
build/qapi/qapi-visit-job.c | 188 +
build/qapi/qapi-visit-machine-common.c | 148 +
build/qapi/qapi-visit-machine-target.c | 400 +
build/qapi/qapi-visit-machine.c | 2477 ++
build/qapi/qapi-visit-migration.c | 1918 +
build/qapi/qapi-visit-misc-target.c | 598 +
build/qapi/qapi-visit-misc.c | 600 +
build/qapi/qapi-visit-net.c | 1583 +
build/qapi/qapi-visit-pci.c | 482 +
build/qapi/qapi-visit-pragma.c | 20 +
build/qapi/qapi-visit-qdev.c | 95 +
build/qapi/qapi-visit-qom.c | 2164 ++
build/qapi/qapi-visit-replay.c | 90 +
build/qapi/qapi-visit-rocker.c | 617 +
build/qapi/qapi-visit-run-state.c | 453 +
build/qapi/qapi-visit-sockets.c | 571 +
build/qapi/qapi-visit-stats.c | 566 +
build/qapi/qapi-visit-tpm.c | 388 +
build/qapi/qapi-visit-trace.c | 119 +
build/qapi/qapi-visit-transaction.c | 536 +
build/qapi/qapi-visit-uefi.c | 143 +
build/qapi/qapi-visit-ui.c | 2346 ++
build/qapi/qapi-visit-vfio.c | 43 +
build/qapi/qapi-visit-virtio.c | 889 +
build/qapi/qapi-visit-yank.c | 188 +
build/qapi/qapi-visit.c | 20 +
monitor/qmp-cmds-control.c | 2 +-
qapi/commands-weak-stubs.c | 38 +
qobject/qlit.c | 10 +-
target-info.c | 117 +
tests/unit/test-qobject-input-visitor.c | 6 +-
build/qapi/qapi-commands-acpi.trace-events | 4 +
build/qapi/qapi-commands-audio.trace-events | 4 +
build/qapi/qapi-commands-authz.trace-events | 2 +
.../qapi-commands-block-core.trace-events | 84 +
.../qapi-commands-block-export.trace-events | 16 +
build/qapi/qapi-commands-block.trace-events | 20 +
build/qapi/qapi-commands-char.trace-events | 18 +
build/qapi/qapi-commands-common.trace-events | 2 +
build/qapi/qapi-commands-compat.trace-events | 2 +
build/qapi/qapi-commands-control.trace-events | 10 +
build/qapi/qapi-commands-crypto.trace-events | 2 +
.../qapi/qapi-commands-cryptodev.trace-events | 4 +
build/qapi/qapi-commands-cxl.trace-events | 18 +
build/qapi/qapi-commands-dump.trace-events | 8 +
build/qapi/qapi-commands-ebpf.trace-events | 4 +
build/qapi/qapi-commands-error.trace-events | 2 +
.../qapi-commands-introspect.trace-events | 4 +
build/qapi/qapi-commands-job.trace-events | 16 +
.../qapi-commands-machine-common.trace-events | 2 +
.../qapi-commands-machine-target.trace-events | 14 +
build/qapi/qapi-commands-machine.trace-events | 64 +
.../qapi/qapi-commands-migration.trace-events | 60 +
.../qapi-commands-misc-target.trace-events | 24 +
build/qapi/qapi-commands-misc.trace-events | 30 +
build/qapi/qapi-commands-net.trace-events | 12 +
build/qapi/qapi-commands-pci.trace-events | 4 +
build/qapi/qapi-commands-pragma.trace-events | 2 +
build/qapi/qapi-commands-qdev.trace-events | 8 +
build/qapi/qapi-commands-qom.trace-events | 16 +
build/qapi/qapi-commands-replay.trace-events | 10 +
build/qapi/qapi-commands-rocker.trace-events | 10 +
.../qapi/qapi-commands-run-state.trace-events | 8 +
build/qapi/qapi-commands-sockets.trace-events | 2 +
build/qapi/qapi-commands-stats.trace-events | 6 +
build/qapi/qapi-commands-tpm.trace-events | 8 +
build/qapi/qapi-commands-trace.trace-events | 6 +
.../qapi-commands-transaction.trace-events | 4 +
build/qapi/qapi-commands-uefi.trace-events | 2 +
build/qapi/qapi-commands-ui.trace-events | 30 +
build/qapi/qapi-commands-vfio.trace-events | 2 +
build/qapi/qapi-commands-virtio.trace-events | 12 +
build/qapi/qapi-commands-yank.trace-events | 6 +
build/qapi/qapi-commands.trace-events | 2 +
build/qapi/qapi-init-commands.trace-events | 2 +
qapi/meson.build | 4 +-
scripts/qapi/commands.py | 10 +-
scripts/qapi/common.py | 16 +-
scripts/qapi/expr.py | 18 +-
scripts/qapi/gen.py | 56 +-
scripts/qapi/introspect.py | 38 +-
scripts/qapi/schema.py | 47 +-
scripts/qapi/visit.py | 4 +
418 files changed, 119094 insertions(+), 101 deletions(-)
create mode 100644 build/qapi/qapi-builtin-types.h
create mode 100644 build/qapi/qapi-builtin-visit.h
create mode 100644 build/qapi/qapi-commands-acpi.h
create mode 100644 build/qapi/qapi-commands-audio.h
create mode 100644 build/qapi/qapi-commands-authz.h
create mode 100644 build/qapi/qapi-commands-block-core.h
create mode 100644 build/qapi/qapi-commands-block-export.h
create mode 100644 build/qapi/qapi-commands-block.h
create mode 100644 build/qapi/qapi-commands-char.h
create mode 100644 build/qapi/qapi-commands-common.h
create mode 100644 build/qapi/qapi-commands-compat.h
create mode 100644 build/qapi/qapi-commands-control.h
create mode 100644 build/qapi/qapi-commands-crypto.h
create mode 100644 build/qapi/qapi-commands-cryptodev.h
create mode 100644 build/qapi/qapi-commands-cxl.h
create mode 100644 build/qapi/qapi-commands-dump.h
create mode 100644 build/qapi/qapi-commands-ebpf.h
create mode 100644 build/qapi/qapi-commands-error.h
create mode 100644 build/qapi/qapi-commands-introspect.h
create mode 100644 build/qapi/qapi-commands-job.h
create mode 100644 build/qapi/qapi-commands-machine-common.h
create mode 100644 build/qapi/qapi-commands-machine-target.h
create mode 100644 build/qapi/qapi-commands-machine.h
create mode 100644 build/qapi/qapi-commands-migration.h
create mode 100644 build/qapi/qapi-commands-misc-target.h
create mode 100644 build/qapi/qapi-commands-misc.h
create mode 100644 build/qapi/qapi-commands-net.h
create mode 100644 build/qapi/qapi-commands-pci.h
create mode 100644 build/qapi/qapi-commands-pragma.h
create mode 100644 build/qapi/qapi-commands-qdev.h
create mode 100644 build/qapi/qapi-commands-qom.h
create mode 100644 build/qapi/qapi-commands-replay.h
create mode 100644 build/qapi/qapi-commands-rocker.h
create mode 100644 build/qapi/qapi-commands-run-state.h
create mode 100644 build/qapi/qapi-commands-sockets.h
create mode 100644 build/qapi/qapi-commands-stats.h
create mode 100644 build/qapi/qapi-commands-tpm.h
create mode 100644 build/qapi/qapi-commands-trace.h
create mode 100644 build/qapi/qapi-commands-transaction.h
create mode 100644 build/qapi/qapi-commands-uefi.h
create mode 100644 build/qapi/qapi-commands-ui.h
create mode 100644 build/qapi/qapi-commands-vfio.h
create mode 100644 build/qapi/qapi-commands-virtio.h
create mode 100644 build/qapi/qapi-commands-yank.h
create mode 100644 build/qapi/qapi-commands.h
create mode 100644 build/qapi/qapi-emit-events.h
create mode 100644 build/qapi/qapi-events-acpi.h
create mode 100644 build/qapi/qapi-events-audio.h
create mode 100644 build/qapi/qapi-events-authz.h
create mode 100644 build/qapi/qapi-events-block-core.h
create mode 100644 build/qapi/qapi-events-block-export.h
create mode 100644 build/qapi/qapi-events-block.h
create mode 100644 build/qapi/qapi-events-char.h
create mode 100644 build/qapi/qapi-events-common.h
create mode 100644 build/qapi/qapi-events-compat.h
create mode 100644 build/qapi/qapi-events-control.h
create mode 100644 build/qapi/qapi-events-crypto.h
create mode 100644 build/qapi/qapi-events-cryptodev.h
create mode 100644 build/qapi/qapi-events-cxl.h
create mode 100644 build/qapi/qapi-events-dump.h
create mode 100644 build/qapi/qapi-events-ebpf.h
create mode 100644 build/qapi/qapi-events-error.h
create mode 100644 build/qapi/qapi-events-introspect.h
create mode 100644 build/qapi/qapi-events-job.h
create mode 100644 build/qapi/qapi-events-machine-common.h
create mode 100644 build/qapi/qapi-events-machine-target.h
create mode 100644 build/qapi/qapi-events-machine.h
create mode 100644 build/qapi/qapi-events-migration.h
create mode 100644 build/qapi/qapi-events-misc-target.h
create mode 100644 build/qapi/qapi-events-misc.h
create mode 100644 build/qapi/qapi-events-net.h
create mode 100644 build/qapi/qapi-events-pci.h
create mode 100644 build/qapi/qapi-events-pragma.h
create mode 100644 build/qapi/qapi-events-qdev.h
create mode 100644 build/qapi/qapi-events-qom.h
create mode 100644 build/qapi/qapi-events-replay.h
create mode 100644 build/qapi/qapi-events-rocker.h
create mode 100644 build/qapi/qapi-events-run-state.h
create mode 100644 build/qapi/qapi-events-sockets.h
create mode 100644 build/qapi/qapi-events-stats.h
create mode 100644 build/qapi/qapi-events-tpm.h
create mode 100644 build/qapi/qapi-events-trace.h
create mode 100644 build/qapi/qapi-events-transaction.h
create mode 100644 build/qapi/qapi-events-uefi.h
create mode 100644 build/qapi/qapi-events-ui.h
create mode 100644 build/qapi/qapi-events-vfio.h
create mode 100644 build/qapi/qapi-events-virtio.h
create mode 100644 build/qapi/qapi-events-yank.h
create mode 100644 build/qapi/qapi-events.h
create mode 100644 build/qapi/qapi-features.h
create mode 100644 build/qapi/qapi-init-commands.h
create mode 100644 build/qapi/qapi-introspect.h
create mode 100644 build/qapi/qapi-types-acpi.h
create mode 100644 build/qapi/qapi-types-audio.h
create mode 100644 build/qapi/qapi-types-authz.h
create mode 100644 build/qapi/qapi-types-block-core.h
create mode 100644 build/qapi/qapi-types-block-export.h
create mode 100644 build/qapi/qapi-types-block.h
create mode 100644 build/qapi/qapi-types-char.h
create mode 100644 build/qapi/qapi-types-common.h
create mode 100644 build/qapi/qapi-types-compat.h
create mode 100644 build/qapi/qapi-types-control.h
create mode 100644 build/qapi/qapi-types-crypto.h
create mode 100644 build/qapi/qapi-types-cryptodev.h
create mode 100644 build/qapi/qapi-types-cxl.h
create mode 100644 build/qapi/qapi-types-dump.h
create mode 100644 build/qapi/qapi-types-ebpf.h
create mode 100644 build/qapi/qapi-types-error.h
create mode 100644 build/qapi/qapi-types-introspect.h
create mode 100644 build/qapi/qapi-types-job.h
create mode 100644 build/qapi/qapi-types-machine-common.h
create mode 100644 build/qapi/qapi-types-machine-target.h
create mode 100644 build/qapi/qapi-types-machine.h
create mode 100644 build/qapi/qapi-types-migration.h
create mode 100644 build/qapi/qapi-types-misc-target.h
create mode 100644 build/qapi/qapi-types-misc.h
create mode 100644 build/qapi/qapi-types-net.h
create mode 100644 build/qapi/qapi-types-pci.h
create mode 100644 build/qapi/qapi-types-pragma.h
create mode 100644 build/qapi/qapi-types-qdev.h
create mode 100644 build/qapi/qapi-types-qom.h
create mode 100644 build/qapi/qapi-types-replay.h
create mode 100644 build/qapi/qapi-types-rocker.h
create mode 100644 build/qapi/qapi-types-run-state.h
create mode 100644 build/qapi/qapi-types-sockets.h
create mode 100644 build/qapi/qapi-types-stats.h
create mode 100644 build/qapi/qapi-types-tpm.h
create mode 100644 build/qapi/qapi-types-trace.h
create mode 100644 build/qapi/qapi-types-transaction.h
create mode 100644 build/qapi/qapi-types-uefi.h
create mode 100644 build/qapi/qapi-types-ui.h
create mode 100644 build/qapi/qapi-types-vfio.h
create mode 100644 build/qapi/qapi-types-virtio.h
create mode 100644 build/qapi/qapi-types-yank.h
create mode 100644 build/qapi/qapi-types.h
create mode 100644 build/qapi/qapi-visit-acpi.h
create mode 100644 build/qapi/qapi-visit-audio.h
create mode 100644 build/qapi/qapi-visit-authz.h
create mode 100644 build/qapi/qapi-visit-block-core.h
create mode 100644 build/qapi/qapi-visit-block-export.h
create mode 100644 build/qapi/qapi-visit-block.h
create mode 100644 build/qapi/qapi-visit-char.h
create mode 100644 build/qapi/qapi-visit-common.h
create mode 100644 build/qapi/qapi-visit-compat.h
create mode 100644 build/qapi/qapi-visit-control.h
create mode 100644 build/qapi/qapi-visit-crypto.h
create mode 100644 build/qapi/qapi-visit-cryptodev.h
create mode 100644 build/qapi/qapi-visit-cxl.h
create mode 100644 build/qapi/qapi-visit-dump.h
create mode 100644 build/qapi/qapi-visit-ebpf.h
create mode 100644 build/qapi/qapi-visit-error.h
create mode 100644 build/qapi/qapi-visit-introspect.h
create mode 100644 build/qapi/qapi-visit-job.h
create mode 100644 build/qapi/qapi-visit-machine-common.h
create mode 100644 build/qapi/qapi-visit-machine-target.h
create mode 100644 build/qapi/qapi-visit-machine.h
create mode 100644 build/qapi/qapi-visit-migration.h
create mode 100644 build/qapi/qapi-visit-misc-target.h
create mode 100644 build/qapi/qapi-visit-misc.h
create mode 100644 build/qapi/qapi-visit-net.h
create mode 100644 build/qapi/qapi-visit-pci.h
create mode 100644 build/qapi/qapi-visit-pragma.h
create mode 100644 build/qapi/qapi-visit-qdev.h
create mode 100644 build/qapi/qapi-visit-qom.h
create mode 100644 build/qapi/qapi-visit-replay.h
create mode 100644 build/qapi/qapi-visit-rocker.h
create mode 100644 build/qapi/qapi-visit-run-state.h
create mode 100644 build/qapi/qapi-visit-sockets.h
create mode 100644 build/qapi/qapi-visit-stats.h
create mode 100644 build/qapi/qapi-visit-tpm.h
create mode 100644 build/qapi/qapi-visit-trace.h
create mode 100644 build/qapi/qapi-visit-transaction.h
create mode 100644 build/qapi/qapi-visit-uefi.h
create mode 100644 build/qapi/qapi-visit-ui.h
create mode 100644 build/qapi/qapi-visit-vfio.h
create mode 100644 build/qapi/qapi-visit-virtio.h
create mode 100644 build/qapi/qapi-visit-yank.h
create mode 100644 build/qapi/qapi-visit.h
create mode 100644 build/qapi/qapi-builtin-types.c
create mode 100644 build/qapi/qapi-builtin-visit.c
create mode 100644 build/qapi/qapi-commands-acpi.c
create mode 100644 build/qapi/qapi-commands-audio.c
create mode 100644 build/qapi/qapi-commands-authz.c
create mode 100644 build/qapi/qapi-commands-block-core.c
create mode 100644 build/qapi/qapi-commands-block-export.c
create mode 100644 build/qapi/qapi-commands-block.c
create mode 100644 build/qapi/qapi-commands-char.c
create mode 100644 build/qapi/qapi-commands-common.c
create mode 100644 build/qapi/qapi-commands-compat.c
create mode 100644 build/qapi/qapi-commands-control.c
create mode 100644 build/qapi/qapi-commands-crypto.c
create mode 100644 build/qapi/qapi-commands-cryptodev.c
create mode 100644 build/qapi/qapi-commands-cxl.c
create mode 100644 build/qapi/qapi-commands-dump.c
create mode 100644 build/qapi/qapi-commands-ebpf.c
create mode 100644 build/qapi/qapi-commands-error.c
create mode 100644 build/qapi/qapi-commands-introspect.c
create mode 100644 build/qapi/qapi-commands-job.c
create mode 100644 build/qapi/qapi-commands-machine-common.c
create mode 100644 build/qapi/qapi-commands-machine-target.c
create mode 100644 build/qapi/qapi-commands-machine.c
create mode 100644 build/qapi/qapi-commands-migration.c
create mode 100644 build/qapi/qapi-commands-misc-target.c
create mode 100644 build/qapi/qapi-commands-misc.c
create mode 100644 build/qapi/qapi-commands-net.c
create mode 100644 build/qapi/qapi-commands-pci.c
create mode 100644 build/qapi/qapi-commands-pragma.c
create mode 100644 build/qapi/qapi-commands-qdev.c
create mode 100644 build/qapi/qapi-commands-qom.c
create mode 100644 build/qapi/qapi-commands-replay.c
create mode 100644 build/qapi/qapi-commands-rocker.c
create mode 100644 build/qapi/qapi-commands-run-state.c
create mode 100644 build/qapi/qapi-commands-sockets.c
create mode 100644 build/qapi/qapi-commands-stats.c
create mode 100644 build/qapi/qapi-commands-tpm.c
create mode 100644 build/qapi/qapi-commands-trace.c
create mode 100644 build/qapi/qapi-commands-transaction.c
create mode 100644 build/qapi/qapi-commands-uefi.c
create mode 100644 build/qapi/qapi-commands-ui.c
create mode 100644 build/qapi/qapi-commands-vfio.c
create mode 100644 build/qapi/qapi-commands-virtio.c
create mode 100644 build/qapi/qapi-commands-yank.c
create mode 100644 build/qapi/qapi-commands.c
create mode 100644 build/qapi/qapi-emit-events.c
create mode 100644 build/qapi/qapi-events-acpi.c
create mode 100644 build/qapi/qapi-events-audio.c
create mode 100644 build/qapi/qapi-events-authz.c
create mode 100644 build/qapi/qapi-events-block-core.c
create mode 100644 build/qapi/qapi-events-block-export.c
create mode 100644 build/qapi/qapi-events-block.c
create mode 100644 build/qapi/qapi-events-char.c
create mode 100644 build/qapi/qapi-events-common.c
create mode 100644 build/qapi/qapi-events-compat.c
create mode 100644 build/qapi/qapi-events-control.c
create mode 100644 build/qapi/qapi-events-crypto.c
create mode 100644 build/qapi/qapi-events-cryptodev.c
create mode 100644 build/qapi/qapi-events-cxl.c
create mode 100644 build/qapi/qapi-events-dump.c
create mode 100644 build/qapi/qapi-events-ebpf.c
create mode 100644 build/qapi/qapi-events-error.c
create mode 100644 build/qapi/qapi-events-introspect.c
create mode 100644 build/qapi/qapi-events-job.c
create mode 100644 build/qapi/qapi-events-machine-common.c
create mode 100644 build/qapi/qapi-events-machine-target.c
create mode 100644 build/qapi/qapi-events-machine.c
create mode 100644 build/qapi/qapi-events-migration.c
create mode 100644 build/qapi/qapi-events-misc-target.c
create mode 100644 build/qapi/qapi-events-misc.c
create mode 100644 build/qapi/qapi-events-net.c
create mode 100644 build/qapi/qapi-events-pci.c
create mode 100644 build/qapi/qapi-events-pragma.c
create mode 100644 build/qapi/qapi-events-qdev.c
create mode 100644 build/qapi/qapi-events-qom.c
create mode 100644 build/qapi/qapi-events-replay.c
create mode 100644 build/qapi/qapi-events-rocker.c
create mode 100644 build/qapi/qapi-events-run-state.c
create mode 100644 build/qapi/qapi-events-sockets.c
create mode 100644 build/qapi/qapi-events-stats.c
create mode 100644 build/qapi/qapi-events-tpm.c
create mode 100644 build/qapi/qapi-events-trace.c
create mode 100644 build/qapi/qapi-events-transaction.c
create mode 100644 build/qapi/qapi-events-uefi.c
create mode 100644 build/qapi/qapi-events-ui.c
create mode 100644 build/qapi/qapi-events-vfio.c
create mode 100644 build/qapi/qapi-events-virtio.c
create mode 100644 build/qapi/qapi-events-yank.c
create mode 100644 build/qapi/qapi-events.c
create mode 100644 build/qapi/qapi-features.c
create mode 100644 build/qapi/qapi-init-commands.c
create mode 100644 build/qapi/qapi-introspect.c
create mode 100644 build/qapi/qapi-types-acpi.c
create mode 100644 build/qapi/qapi-types-audio.c
create mode 100644 build/qapi/qapi-types-authz.c
create mode 100644 build/qapi/qapi-types-block-core.c
create mode 100644 build/qapi/qapi-types-block-export.c
create mode 100644 build/qapi/qapi-types-block.c
create mode 100644 build/qapi/qapi-types-char.c
create mode 100644 build/qapi/qapi-types-common.c
create mode 100644 build/qapi/qapi-types-compat.c
create mode 100644 build/qapi/qapi-types-control.c
create mode 100644 build/qapi/qapi-types-crypto.c
create mode 100644 build/qapi/qapi-types-cryptodev.c
create mode 100644 build/qapi/qapi-types-cxl.c
create mode 100644 build/qapi/qapi-types-dump.c
create mode 100644 build/qapi/qapi-types-ebpf.c
create mode 100644 build/qapi/qapi-types-error.c
create mode 100644 build/qapi/qapi-types-introspect.c
create mode 100644 build/qapi/qapi-types-job.c
create mode 100644 build/qapi/qapi-types-machine-common.c
create mode 100644 build/qapi/qapi-types-machine-target.c
create mode 100644 build/qapi/qapi-types-machine.c
create mode 100644 build/qapi/qapi-types-migration.c
create mode 100644 build/qapi/qapi-types-misc-target.c
create mode 100644 build/qapi/qapi-types-misc.c
create mode 100644 build/qapi/qapi-types-net.c
create mode 100644 build/qapi/qapi-types-pci.c
create mode 100644 build/qapi/qapi-types-pragma.c
create mode 100644 build/qapi/qapi-types-qdev.c
create mode 100644 build/qapi/qapi-types-qom.c
create mode 100644 build/qapi/qapi-types-replay.c
create mode 100644 build/qapi/qapi-types-rocker.c
create mode 100644 build/qapi/qapi-types-run-state.c
create mode 100644 build/qapi/qapi-types-sockets.c
create mode 100644 build/qapi/qapi-types-stats.c
create mode 100644 build/qapi/qapi-types-tpm.c
create mode 100644 build/qapi/qapi-types-trace.c
create mode 100644 build/qapi/qapi-types-transaction.c
create mode 100644 build/qapi/qapi-types-uefi.c
create mode 100644 build/qapi/qapi-types-ui.c
create mode 100644 build/qapi/qapi-types-vfio.c
create mode 100644 build/qapi/qapi-types-virtio.c
create mode 100644 build/qapi/qapi-types-yank.c
create mode 100644 build/qapi/qapi-types.c
create mode 100644 build/qapi/qapi-visit-acpi.c
create mode 100644 build/qapi/qapi-visit-audio.c
create mode 100644 build/qapi/qapi-visit-authz.c
create mode 100644 build/qapi/qapi-visit-block-core.c
create mode 100644 build/qapi/qapi-visit-block-export.c
create mode 100644 build/qapi/qapi-visit-block.c
create mode 100644 build/qapi/qapi-visit-char.c
create mode 100644 build/qapi/qapi-visit-common.c
create mode 100644 build/qapi/qapi-visit-compat.c
create mode 100644 build/qapi/qapi-visit-control.c
create mode 100644 build/qapi/qapi-visit-crypto.c
create mode 100644 build/qapi/qapi-visit-cryptodev.c
create mode 100644 build/qapi/qapi-visit-cxl.c
create mode 100644 build/qapi/qapi-visit-dump.c
create mode 100644 build/qapi/qapi-visit-ebpf.c
create mode 100644 build/qapi/qapi-visit-error.c
create mode 100644 build/qapi/qapi-visit-introspect.c
create mode 100644 build/qapi/qapi-visit-job.c
create mode 100644 build/qapi/qapi-visit-machine-common.c
create mode 100644 build/qapi/qapi-visit-machine-target.c
create mode 100644 build/qapi/qapi-visit-machine.c
create mode 100644 build/qapi/qapi-visit-migration.c
create mode 100644 build/qapi/qapi-visit-misc-target.c
create mode 100644 build/qapi/qapi-visit-misc.c
create mode 100644 build/qapi/qapi-visit-net.c
create mode 100644 build/qapi/qapi-visit-pci.c
create mode 100644 build/qapi/qapi-visit-pragma.c
create mode 100644 build/qapi/qapi-visit-qdev.c
create mode 100644 build/qapi/qapi-visit-qom.c
create mode 100644 build/qapi/qapi-visit-replay.c
create mode 100644 build/qapi/qapi-visit-rocker.c
create mode 100644 build/qapi/qapi-visit-run-state.c
create mode 100644 build/qapi/qapi-visit-sockets.c
create mode 100644 build/qapi/qapi-visit-stats.c
create mode 100644 build/qapi/qapi-visit-tpm.c
create mode 100644 build/qapi/qapi-visit-trace.c
create mode 100644 build/qapi/qapi-visit-transaction.c
create mode 100644 build/qapi/qapi-visit-uefi.c
create mode 100644 build/qapi/qapi-visit-ui.c
create mode 100644 build/qapi/qapi-visit-vfio.c
create mode 100644 build/qapi/qapi-visit-virtio.c
create mode 100644 build/qapi/qapi-visit-yank.c
create mode 100644 build/qapi/qapi-visit.c
create mode 100644 qapi/commands-weak-stubs.c
create mode 100644 build/qapi/qapi-commands-acpi.trace-events
create mode 100644 build/qapi/qapi-commands-audio.trace-events
create mode 100644 build/qapi/qapi-commands-authz.trace-events
create mode 100644 build/qapi/qapi-commands-block-core.trace-events
create mode 100644 build/qapi/qapi-commands-block-export.trace-events
create mode 100644 build/qapi/qapi-commands-block.trace-events
create mode 100644 build/qapi/qapi-commands-char.trace-events
create mode 100644 build/qapi/qapi-commands-common.trace-events
create mode 100644 build/qapi/qapi-commands-compat.trace-events
create mode 100644 build/qapi/qapi-commands-control.trace-events
create mode 100644 build/qapi/qapi-commands-crypto.trace-events
create mode 100644 build/qapi/qapi-commands-cryptodev.trace-events
create mode 100644 build/qapi/qapi-commands-cxl.trace-events
create mode 100644 build/qapi/qapi-commands-dump.trace-events
create mode 100644 build/qapi/qapi-commands-ebpf.trace-events
create mode 100644 build/qapi/qapi-commands-error.trace-events
create mode 100644 build/qapi/qapi-commands-introspect.trace-events
create mode 100644 build/qapi/qapi-commands-job.trace-events
create mode 100644 build/qapi/qapi-commands-machine-common.trace-events
create mode 100644 build/qapi/qapi-commands-machine-target.trace-events
create mode 100644 build/qapi/qapi-commands-machine.trace-events
create mode 100644 build/qapi/qapi-commands-migration.trace-events
create mode 100644 build/qapi/qapi-commands-misc-target.trace-events
create mode 100644 build/qapi/qapi-commands-misc.trace-events
create mode 100644 build/qapi/qapi-commands-net.trace-events
create mode 100644 build/qapi/qapi-commands-pci.trace-events
create mode 100644 build/qapi/qapi-commands-pragma.trace-events
create mode 100644 build/qapi/qapi-commands-qdev.trace-events
create mode 100644 build/qapi/qapi-commands-qom.trace-events
create mode 100644 build/qapi/qapi-commands-replay.trace-events
create mode 100644 build/qapi/qapi-commands-rocker.trace-events
create mode 100644 build/qapi/qapi-commands-run-state.trace-events
create mode 100644 build/qapi/qapi-commands-sockets.trace-events
create mode 100644 build/qapi/qapi-commands-stats.trace-events
create mode 100644 build/qapi/qapi-commands-tpm.trace-events
create mode 100644 build/qapi/qapi-commands-trace.trace-events
create mode 100644 build/qapi/qapi-commands-transaction.trace-events
create mode 100644 build/qapi/qapi-commands-uefi.trace-events
create mode 100644 build/qapi/qapi-commands-ui.trace-events
create mode 100644 build/qapi/qapi-commands-vfio.trace-events
create mode 100644 build/qapi/qapi-commands-virtio.trace-events
create mode 100644 build/qapi/qapi-commands-yank.trace-events
create mode 100644 build/qapi/qapi-commands.trace-events
create mode 100644 build/qapi/qapi-init-commands.trace-events
--
2.47.2
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-08 6:53 ` Philippe Mathieu-Daudé
2025-05-15 4:39 ` Markus Armbruster
2025-05-07 23:14 ` [PATCH 02/13] qapi/introspect: generate schema as a QObject directly Pierrick Bouvier
` (11 subsequent siblings)
12 siblings, 2 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
This new entry can be used in QAPI json to specify a runtime conditional
to expose any entry, similar to existing 'if', that applies at compile
time, thanks to ifdef. The element is always defined in C, but not
exposed through the schema and visit functions, thus being hidden for a
QMP consumer.
QAPISchemaIfCond is extended to parse this information. A first version
was tried duplicating this, but this proved to be much more boilerplate
than needed to pass information through all function calls.
'if' and 'runtime_if' can be combined elegantly on a single item,
allowing to restrict an element to be present based on compile time
defines, and runtime checks at the same time.
Note: This commit only adds parsing of runtime_if, and does not hide
anything yet.
For review:
- I don't really like "runtime_if" name.
What would make sense, IMHO, is to rename existing 'if' to 'ifdef',
and reuse 'if' for 'runtime_if'. Since it requires invasive changes, I
would prefer to get agreement before wasting time in case you prefer
any other naming convention. Let me know what you'd like.
- As mentioned in second paragraph, I think our best implementation
would be to extend existing QAPISchemaIfCond, as it's really
complicated to extend all call sites if we have another new object.
- No tests/doc added at this time, as I prefer to wait that we decide
about naming and proposed approach first.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
scripts/qapi/common.py | 16 +++++++++++-
scripts/qapi/expr.py | 9 ++++---
scripts/qapi/gen.py | 56 +++++++++++++++++++++++++++++++++++++++++-
scripts/qapi/schema.py | 44 ++++++++++++++++++++++++---------
4 files changed, 107 insertions(+), 18 deletions(-)
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index d7c8aa3365c..0e8e2abeb58 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -229,6 +229,8 @@ def gen_infix(operator: str, operands: Sequence[Any]) -> str:
def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
return gen_ifcond(ifcond, 'defined(%s)', '!%s', ' && ', ' || ')
+def cgen_runtime_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
+ return gen_ifcond(ifcond, '%s', '!%s', ' && ', ' || ')
def docgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
# TODO Doc generated for conditions needs polish
@@ -242,7 +244,6 @@ def gen_if(cond: str) -> str:
#if %(cond)s
''', cond=cond)
-
def gen_endif(cond: str) -> str:
if not cond:
return ''
@@ -250,6 +251,19 @@ def gen_endif(cond: str) -> str:
#endif /* %(cond)s */
''', cond=cond)
+def gen_runtime_if(cond: str) -> str:
+ if not cond:
+ return ''
+ return mcgen('''
+if (%(cond)s) {
+''', cond=cond)
+
+def gen_runtime_endif(cond: str) -> str:
+ if not cond:
+ return ''
+ return mcgen('''
+} /* (%(cond)s) */
+''', cond=cond)
def must_match(pattern: str, string: str) -> Match[str]:
match = re.match(pattern, string)
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index cae0a083591..5ae26395964 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -392,7 +392,8 @@ def check_type_implicit(value: Optional[object],
permit_underscore=permissive)
if c_name(key, False) == 'u' or c_name(key, False).startswith('has_'):
raise QAPISemError(info, "%s uses reserved name" % key_source)
- check_keys(arg, info, key_source, ['type'], ['if', 'features'])
+ check_keys(arg, info, key_source, ['type'], ['if', 'features',
+ 'runtime_if'])
check_if(arg, info, key_source)
check_features(arg.get('features'), info)
check_type_name_or_array(arg['type'], info, key_source)
@@ -642,7 +643,7 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
elif meta == 'union':
check_keys(expr, info, meta,
['union', 'base', 'discriminator', 'data'],
- ['if', 'features'])
+ ['if', 'runtime_if', 'features'])
normalize_members(expr.get('base'))
normalize_members(expr['data'])
check_union(expr)
@@ -659,8 +660,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
elif meta == 'command':
check_keys(expr, info, meta,
['command'],
- ['data', 'returns', 'boxed', 'if', 'features',
- 'gen', 'success-response', 'allow-oob',
+ ['data', 'returns', 'boxed', 'if', 'runtime_if',
+ 'features', 'gen', 'success-response', 'allow-oob',
'allow-preconfig', 'coroutine'])
normalize_members(expr.get('data'))
check_command(expr)
diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
index d3c56d45c89..5082eb331f4 100644
--- a/scripts/qapi/gen.py
+++ b/scripts/qapi/gen.py
@@ -109,6 +109,37 @@ def _wrap_ifcond(ifcond: QAPISchemaIfCond, before: str, after: str) -> str:
return out
+def _wrap_runtime_ifcond(ifcond: QAPISchemaIfCond, before: str, after: str) -> str:
+ if before == after:
+ return after # suppress empty #if ... #endif
+
+ assert after.startswith(before)
+ out = before
+ added = after[len(before):]
+ if added[0] == '\n':
+ out += '\n'
+ added = added[1:]
+ out += ifcond.gen_runtime_if()
+ out += added
+ out += ifcond.gen_runtime_endif()
+ return out
+
+
+def _wrap_runtime_ifcond(ifcond: QAPISchemaIfCond, before: str, after: str) -> str:
+ if before == after:
+ return after # suppress empty #if ... #endif
+
+ assert after.startswith(before)
+ out = before
+ added = after[len(before):]
+ if added[0] == '\n':
+ out += '\n'
+ added = added[1:]
+ out += ifcond.gen_runtime_if()
+ out += added
+ out += ifcond.gen_runtime_endif()
+ return out
+
def build_params(arg_type: Optional[QAPISchemaObjectType],
boxed: bool,
extra: Optional[str] = None) -> str:
@@ -137,12 +168,17 @@ class QAPIGenCCode(QAPIGen):
def __init__(self, fname: str):
super().__init__(fname)
self._start_if: Optional[Tuple[QAPISchemaIfCond, str, str]] = None
+ self._start_runtime_if: Optional[Tuple[QAPISchemaIfCond, str, str]] = None
def start_if(self, ifcond: QAPISchemaIfCond) -> None:
assert self._start_if is None
self._start_if = (ifcond, self._body, self._preamble)
- def end_if(self) -> None:
+ def start_runtime_if(self, ifcond: QAPISchemaIfCond) -> None:
+ assert self._start_runtime_if is None
+ self._start_runtime_if = (ifcond, self._body, self._preamble)
+
+ def end_if(self, runtime: bool = False) -> None:
assert self._start_if is not None
self._body = _wrap_ifcond(self._start_if[0],
self._start_if[1], self._body)
@@ -150,8 +186,18 @@ def end_if(self) -> None:
self._start_if[2], self._preamble)
self._start_if = None
+ def end_runtime_if(self, runtime: bool = False) -> None:
+ assert self._start_runtime_if is not None
+ self._body = _wrap_runtime_ifcond(self._start_runtime_if[0],
+ self._start_runtime_if[1], self._body)
+ self._preamble = _wrap_runtime_ifcond(self._start_runtime_if[0],
+ self._start_runtime_if[2],
+ self._preamble)
+ self._start_runtime_if = None
+
def get_content(self) -> str:
assert self._start_if is None
+ assert self._start_runtime_if is None
return super().get_content()
@@ -231,6 +277,14 @@ def ifcontext(ifcond: QAPISchemaIfCond, *args: QAPIGenCCode) -> Iterator[None]:
for arg in args:
arg.end_if()
+@contextmanager
+def runtime_ifcontext(ifcond: QAPISchemaIfCond,
+ *args: QAPIGenCCode) -> Iterator[None]:
+ for arg in args:
+ arg.start_runtime_if(ifcond)
+ yield
+ for arg in args:
+ arg.end_runtime_if()
class QAPISchemaMonolithicCVisitor(QAPISchemaVisitor):
def __init__(self,
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index cbe3b5aa91e..533d0dfe088 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -36,9 +36,12 @@
POINTER_SUFFIX,
c_name,
cgen_ifcond,
+ cgen_runtime_ifcond,
docgen_ifcond,
- gen_endif,
gen_if,
+ gen_endif,
+ gen_runtime_if,
+ gen_runtime_endif,
)
from .error import QAPIError, QAPISemError, QAPISourceError
from .expr import check_exprs
@@ -50,8 +53,10 @@ class QAPISchemaIfCond:
def __init__(
self,
ifcond: Optional[Union[str, Dict[str, object]]] = None,
+ runtime_ifcond: Optional[Union[str, Dict[str, object]]] = None,
) -> None:
self.ifcond = ifcond
+ self.runtime_ifcond = runtime_ifcond
def _cgen(self) -> str:
return cgen_ifcond(self.ifcond)
@@ -65,8 +70,17 @@ def gen_endif(self) -> str:
def docgen(self) -> str:
return docgen_ifcond(self.ifcond)
+ def _cgen_runtime(self) -> str:
+ return cgen_runtime_ifcond(self.runtime_ifcond)
+
+ def gen_runtime_if(self) -> str:
+ return gen_runtime_if(self._cgen_runtime())
+
+ def gen_runtime_endif(self) -> str:
+ return gen_runtime_endif(self._cgen_runtime())
+
def is_present(self) -> bool:
- return bool(self.ifcond)
+ return bool(self.ifcond) or bool(self.runtime_ifcond)
class QAPISchemaEntity:
@@ -1281,13 +1295,15 @@ def _make_features(
self._feature_dict[feat.name] = feat
return [QAPISchemaFeature(f['name'], info,
- QAPISchemaIfCond(f.get('if')))
+ QAPISchemaIfCond(f.get('if'),
+ f.get('runtime_if')))
for f in features]
def _make_enum_member(
self,
name: str,
ifcond: Optional[Union[str, Dict[str, Any]]],
+ runtime_ifcond: Optional[Union[str, Dict[str, Any]]],
features: Optional[List[Dict[str, Any]]],
info: Optional[QAPISourceInfo],
) -> QAPISchemaEnumMember:
@@ -1299,6 +1315,7 @@ def _make_enum_members(
self, values: List[Dict[str, Any]], info: Optional[QAPISourceInfo]
) -> List[QAPISchemaEnumMember]:
return [self._make_enum_member(v['name'], v.get('if'),
+ v.get('runtime_if'),
v.get('features'), info)
for v in values]
@@ -1338,7 +1355,7 @@ def _def_enum_type(self, expr: QAPIExpression) -> None:
name = expr['enum']
data = expr['data']
prefix = expr.get('prefix')
- ifcond = QAPISchemaIfCond(expr.get('if'))
+ ifcond = QAPISchemaIfCond(expr.get('if'), expr.get('runtime_if'))
info = expr.info
features = self._make_features(expr.get('features'), info)
self._def_definition(QAPISchemaEnumType(
@@ -1369,7 +1386,8 @@ def _make_members(
info: QAPISourceInfo,
) -> List[QAPISchemaObjectTypeMember]:
return [self._make_member(key, value['type'],
- QAPISchemaIfCond(value.get('if')),
+ QAPISchemaIfCond(value.get('if'),
+ value.get('runtime_if')),
value.get('features'), info)
for (key, value) in data.items()]
@@ -1378,7 +1396,7 @@ def _def_struct_type(self, expr: QAPIExpression) -> None:
base = expr.get('base')
data = expr['data']
info = expr.info
- ifcond = QAPISchemaIfCond(expr.get('if'))
+ ifcond = QAPISchemaIfCond(expr.get('if'), expr.get('runtime_if'))
features = self._make_features(expr.get('features'), info)
self._def_definition(QAPISchemaObjectType(
name, info, expr.doc, ifcond, features, base,
@@ -1404,7 +1422,7 @@ def _def_union_type(self, expr: QAPIExpression) -> None:
data = expr['data']
assert isinstance(data, dict)
info = expr.info
- ifcond = QAPISchemaIfCond(expr.get('if'))
+ ifcond = QAPISchemaIfCond(expr.get('if'), expr.get('runtime_if'))
features = self._make_features(expr.get('features'), info)
if isinstance(base, dict):
base = self._make_implicit_object_type(
@@ -1412,7 +1430,8 @@ def _def_union_type(self, expr: QAPIExpression) -> None:
'base', self._make_members(base, info))
variants = [
self._make_variant(key, value['type'],
- QAPISchemaIfCond(value.get('if')),
+ QAPISchemaIfCond(value.get('if'),
+ value.get('runtime_if')),
info)
for (key, value) in data.items()]
members: List[QAPISchemaObjectTypeMember] = []
@@ -1426,12 +1445,13 @@ def _def_alternate_type(self, expr: QAPIExpression) -> None:
name = expr['alternate']
data = expr['data']
assert isinstance(data, dict)
- ifcond = QAPISchemaIfCond(expr.get('if'))
+ ifcond = QAPISchemaIfCond(expr.get('if'), expr.get('runtime_if'))
info = expr.info
features = self._make_features(expr.get('features'), info)
variants = [
self._make_variant(key, value['type'],
- QAPISchemaIfCond(value.get('if')),
+ QAPISchemaIfCond(value.get('if'),
+ value.get('runtime_if')),
info)
for (key, value) in data.items()]
tag_member = QAPISchemaObjectTypeMember('type', info, 'QType', False)
@@ -1450,7 +1470,7 @@ def _def_command(self, expr: QAPIExpression) -> None:
allow_oob = expr.get('allow-oob', False)
allow_preconfig = expr.get('allow-preconfig', False)
coroutine = expr.get('coroutine', False)
- ifcond = QAPISchemaIfCond(expr.get('if'))
+ ifcond = QAPISchemaIfCond(expr.get('if'), expr.get('runtime_if'))
info = expr.info
features = self._make_features(expr.get('features'), info)
if isinstance(data, dict):
@@ -1469,7 +1489,7 @@ def _def_event(self, expr: QAPIExpression) -> None:
name = expr['event']
data = expr.get('data')
boxed = expr.get('boxed', False)
- ifcond = QAPISchemaIfCond(expr.get('if'))
+ ifcond = QAPISchemaIfCond(expr.get('if'), expr.get('runtime_if'))
info = expr.info
features = self._make_features(expr.get('features'), info)
if isinstance(data, dict):
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 02/13] qapi/introspect: generate schema as a QObject directly
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 03/13] qobject/qlit: allow to hide dict or list entries Pierrick Bouvier
` (10 subsequent siblings)
12 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
Instead of defining a const QLitObject, we implement a function to
directly return the QObject associated.
The benefit is that we can now have a non static definition for the
QLitObject, and so we can assign it using non static initializer.
This will be used in next commits to initialize a .hidden field per
element, at runtime.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
monitor/qmp-cmds-control.c | 2 +-
tests/unit/test-qobject-input-visitor.c | 6 +++---
scripts/qapi/introspect.py | 9 ++++++---
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/monitor/qmp-cmds-control.c b/monitor/qmp-cmds-control.c
index 150ca9f5cb6..1d52d4ca8e9 100644
--- a/monitor/qmp-cmds-control.c
+++ b/monitor/qmp-cmds-control.c
@@ -203,7 +203,7 @@ static SchemaInfoList *zap_deprecated(SchemaInfoList *schema)
SchemaInfoList *qmp_query_qmp_schema(Error **errp)
{
- QObject *obj = qobject_from_qlit(&qmp_schema_qlit);
+ QObject *obj = qmp_schema_qobject();
Visitor *v = qobject_input_visitor_new(obj);
SchemaInfoList *schema = NULL;
diff --git a/tests/unit/test-qobject-input-visitor.c b/tests/unit/test-qobject-input-visitor.c
index 84bdcdf702e..5d961325f95 100644
--- a/tests/unit/test-qobject-input-visitor.c
+++ b/tests/unit/test-qobject-input-visitor.c
@@ -1184,10 +1184,10 @@ static void test_visitor_in_fail_alternate(TestInputVisitorData *data,
}
static void do_test_visitor_in_qmp_introspect(TestInputVisitorData *data,
- const QLitObject *qlit)
+ QObject *qlit)
{
g_autoptr(SchemaInfoList) schema = NULL;
- QObject *obj = qobject_from_qlit(qlit);
+ QObject *obj = qlit;
Visitor *v;
v = qobject_input_visitor_new(obj);
@@ -1202,7 +1202,7 @@ static void do_test_visitor_in_qmp_introspect(TestInputVisitorData *data,
static void test_visitor_in_qmp_introspect(TestInputVisitorData *data,
const void *unused)
{
- do_test_visitor_in_qmp_introspect(data, &test_qmp_schema_qlit);
+ do_test_visitor_in_qmp_introspect(data, test_qmp_schema_qobject());
}
int main(int argc, char **argv)
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index 89ee5d5f176..e0269bef0ce 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -193,15 +193,18 @@ def visit_end(self) -> None:
for typ in self._used_types:
typ.visit(self)
# generate C
- name = c_name(self._prefix, protect=False) + 'qmp_schema_qlit'
+ name = c_name(self._prefix, protect=False) + 'qmp_schema_qobject'
self._genh.add(mcgen('''
#include "qobject/qlit.h"
-extern const QLitObject %(c_name)s;
+QObject *%(c_name)s(void);
''',
c_name=c_name(name)))
self._genc.add(mcgen('''
-const QLitObject %(c_name)s = %(c_string)s;
+QObject *%(c_name)s(void) {
+ const QLitObject res = %(c_string)s;
+ return qobject_from_qlit(&res);
+}
''',
c_name=c_name(name),
c_string=_tree_to_qlit(self._trees)))
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 03/13] qobject/qlit: allow to hide dict or list entries
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 02/13] qapi/introspect: generate schema as a QObject directly Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-08 14:21 ` Daniel P. Berrangé
2025-05-07 23:14 ` [PATCH 04/13] qapi/introspect: hide fields in schema Pierrick Bouvier
` (9 subsequent siblings)
12 siblings, 1 reply; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
We add a new .hidden field to qlit entries, which gets ignored when
creating the associated QObject.
By default .hidden is 0, so it means the entry is visible. This way,
only potentially hidden elements need to be assigned.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
include/qobject/qlit.h | 12 ++++++++++++
qobject/qlit.c | 10 ++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/include/qobject/qlit.h b/include/qobject/qlit.h
index c0676d5daf2..3b66c22013c 100644
--- a/include/qobject/qlit.h
+++ b/include/qobject/qlit.h
@@ -28,25 +28,37 @@ struct QLitObject {
QLitDictEntry *qdict;
QLitObject *qlist;
} value;
+ bool hidden;
};
struct QLitDictEntry {
const char *key;
QLitObject value;
+ bool hidden;
};
#define QLIT_QNULL \
{ .type = QTYPE_QNULL }
#define QLIT_QBOOL(val) \
{ .type = QTYPE_QBOOL, .value.qbool = (val) }
+#define QLIT_QBOOL_HIDDEN(val, cond) \
+ { .type = QTYPE_QBOOL, .value.qbool = (val), .hidden = (cond) }
#define QLIT_QNUM(val) \
{ .type = QTYPE_QNUM, .value.qnum = (val) }
+#define QLIT_QNUM_HIDDEN(val, cond) \
+ { .type = QTYPE_QNUM, .value.qnum = (val), .hidden = (cond) }
#define QLIT_QSTR(val) \
{ .type = QTYPE_QSTRING, .value.qstr = (val) }
+#define QLIT_QSTR_HIDDEN(val, cond) \
+ { .type = QTYPE_QSTRING, .value.qstr = (val), .hidden = (cond) }
#define QLIT_QDICT(val) \
{ .type = QTYPE_QDICT, .value.qdict = (val) }
+#define QLIT_QDICT_HIDDEN(val, cond) \
+ { .type = QTYPE_QDICT, .value.qdict = (val), .hidden = (cond) }
#define QLIT_QLIST(val) \
{ .type = QTYPE_QLIST, .value.qlist = (val) }
+#define QLIT_QLIST_HIDDEN(val, cond) \
+ { .type = QTYPE_QLIST, .value.qlist = (val), .hidden = (cond) }
bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs);
diff --git a/qobject/qlit.c b/qobject/qlit.c
index a44f47eaa57..7b372c5ebaa 100644
--- a/qobject/qlit.c
+++ b/qobject/qlit.c
@@ -90,6 +90,8 @@ bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs)
QObject *qobject_from_qlit(const QLitObject *qlit)
{
+ g_assert(!qlit->hidden);
+
switch (qlit->type) {
case QTYPE_QNULL:
return QOBJECT(qnull());
@@ -102,7 +104,9 @@ QObject *qobject_from_qlit(const QLitObject *qlit)
QLitDictEntry *e;
for (e = qlit->value.qdict; e->key; e++) {
- qdict_put_obj(qdict, e->key, qobject_from_qlit(&e->value));
+ if (!e->hidden) {
+ qdict_put_obj(qdict, e->key, qobject_from_qlit(&e->value));
+ }
}
return QOBJECT(qdict);
}
@@ -111,7 +115,9 @@ QObject *qobject_from_qlit(const QLitObject *qlit)
QLitObject *e;
for (e = qlit->value.qlist; e->type != QTYPE_NONE; e++) {
- qlist_append_obj(qlist, qobject_from_qlit(e));
+ if (!e->hidden) {
+ qlist_append_obj(qlist, qobject_from_qlit(e));
+ }
}
return QOBJECT(qlist);
}
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 04/13] qapi/introspect: hide fields in schema
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (2 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 03/13] qobject/qlit: allow to hide dict or list entries Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 05/13] qapi/commands: register commands conditionally Pierrick Bouvier
` (8 subsequent siblings)
12 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
We know have a way to parse runtime conditionals in QAPI json, and hide
qlit elements at runtime.
So we can combine both to hide elements in our schema based on a
conditional specified in json.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
scripts/qapi/introspect.py | 28 +++++++++++++++++++---------
scripts/qapi/schema.py | 3 +++
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index e0269bef0ce..c70b97a455d 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -94,7 +94,8 @@ class Annotated(Generic[_ValueT]):
def _tree_to_qlit(obj: JSONValue,
level: int = 0,
- dict_value: bool = False) -> str:
+ dict_value: bool = False,
+ hidden_cond: str = '') -> str:
"""
Convert the type tree into a QLIT C string, recursively.
@@ -120,7 +121,11 @@ def indent(level: int) -> str:
ret += indent(level) + f"/* {obj.comment} */\n"
if obj.ifcond.is_present():
ret += obj.ifcond.gen_if()
- ret += _tree_to_qlit(obj.value, level)
+ hidden_cond = obj.ifcond.get_runtime_cond()
+ # reverse runtime_if
+ if hidden_cond:
+ hidden_cond = '!(' + hidden_cond + ')'
+ ret += _tree_to_qlit(obj.value, level, hidden_cond=hidden_cond)
if obj.ifcond.is_present():
ret += '\n' + obj.ifcond.gen_endif()
return ret
@@ -129,30 +134,35 @@ def indent(level: int) -> str:
if not dict_value:
ret += indent(level)
+ macro_suffix = ''
+ if hidden_cond:
+ macro_suffix = '_HIDDEN'
+ hidden_cond = ', (' + hidden_cond + ')'
+
# Scalars:
if obj is None:
ret += 'QLIT_QNULL'
elif isinstance(obj, str):
- ret += f"QLIT_QSTR({to_c_string(obj)})"
+ ret += f"QLIT_QSTR{macro_suffix}({to_c_string(obj)}{hidden_cond})"
elif isinstance(obj, bool):
- ret += f"QLIT_QBOOL({str(obj).lower()})"
+ ret += f"QLIT_QBOOL{macro_suffix}({str(obj).lower()}{hidden_cond})"
# Non-scalars:
elif isinstance(obj, list):
- ret += 'QLIT_QLIST(((QLitObject[]) {\n'
+ ret += 'QLIT_QLIST' + macro_suffix + '(((QLitObject[]) {\n'
for value in obj:
ret += _tree_to_qlit(value, level + 1).strip('\n') + '\n'
ret += indent(level + 1) + '{}\n'
- ret += indent(level) + '}))'
+ ret += indent(level) + '})' + hidden_cond + ')'
elif isinstance(obj, dict):
- ret += 'QLIT_QDICT(((QLitDictEntry[]) {\n'
+ ret += 'QLIT_QDICT' + macro_suffix + '(((QLitDictEntry[]) {\n'
for key, value in sorted(obj.items()):
ret += indent(level + 1) + "{{ {:s}, {:s} }},\n".format(
to_c_string(key),
- _tree_to_qlit(value, level + 1, dict_value=True)
+ _tree_to_qlit(value, level + 1, dict_value=True),
)
ret += indent(level + 1) + '{}\n'
- ret += indent(level) + '}))'
+ ret += indent(level) + '})' + hidden_cond + ')'
else:
raise NotImplementedError(
f"type '{type(obj).__name__}' not implemented"
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 533d0dfe088..7767893f979 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -79,6 +79,9 @@ def gen_runtime_if(self) -> str:
def gen_runtime_endif(self) -> str:
return gen_runtime_endif(self._cgen_runtime())
+ def get_runtime_cond(self) -> str:
+ return self._cgen_runtime()
+
def is_present(self) -> bool:
return bool(self.ifcond) or bool(self.runtime_ifcond)
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 05/13] qapi/commands: register commands conditionally
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (3 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 04/13] qapi/introspect: hide fields in schema Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 06/13] qapi/visit: hide fields in JSON marshalling Pierrick Bouvier
` (7 subsequent siblings)
12 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
scripts/qapi/commands.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 79142273828..7b172f7c081 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -27,6 +27,7 @@
build_params,
gen_features,
ifcontext,
+ runtime_ifcontext,
)
from .schema import (
QAPISchema,
@@ -406,9 +407,10 @@ def visit_command(self,
self._gen_trace_events.add(gen_trace(name))
with self._temp_module('./init'):
with ifcontext(ifcond, self._genh, self._genc):
- self._genc.add(gen_register_command(
- name, features, success_response, allow_oob,
- allow_preconfig, coroutine))
+ with runtime_ifcontext(ifcond, self._genh, self._genc):
+ self._genc.add(gen_register_command(
+ name, features, success_response, allow_oob,
+ allow_preconfig, coroutine))
def gen_commands(schema: QAPISchema,
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 06/13] qapi/visit: hide fields in JSON marshalling
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (4 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 05/13] qapi/commands: register commands conditionally Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 07/13] qapi: add access to qemu/target-info.h Pierrick Bouvier
` (6 subsequent siblings)
12 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
We modify gen_visit_object_members to hide elements based on the
specified conditional.
This allows to hide those elements in input/output json, even though
they still exist in C code.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
scripts/qapi/visit.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index 36e240967b6..82caf8c5f0b 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -90,6 +90,7 @@ def gen_visit_object_members(name: str,
for memb in members:
ret += memb.ifcond.gen_if()
+ ret += memb.ifcond.gen_runtime_if()
if memb.optional:
has = 'has_' + c_name(memb.name)
if memb.need_has():
@@ -126,6 +127,7 @@ def gen_visit_object_members(name: str,
ret += mcgen('''
}
''')
+ ret += memb.ifcond.gen_runtime_endif()
ret += memb.ifcond.gen_endif()
if branches:
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 07/13] qapi: add access to qemu/target-info.h
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (5 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 06/13] qapi/visit: hide fields in JSON marshalling Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-08 6:57 ` Philippe Mathieu-Daudé
2025-05-07 23:14 ` [PATCH 08/13] qemu/target-info: implement missing helpers Pierrick Bouvier
` (5 subsequent siblings)
12 siblings, 1 reply; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
Add a default include qemu/target-info.h in QAPI generated code. This
allows runtime conditionals to use any function defined in this header.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
scripts/qapi/commands.py | 2 ++
scripts/qapi/introspect.py | 1 +
scripts/qapi/visit.py | 2 ++
3 files changed, 5 insertions(+)
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 7b172f7c081..7776c84fe64 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -319,6 +319,7 @@ def _begin_user_module(self, name: str) -> None:
visit = self._module_basename('qapi-visit', name)
self._genc.add(mcgen('''
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
@@ -354,6 +355,7 @@ def visit_begin(self, schema: QAPISchema) -> None:
c_prefix=c_name(self._prefix, protect=False)))
self._genc.add(mcgen('''
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "%(prefix)sqapi-commands.h"
#include "%(prefix)sqapi-init-commands.h"
#include "%(prefix)sqapi-features.h"
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index c70b97a455d..a16d6bad012 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -190,6 +190,7 @@ def __init__(self, prefix: str, unmask: bool):
self._name_map: Dict[str, str] = {}
self._genc.add(mcgen('''
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "%(prefix)sqapi-introspect.h"
''',
diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index 82caf8c5f0b..6836eb8ed60 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -342,6 +342,7 @@ def __init__(self, prefix: str):
def _begin_builtin_module(self) -> None:
self._genc.preamble_add(mcgen('''
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi/qapi-builtin-visit.h"
'''))
@@ -356,6 +357,7 @@ def _begin_user_module(self, name: str) -> None:
visit = self._module_basename('qapi-visit', name)
self._genc.preamble_add(mcgen('''
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "%(visit)s.h"
#include "%(prefix)sqapi-features.h"
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 08/13] qemu/target-info: implement missing helpers
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (6 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 07/13] qapi: add access to qemu/target-info.h Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-08 6:40 ` Philippe Mathieu-Daudé
2025-05-07 23:14 ` [PATCH 09/13] qapi: transform target specific 'if' in runtime checks Pierrick Bouvier
` (4 subsequent siblings)
12 siblings, 1 reply; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
Add runtime helpers for target and config queries.
Note: This will be reimplemented later [1] using proper information in
TargetInfo. Meanwhile, just add a simple implementation.
[1] https://patchew.org/QEMU/20250424222112.36194-1-philmd@linaro.org/20250424222112.36194-19-philmd@linaro.org/
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 2 +-
include/qemu/target-info.h | 14 +++++
target-info.c | 117 +++++++++++++++++++++++++++++++++++++
3 files changed, 132 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 6b235b291dc..7094832c3e2 100644
--- a/meson.build
+++ b/meson.build
@@ -3822,7 +3822,7 @@ endif
common_ss.add(pagevary)
specific_ss.add(files('page-target.c', 'page-vary-target.c'))
-common_ss.add(files('target-info.c'))
+specific_ss.add(files('target-info.c'))
specific_ss.add(files('target-info-stub.c'))
subdir('backends')
diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
index 850a2958b9c..d9c0df10c53 100644
--- a/include/qemu/target-info.h
+++ b/include/qemu/target-info.h
@@ -38,4 +38,18 @@ const char *target_machine_typename(void);
*/
const char *target_cpu_type(void);
+bool target_i386(void);
+bool target_x86_64(void);
+bool target_arm(void);
+bool target_aarch64(void);
+bool target_s390x(void);
+bool target_mips(void);
+bool target_mips64(void);
+bool target_loongarch64(void);
+bool target_riscv32(void);
+bool target_riscv64(void);
+bool target_ppc(void);
+bool target_ppc64(void);
+bool target_has_kvm(void);
+
#endif
diff --git a/target-info.c b/target-info.c
index 16fdca7aaaf..f2bdae18f4f 100644
--- a/target-info.c
+++ b/target-info.c
@@ -29,3 +29,120 @@ const char *target_machine_typename(void)
{
return target_info()->machine_typename;
}
+
+bool target_i386(void)
+{
+#ifdef TARGET_I386
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_x86_64(void)
+{
+#ifdef TARGET_X86_64
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_arm(void)
+{
+#ifdef TARGET_ARM
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_aarch64(void)
+{
+#ifdef TARGET_AARCH64
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_s390x(void)
+{
+#ifdef TARGET_S390X
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_mips(void)
+{
+#ifdef TARGET_MIPS
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_mips64(void)
+{
+#ifdef TARGET_MIPS64
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_loongarch64(void)
+{
+#ifdef TARGET_LOONGARCH64
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_riscv32(void)
+{
+#ifdef TARGET_RISCV32
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_riscv64(void)
+{
+#ifdef TARGET_RISCV64
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_ppc(void)
+{
+#ifdef TARGET_PPC
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_ppc64(void)
+{
+#ifdef TARGET_ppc64
+ return true;
+#else
+ return false;
+#endif
+}
+
+bool target_has_kvm(void)
+{
+#ifdef CONFIG_KVM
+ return true;
+#else
+ return false;
+#endif
+}
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (7 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 08/13] qemu/target-info: implement missing helpers Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-08 6:44 ` Philippe Mathieu-Daudé
` (2 more replies)
2025-05-07 23:14 ` [PATCH 10/13] qapi: add weak stubs for target specific commands Pierrick Bouvier
` (3 subsequent siblings)
12 siblings, 3 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/machine-target.json | 84 ++++++++++++++++++++++++----------------
qapi/misc-target.json | 48 ++++++++++++-----------
scripts/qapi/expr.py | 9 +++--
3 files changed, 81 insertions(+), 60 deletions(-)
diff --git a/qapi/machine-target.json b/qapi/machine-target.json
index 541f93eeb78..6174b7291ca 100644
--- a/qapi/machine-target.json
+++ b/qapi/machine-target.json
@@ -96,7 +96,7 @@
##
{ 'struct': 'CpuModelBaselineInfo',
'data': { 'model': 'CpuModelInfo' },
- 'if': 'TARGET_S390X' }
+ 'runtime_if': 'target_s390x()' }
##
# @CpuModelCompareInfo:
@@ -120,7 +120,7 @@
{ 'struct': 'CpuModelCompareInfo',
'data': { 'result': 'CpuModelCompareResult',
'responsible-properties': ['str'] },
- 'if': 'TARGET_S390X' }
+ 'runtime_if': 'target_s390x()' }
##
# @query-cpu-model-comparison:
@@ -179,7 +179,7 @@
{ 'command': 'query-cpu-model-comparison',
'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
'returns': 'CpuModelCompareInfo',
- 'if': 'TARGET_S390X' }
+ 'runtime_if': 'target_s390x()' }
##
# @query-cpu-model-baseline:
@@ -235,7 +235,7 @@
'data': { 'modela': 'CpuModelInfo',
'modelb': 'CpuModelInfo' },
'returns': 'CpuModelBaselineInfo',
- 'if': 'TARGET_S390X' }
+ 'runtime_if': 'target_s390x()' }
##
# @CpuModelExpansionInfo:
@@ -256,12 +256,15 @@
{ 'struct': 'CpuModelExpansionInfo',
'data': { 'model': 'CpuModelInfo',
'deprecated-props' : { 'type': ['str'],
- 'if': 'TARGET_S390X' } },
- 'if': { 'any': [ 'TARGET_S390X',
- 'TARGET_I386',
- 'TARGET_ARM',
- 'TARGET_LOONGARCH64',
- 'TARGET_RISCV' ] } }
+ 'runtime_if': 'target_s390x()'} },
+ 'runtime_if': { 'any': [ 'target_s390x()',
+ 'target_i386()',
+ 'target_x86_64()',
+ 'target_arm()',
+ 'target_aarch64()',
+ 'target_loongarch64()',
+ 'target_riscv32()',
+ 'target_riscv64()' ] } }
##
# @query-cpu-model-expansion:
@@ -311,11 +314,14 @@
'data': { 'type': 'CpuModelExpansionType',
'model': 'CpuModelInfo' },
'returns': 'CpuModelExpansionInfo',
- 'if': { 'any': [ 'TARGET_S390X',
- 'TARGET_I386',
- 'TARGET_ARM',
- 'TARGET_LOONGARCH64',
- 'TARGET_RISCV' ] } }
+ 'runtime_if': { 'any': [ 'target_s390x()',
+ 'target_i386()',
+ 'target_x86_64()',
+ 'target_arm()',
+ 'target_aarch64()',
+ 'target_loongarch64()',
+ 'target_riscv32()',
+ 'target_riscv64()' ] } }
##
# @CpuDefinitionInfo:
@@ -378,13 +384,18 @@
'typename': 'str',
'*alias-of' : 'str',
'deprecated' : 'bool' },
- 'if': { 'any': [ 'TARGET_PPC',
- 'TARGET_ARM',
- 'TARGET_I386',
- 'TARGET_S390X',
- 'TARGET_MIPS',
- 'TARGET_LOONGARCH64',
- 'TARGET_RISCV' ] } }
+ 'runtime_if': { 'any': [ 'target_ppc()',
+ 'target_ppc64()',
+ 'target_arm()',
+ 'target_aarch64()',
+ 'target_i386()',
+ 'target_x86_64()',
+ 'target_s390x()',
+ 'target_mips()',
+ 'target_mips64()',
+ 'target_loongarch64()',
+ 'target_riscv32()',
+ 'target_riscv64()' ] } }
##
# @query-cpu-definitions:
@@ -396,13 +407,18 @@
# 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' ] } }
+ 'runtime_if': { 'any': [ 'target_ppc()',
+ 'target_ppc64()',
+ 'target_arm()',
+ 'target_aarch64()',
+ 'target_i386()',
+ 'target_x86_64()',
+ 'target_s390x()',
+ 'target_mips()',
+ 'target_mips64()',
+ 'target_loongarch64()',
+ 'target_riscv32()',
+ 'target_riscv64()' ] } }
##
# @S390CpuPolarization:
@@ -414,7 +430,7 @@
##
{ 'enum': 'S390CpuPolarization',
'data': [ 'horizontal', 'vertical' ],
- 'if': 'TARGET_S390X'
+ 'runtime_if': 'target_s390x()'
}
##
@@ -453,7 +469,7 @@
'*dedicated': 'bool'
},
'features': [ 'unstable' ],
- 'if': { 'all': [ 'TARGET_S390X' , 'CONFIG_KVM' ] }
+ 'runtime_if': { 'all': [ 'target_s390x()' , 'target_has_kvm()' ] }
}
##
@@ -489,7 +505,7 @@
{ 'event': 'CPU_POLARIZATION_CHANGE',
'data': { 'polarization': 'S390CpuPolarization' },
'features': [ 'unstable' ],
- 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+ 'runtime_if': { 'all': [ 'target_s390x()' , 'target_has_kvm()' ] }
}
##
@@ -503,7 +519,7 @@
##
{ 'struct': 'CpuPolarizationInfo',
'data': { 'polarization': 'S390CpuPolarization' },
- 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+ 'runtime_if': { 'all': [ 'target_s390x()' , 'target_has_kvm()' ] }
}
##
@@ -519,5 +535,5 @@
##
{ 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo',
'features': [ 'unstable' ],
- 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+ 'runtime_if': { 'all': [ 'target_s390x()' , 'target_has_kvm()' ] }
}
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index 42e4a7417dc..54500533e5b 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -17,7 +17,7 @@
# <- { "return": {} }
##
{ 'command': 'rtc-reset-reinjection',
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @SevState:
@@ -45,7 +45,7 @@
{ 'enum': 'SevState',
'data': ['uninit', 'launch-update', 'launch-secret', 'running',
'send-update', 'receive-update' ],
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @SevGuestType:
@@ -60,7 +60,7 @@
##
{ 'enum': 'SevGuestType',
'data': [ 'sev', 'sev-snp' ],
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @SevGuestInfo:
@@ -76,7 +76,7 @@
{ 'struct': 'SevGuestInfo',
'data': { 'policy': 'uint32',
'handle': 'uint32' },
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @SevSnpGuestInfo:
@@ -89,7 +89,7 @@
##
{ 'struct': 'SevSnpGuestInfo',
'data': { 'snp-policy': 'uint64' },
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @SevInfo:
@@ -121,7 +121,7 @@
'data': {
'sev': 'SevGuestInfo',
'sev-snp': 'SevSnpGuestInfo' },
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
@@ -141,7 +141,7 @@
# "handle" : 1 } }
##
{ 'command': 'query-sev', 'returns': 'SevInfo',
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @SevLaunchMeasureInfo:
@@ -153,7 +153,7 @@
# Since: 2.12
##
{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'},
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @query-sev-launch-measure:
@@ -170,7 +170,7 @@
# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } }
##
{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo',
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @SevCapability:
@@ -197,7 +197,7 @@
'cpu0-id': 'str',
'cbitpos': 'int',
'reduced-phys-bits': 'int'},
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @query-sev-capabilities:
@@ -217,7 +217,7 @@
# "cbitpos": 47, "reduced-phys-bits": 1}}
##
{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @sev-inject-launch-secret:
@@ -234,7 +234,7 @@
##
{ 'command': 'sev-inject-launch-secret',
'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' },
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @SevAttestationReport:
@@ -248,7 +248,7 @@
##
{ 'struct': 'SevAttestationReport',
'data': { 'data': 'str'},
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @query-sev-attestation-report:
@@ -272,7 +272,7 @@
{ 'command': 'query-sev-attestation-report',
'data': { 'mnonce': 'str' },
'returns': 'SevAttestationReport',
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @GICCapability:
@@ -297,7 +297,7 @@
'data': { 'version': 'int',
'emulated': 'bool',
'kernel': 'bool' },
- 'if': 'TARGET_ARM' }
+ 'runtime_if': { 'any': [ 'target_arm()', 'target_aarch64()' ] } }
##
# @query-gic-capabilities:
@@ -316,7 +316,7 @@
# { "version": 3, "emulated": false, "kernel": true } ] }
##
{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'],
- 'if': 'TARGET_ARM' }
+ 'runtime_if': { 'any': [ 'target_arm()', 'target_aarch64()' ] } }
##
# @SGXEPCSection:
@@ -356,7 +356,7 @@
'sgx2': 'bool',
'flc': 'bool',
'sections': ['SGXEPCSection']},
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @query-sgx:
@@ -375,7 +375,8 @@
# "sections": [{"node": 0, "size": 67108864},
# {"node": 1, "size": 29360128}]} }
##
-{ 'command': 'query-sgx', 'returns': 'SGXInfo', 'if': 'TARGET_I386' }
+{ 'command': 'query-sgx', 'returns': 'SGXInfo',
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @query-sgx-capabilities:
@@ -394,7 +395,8 @@
# "section" : [{"node": 0, "size": 67108864},
# {"node": 1, "size": 29360128}]} }
##
-{ 'command': 'query-sgx-capabilities', 'returns': 'SGXInfo', 'if': 'TARGET_I386' }
+{ 'command': 'query-sgx-capabilities', 'returns': 'SGXInfo',
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
@@ -418,7 +420,7 @@
##
{ 'enum': 'EvtchnPortType',
'data': ['closed', 'unbound', 'interdomain', 'pirq', 'virq', 'ipi'],
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @EvtchnInfo:
@@ -449,7 +451,7 @@
'target': 'uint16',
'pending': 'bool',
'masked': 'bool'},
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
@@ -488,7 +490,7 @@
##
{ 'command': 'xen-event-list',
'returns': ['EvtchnInfo'],
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @xen-event-inject:
@@ -506,4 +508,4 @@
##
{ 'command': 'xen-event-inject',
'data': { 'port': 'uint32' },
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 5ae26395964..f31f28ecb10 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -638,7 +638,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
if meta == 'enum':
check_keys(expr, info, meta,
- ['enum', 'data'], ['if', 'features', 'prefix'])
+ ['enum', 'data'], ['if', 'runtime_if', 'features',
+ 'prefix'])
check_enum(expr)
elif meta == 'union':
check_keys(expr, info, meta,
@@ -654,7 +655,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
check_alternate(expr)
elif meta == 'struct':
check_keys(expr, info, meta,
- ['struct', 'data'], ['base', 'if', 'features'])
+ ['struct', 'data'], ['base', 'if', 'runtime_if',
+ 'features'])
normalize_members(expr['data'])
check_struct(expr)
elif meta == 'command':
@@ -667,7 +669,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
check_command(expr)
elif meta == 'event':
check_keys(expr, info, meta,
- ['event'], ['data', 'boxed', 'if', 'features'])
+ ['event'], ['data', 'boxed', 'if', 'runtime_if',
+ 'features'])
normalize_members(expr.get('data'))
check_event(expr)
else:
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 10/13] qapi: add weak stubs for target specific commands
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (8 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 09/13] qapi: transform target specific 'if' in runtime checks Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-08 6:57 ` Philippe Mathieu-Daudé
2025-05-07 23:14 ` [PATCH 11/13] qapi: make all generated files common Pierrick Bouvier
` (2 subsequent siblings)
12 siblings, 1 reply; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
We are about to expose various target specific commands for all targets,
so we need to stub not implemented qmp_* functions.
MinGW does not support weak symbols without at least one strong
definition, so we'll have to detail stubs per target. Sad.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/commands-weak-stubs.c | 38 ++++++++++++++++++++++++++++++++++++++
qapi/meson.build | 2 ++
2 files changed, 40 insertions(+)
create mode 100644 qapi/commands-weak-stubs.c
diff --git a/qapi/commands-weak-stubs.c b/qapi/commands-weak-stubs.c
new file mode 100644
index 00000000000..9734263c32e
--- /dev/null
+++ b/qapi/commands-weak-stubs.c
@@ -0,0 +1,38 @@
+/*
+ * Weak symbols for target specific commands
+ *
+ * Copyright Linaro, 2025
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include <glib.h>
+
+#define NOT_REACHABLE(symbol) \
+void __attribute__((weak)) symbol(void); \
+void __attribute__((weak)) symbol(void) { g_assert_not_reached(); }
+
+#define WEAK_STUB(command) \
+NOT_REACHABLE(qmp_marshal_##command) \
+NOT_REACHABLE(qmp_##command)
+
+WEAK_STUB(query_cpu_model_comparison);
+WEAK_STUB(query_cpu_model_baseline);
+WEAK_STUB(set_cpu_topology);
+WEAK_STUB(query_s390x_cpu_polarization);
+WEAK_STUB(rtc_reset_reinjection);
+WEAK_STUB(query_sev);
+WEAK_STUB(query_sev_launch_measure);
+WEAK_STUB(query_sev_capabilities);
+WEAK_STUB(sev_inject_launch_secret);
+WEAK_STUB(query_sev_attestation_report);
+WEAK_STUB(query_sgx);
+WEAK_STUB(query_sgx_capabilities);
+WEAK_STUB(xen_event_list);
+WEAK_STUB(xen_event_inject);
+WEAK_STUB(query_cpu_model_expansion);
+WEAK_STUB(query_cpu_definitions);
+WEAK_STUB(query_gic_capabilities);
diff --git a/qapi/meson.build b/qapi/meson.build
index eadde4db307..60fc958ec10 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -147,3 +147,5 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: qapi_files[i])
i = i + 1
endforeach
+
+system_ss.add(files('commands-weak-stubs.c'))
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 11/13] qapi: make all generated files common
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (9 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 10/13] qapi: add weak stubs for target specific commands Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-08 6:57 ` Philippe Mathieu-Daudé
2025-05-07 23:14 ` [PATCH 13/13] [ANNEX] build/qapi: after series Pierrick Bouvier
2025-05-07 23:33 ` [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
12 siblings, 1 reply; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qapi/meson.build b/qapi/meson.build
index 60fc958ec10..b8aa33ec9db 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -144,7 +144,7 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
if output.endswith('.trace-events')
qapi_trace_events += qapi_files[i]
endif
- specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: qapi_files[i])
+ system_ss.add(if_true: qapi_files[i])
i = i + 1
endforeach
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 13/13] [ANNEX] build/qapi: after series
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (10 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 11/13] qapi: make all generated files common Pierrick Bouvier
@ 2025-05-07 23:14 ` Pierrick Bouvier
2025-05-07 23:33 ` [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
12 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:14 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
berrange, thuth, Michael Roth
In this patch, you can see all the changes in generated QAPI code.
Feel free to review inline if you want to highlight some parts.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
build/qapi/qapi-commands-machine-target.h | 12 -
build/qapi/qapi-commands-misc-target.h | 22 --
build/qapi/qapi-events-machine-target.h | 2 -
build/qapi/qapi-introspect.h | 2 +-
build/qapi/qapi-types-machine-target.h | 58 -----
build/qapi/qapi-types-misc-target.h | 84 -------
build/qapi/qapi-visit-machine-target.h | 24 --
build/qapi/qapi-visit-misc-target.h | 36 ---
build/qapi/qapi-builtin-visit.c | 1 +
build/qapi/qapi-commands-acpi.c | 1 +
build/qapi/qapi-commands-audio.c | 1 +
build/qapi/qapi-commands-authz.c | 1 +
build/qapi/qapi-commands-block-core.c | 1 +
build/qapi/qapi-commands-block-export.c | 1 +
build/qapi/qapi-commands-block.c | 1 +
build/qapi/qapi-commands-char.c | 1 +
build/qapi/qapi-commands-common.c | 1 +
build/qapi/qapi-commands-compat.c | 1 +
build/qapi/qapi-commands-control.c | 1 +
build/qapi/qapi-commands-crypto.c | 1 +
build/qapi/qapi-commands-cryptodev.c | 1 +
build/qapi/qapi-commands-cxl.c | 1 +
build/qapi/qapi-commands-dump.c | 1 +
build/qapi/qapi-commands-ebpf.c | 1 +
build/qapi/qapi-commands-error.c | 1 +
build/qapi/qapi-commands-introspect.c | 1 +
build/qapi/qapi-commands-job.c | 1 +
build/qapi/qapi-commands-machine-common.c | 1 +
build/qapi/qapi-commands-machine-target.c | 23 +-
build/qapi/qapi-commands-machine.c | 1 +
build/qapi/qapi-commands-migration.c | 1 +
build/qapi/qapi-commands-misc-target.c | 37 +--
build/qapi/qapi-commands-misc.c | 1 +
build/qapi/qapi-commands-net.c | 1 +
build/qapi/qapi-commands-pci.c | 1 +
build/qapi/qapi-commands-pragma.c | 1 +
build/qapi/qapi-commands-qdev.c | 1 +
build/qapi/qapi-commands-qom.c | 1 +
build/qapi/qapi-commands-replay.c | 1 +
build/qapi/qapi-commands-rocker.c | 1 +
build/qapi/qapi-commands-run-state.c | 1 +
build/qapi/qapi-commands-sockets.c | 1 +
build/qapi/qapi-commands-stats.c | 1 +
build/qapi/qapi-commands-tpm.c | 1 +
build/qapi/qapi-commands-trace.c | 1 +
build/qapi/qapi-commands-transaction.c | 1 +
build/qapi/qapi-commands-uefi.c | 1 +
build/qapi/qapi-commands-ui.c | 1 +
build/qapi/qapi-commands-vfio.c | 1 +
build/qapi/qapi-commands-virtio.c | 1 +
build/qapi/qapi-commands-yank.c | 1 +
build/qapi/qapi-commands.c | 1 +
build/qapi/qapi-events-machine-target.c | 2 -
build/qapi/qapi-init-commands.c | 69 ++---
build/qapi/qapi-introspect.c | 294 ++++++++--------------
build/qapi/qapi-types-machine-target.c | 14 --
build/qapi/qapi-types-misc-target.c | 28 ---
build/qapi/qapi-visit-acpi.c | 1 +
build/qapi/qapi-visit-audio.c | 1 +
build/qapi/qapi-visit-authz.c | 1 +
build/qapi/qapi-visit-block-core.c | 1 +
build/qapi/qapi-visit-block-export.c | 1 +
build/qapi/qapi-visit-block.c | 1 +
build/qapi/qapi-visit-char.c | 1 +
build/qapi/qapi-visit-common.c | 1 +
build/qapi/qapi-visit-compat.c | 1 +
build/qapi/qapi-visit-control.c | 1 +
build/qapi/qapi-visit-crypto.c | 1 +
build/qapi/qapi-visit-cryptodev.c | 1 +
build/qapi/qapi-visit-cxl.c | 1 +
build/qapi/qapi-visit-dump.c | 1 +
build/qapi/qapi-visit-ebpf.c | 1 +
build/qapi/qapi-visit-error.c | 1 +
build/qapi/qapi-visit-introspect.c | 1 +
build/qapi/qapi-visit-job.c | 1 +
build/qapi/qapi-visit-machine-common.c | 1 +
build/qapi/qapi-visit-machine-target.c | 29 +--
build/qapi/qapi-visit-machine.c | 1 +
build/qapi/qapi-visit-migration.c | 1 +
build/qapi/qapi-visit-misc-target.c | 37 +--
build/qapi/qapi-visit-misc.c | 1 +
build/qapi/qapi-visit-net.c | 1 +
build/qapi/qapi-visit-pci.c | 1 +
build/qapi/qapi-visit-pragma.c | 1 +
build/qapi/qapi-visit-qdev.c | 1 +
build/qapi/qapi-visit-qom.c | 1 +
build/qapi/qapi-visit-replay.c | 1 +
build/qapi/qapi-visit-rocker.c | 1 +
build/qapi/qapi-visit-run-state.c | 1 +
build/qapi/qapi-visit-sockets.c | 1 +
build/qapi/qapi-visit-stats.c | 1 +
build/qapi/qapi-visit-tpm.c | 1 +
build/qapi/qapi-visit-trace.c | 1 +
build/qapi/qapi-visit-transaction.c | 1 +
build/qapi/qapi-visit-uefi.c | 1 +
build/qapi/qapi-visit-ui.c | 1 +
build/qapi/qapi-visit-vfio.c | 1 +
build/qapi/qapi-visit-virtio.c | 1 +
build/qapi/qapi-visit-yank.c | 1 +
build/qapi/qapi-visit.c | 1 +
100 files changed, 226 insertions(+), 630 deletions(-)
diff --git a/build/qapi/qapi-commands-machine-target.h b/build/qapi/qapi-commands-machine-target.h
index 4b9cd2616ba..3c1cc46e8fc 100644
--- a/build/qapi/qapi-commands-machine-target.h
+++ b/build/qapi/qapi-commands-machine-target.h
@@ -16,29 +16,17 @@
#include "qapi-commands-machine-common.h"
#include "qapi-types-machine-target.h"
-#if defined(TARGET_S390X)
CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *modela, CpuModelInfo *modelb, Error **errp);
void qmp_marshal_query_cpu_model_comparison(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *modela, CpuModelInfo *modelb, Error **errp);
void qmp_marshal_query_cpu_model_baseline(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, CpuModelInfo *model, Error **errp);
void qmp_marshal_query_cpu_model_expansion(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp);
void qmp_marshal_query_cpu_definitions(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
void qmp_set_cpu_topology(uint16_t core_id, bool has_socket_id, uint16_t socket_id, bool has_book_id, uint16_t book_id, bool has_drawer_id, uint16_t drawer_id, bool has_entitlement, S390CpuEntitlement entitlement, bool has_dedicated, bool dedicated, Error **errp);
void qmp_marshal_set_cpu_topology(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
CpuPolarizationInfo *qmp_query_s390x_cpu_polarization(Error **errp);
void qmp_marshal_query_s390x_cpu_polarization(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
#endif /* QAPI_COMMANDS_MACHINE_TARGET_H */
diff --git a/build/qapi/qapi-commands-misc-target.h b/build/qapi/qapi-commands-misc-target.h
index 366711c22a2..8b449d314de 100644
--- a/build/qapi/qapi-commands-misc-target.h
+++ b/build/qapi/qapi-commands-misc-target.h
@@ -15,49 +15,27 @@
#include "qapi-types-misc-target.h"
-#if defined(TARGET_I386)
void qmp_rtc_reset_reinjection(Error **errp);
void qmp_marshal_rtc_reset_reinjection(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
SevInfo *qmp_query_sev(Error **errp);
void qmp_marshal_query_sev(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp);
void qmp_marshal_query_sev_launch_measure(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
SevCapability *qmp_query_sev_capabilities(Error **errp);
void qmp_marshal_query_sev_capabilities(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_sev_inject_launch_secret(const char *packet_header, const char *secret, bool has_gpa, uint64_t gpa, Error **errp);
void qmp_marshal_sev_inject_launch_secret(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, Error **errp);
void qmp_marshal_query_sev_attestation_report(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
GICCapabilityList *qmp_query_gic_capabilities(Error **errp);
void qmp_marshal_query_gic_capabilities(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_I386)
SGXInfo *qmp_query_sgx(Error **errp);
void qmp_marshal_query_sgx(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
SGXInfo *qmp_query_sgx_capabilities(Error **errp);
void qmp_marshal_query_sgx_capabilities(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
EvtchnInfoList *qmp_xen_event_list(Error **errp);
void qmp_marshal_xen_event_list(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_xen_event_inject(uint32_t port, Error **errp);
void qmp_marshal_xen_event_inject(QDict *args, QObject **ret, Error **errp);
-#endif /* defined(TARGET_I386) */
#endif /* QAPI_COMMANDS_MISC_TARGET_H */
diff --git a/build/qapi/qapi-events-machine-target.h b/build/qapi/qapi-events-machine-target.h
index 95b65d92535..beba27a650c 100644
--- a/build/qapi/qapi-events-machine-target.h
+++ b/build/qapi/qapi-events-machine-target.h
@@ -17,8 +17,6 @@
#include "qapi/util.h"
#include "qapi-types-machine-target.h"
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
void qapi_event_send_cpu_polarization_change(S390CpuPolarization polarization);
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
#endif /* QAPI_EVENTS_MACHINE_TARGET_H */
diff --git a/build/qapi/qapi-introspect.h b/build/qapi/qapi-introspect.h
index 2ae03416453..e94f33abb2d 100644
--- a/build/qapi/qapi-introspect.h
+++ b/build/qapi/qapi-introspect.h
@@ -14,6 +14,6 @@
#include "qobject/qlit.h"
-extern const QLitObject qmp_schema_qlit;
+QObject *qmp_schema_qobject(void);
#endif /* QAPI_INTROSPECT_H */
diff --git a/build/qapi/qapi-types-machine-target.h b/build/qapi/qapi-types-machine-target.h
index e9a7ef113d9..1042a3672e4 100644
--- a/build/qapi/qapi-types-machine-target.h
+++ b/build/qapi/qapi-types-machine-target.h
@@ -42,39 +42,22 @@ typedef enum CpuModelCompareResult {
extern const QEnumLookup CpuModelCompareResult_lookup;
-#if defined(TARGET_S390X)
typedef struct CpuModelBaselineInfo CpuModelBaselineInfo;
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
typedef struct CpuModelCompareInfo CpuModelCompareInfo;
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
typedef struct q_obj_query_cpu_model_comparison_arg q_obj_query_cpu_model_comparison_arg;
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
typedef struct q_obj_query_cpu_model_baseline_arg q_obj_query_cpu_model_baseline_arg;
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
typedef struct CpuModelExpansionInfo CpuModelExpansionInfo;
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
typedef struct q_obj_query_cpu_model_expansion_arg q_obj_query_cpu_model_expansion_arg;
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
typedef struct CpuDefinitionInfo CpuDefinitionInfo;
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
typedef struct CpuDefinitionInfoList CpuDefinitionInfoList;
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X)
typedef enum S390CpuPolarization {
S390_CPU_POLARIZATION_HORIZONTAL,
S390_CPU_POLARIZATION_VERTICAL,
@@ -85,19 +68,12 @@ typedef enum S390CpuPolarization {
qapi_enum_lookup(&S390CpuPolarization_lookup, (val))
extern const QEnumLookup S390CpuPolarization_lookup;
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
typedef struct q_obj_set_cpu_topology_arg q_obj_set_cpu_topology_arg;
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
typedef struct q_obj_CPU_POLARIZATION_CHANGE_arg q_obj_CPU_POLARIZATION_CHANGE_arg;
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
typedef struct CpuPolarizationInfo CpuPolarizationInfo;
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
struct CpuModelInfo {
char *name;
@@ -107,65 +83,44 @@ struct CpuModelInfo {
void qapi_free_CpuModelInfo(CpuModelInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuModelInfo, qapi_free_CpuModelInfo)
-#if defined(TARGET_S390X)
struct CpuModelBaselineInfo {
CpuModelInfo *model;
};
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
void qapi_free_CpuModelBaselineInfo(CpuModelBaselineInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuModelBaselineInfo, qapi_free_CpuModelBaselineInfo)
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
struct CpuModelCompareInfo {
CpuModelCompareResult result;
strList *responsible_properties;
};
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
void qapi_free_CpuModelCompareInfo(CpuModelCompareInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuModelCompareInfo, qapi_free_CpuModelCompareInfo)
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
struct q_obj_query_cpu_model_comparison_arg {
CpuModelInfo *modela;
CpuModelInfo *modelb;
};
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
struct q_obj_query_cpu_model_baseline_arg {
CpuModelInfo *modela;
CpuModelInfo *modelb;
};
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
struct CpuModelExpansionInfo {
CpuModelInfo *model;
-#if defined(TARGET_S390X)
strList *deprecated_props;
-#endif /* defined(TARGET_S390X) */
};
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
void qapi_free_CpuModelExpansionInfo(CpuModelExpansionInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuModelExpansionInfo, qapi_free_CpuModelExpansionInfo)
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
struct q_obj_query_cpu_model_expansion_arg {
CpuModelExpansionType type;
CpuModelInfo *model;
};
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
struct CpuDefinitionInfo {
char *name;
bool has_migration_safe;
@@ -177,14 +132,10 @@ struct CpuDefinitionInfo {
char *alias_of;
bool deprecated;
};
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
void qapi_free_CpuDefinitionInfo(CpuDefinitionInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuDefinitionInfo, qapi_free_CpuDefinitionInfo)
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
struct CpuDefinitionInfoList {
CpuDefinitionInfoList *next;
CpuDefinitionInfo *value;
@@ -192,9 +143,7 @@ struct CpuDefinitionInfoList {
void qapi_free_CpuDefinitionInfoList(CpuDefinitionInfoList *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuDefinitionInfoList, qapi_free_CpuDefinitionInfoList)
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
struct q_obj_set_cpu_topology_arg {
uint16_t core_id;
bool has_socket_id;
@@ -208,23 +157,16 @@ struct q_obj_set_cpu_topology_arg {
bool has_dedicated;
bool dedicated;
};
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
struct q_obj_CPU_POLARIZATION_CHANGE_arg {
S390CpuPolarization polarization;
};
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
struct CpuPolarizationInfo {
S390CpuPolarization polarization;
};
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
void qapi_free_CpuPolarizationInfo(CpuPolarizationInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuPolarizationInfo, qapi_free_CpuPolarizationInfo)
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
#endif /* QAPI_TYPES_MACHINE_TARGET_H */
diff --git a/build/qapi/qapi-types-misc-target.h b/build/qapi/qapi-types-misc-target.h
index 5d0c4db219d..d3cb640e7ea 100644
--- a/build/qapi/qapi-types-misc-target.h
+++ b/build/qapi/qapi-types-misc-target.h
@@ -15,7 +15,6 @@
#include "qapi/qapi-builtin-types.h"
-#if defined(TARGET_I386)
typedef enum SevState {
SEV_STATE_UNINIT,
SEV_STATE_LAUNCH_UPDATE,
@@ -30,9 +29,7 @@ typedef enum SevState {
qapi_enum_lookup(&SevState_lookup, (val))
extern const QEnumLookup SevState_lookup;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef enum SevGuestType {
SEV_GUEST_TYPE_SEV,
SEV_GUEST_TYPE_SEV_SNP,
@@ -43,61 +40,35 @@ typedef enum SevGuestType {
qapi_enum_lookup(&SevGuestType_lookup, (val))
extern const QEnumLookup SevGuestType_lookup;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct SevGuestInfo SevGuestInfo;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct SevSnpGuestInfo SevSnpGuestInfo;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct q_obj_SevInfo_base q_obj_SevInfo_base;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct SevInfo SevInfo;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct SevLaunchMeasureInfo SevLaunchMeasureInfo;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct SevCapability SevCapability;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct q_obj_sev_inject_launch_secret_arg q_obj_sev_inject_launch_secret_arg;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct SevAttestationReport SevAttestationReport;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct q_obj_query_sev_attestation_report_arg q_obj_query_sev_attestation_report_arg;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
typedef struct GICCapability GICCapability;
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_ARM)
typedef struct GICCapabilityList GICCapabilityList;
-#endif /* defined(TARGET_ARM) */
typedef struct SGXEPCSection SGXEPCSection;
typedef struct SGXEPCSectionList SGXEPCSectionList;
-#if defined(TARGET_I386)
typedef struct SGXInfo SGXInfo;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef enum EvtchnPortType {
EVTCHN_PORT_TYPE_CLOSED,
EVTCHN_PORT_TYPE_UNBOUND,
@@ -112,44 +83,28 @@ typedef enum EvtchnPortType {
qapi_enum_lookup(&EvtchnPortType_lookup, (val))
extern const QEnumLookup EvtchnPortType_lookup;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct EvtchnInfo EvtchnInfo;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct EvtchnInfoList EvtchnInfoList;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
typedef struct q_obj_xen_event_inject_arg q_obj_xen_event_inject_arg;
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct SevGuestInfo {
uint32_t policy;
uint32_t handle;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevGuestInfo(SevGuestInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevGuestInfo, qapi_free_SevGuestInfo)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct SevSnpGuestInfo {
uint64_t snp_policy;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevSnpGuestInfo(SevSnpGuestInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevSnpGuestInfo, qapi_free_SevSnpGuestInfo)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct q_obj_SevInfo_base {
bool enabled;
uint8_t api_major;
@@ -158,9 +113,7 @@ struct q_obj_SevInfo_base {
SevState state;
SevGuestType sev_type;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct SevInfo {
bool enabled;
uint8_t api_major;
@@ -173,25 +126,17 @@ struct SevInfo {
SevSnpGuestInfo sev_snp;
} u;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevInfo(SevInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevInfo, qapi_free_SevInfo)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct SevLaunchMeasureInfo {
char *data;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevLaunchMeasureInfo(SevLaunchMeasureInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevLaunchMeasureInfo, qapi_free_SevLaunchMeasureInfo)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct SevCapability {
char *pdh;
char *cert_chain;
@@ -199,53 +144,37 @@ struct SevCapability {
int64_t cbitpos;
int64_t reduced_phys_bits;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevCapability(SevCapability *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevCapability, qapi_free_SevCapability)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct q_obj_sev_inject_launch_secret_arg {
char *packet_header;
char *secret;
bool has_gpa;
uint64_t gpa;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct SevAttestationReport {
char *data;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevAttestationReport(SevAttestationReport *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevAttestationReport, qapi_free_SevAttestationReport)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct q_obj_query_sev_attestation_report_arg {
char *mnonce;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
struct GICCapability {
int64_t version;
bool emulated;
bool kernel;
};
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_ARM)
void qapi_free_GICCapability(GICCapability *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GICCapability, qapi_free_GICCapability)
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_ARM)
struct GICCapabilityList {
GICCapabilityList *next;
GICCapability *value;
@@ -253,7 +182,6 @@ struct GICCapabilityList {
void qapi_free_GICCapabilityList(GICCapabilityList *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GICCapabilityList, qapi_free_GICCapabilityList)
-#endif /* defined(TARGET_ARM) */
struct SGXEPCSection {
int64_t node;
@@ -271,7 +199,6 @@ struct SGXEPCSectionList {
void qapi_free_SGXEPCSectionList(SGXEPCSectionList *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SGXEPCSectionList, qapi_free_SGXEPCSectionList)
-#if defined(TARGET_I386)
struct SGXInfo {
bool sgx;
bool sgx1;
@@ -279,14 +206,10 @@ struct SGXInfo {
bool flc;
SGXEPCSectionList *sections;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SGXInfo(SGXInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SGXInfo, qapi_free_SGXInfo)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct EvtchnInfo {
uint16_t port;
uint32_t vcpu;
@@ -296,14 +219,10 @@ struct EvtchnInfo {
bool pending;
bool masked;
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_EvtchnInfo(EvtchnInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(EvtchnInfo, qapi_free_EvtchnInfo)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct EvtchnInfoList {
EvtchnInfoList *next;
EvtchnInfo *value;
@@ -311,12 +230,9 @@ struct EvtchnInfoList {
void qapi_free_EvtchnInfoList(EvtchnInfoList *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(EvtchnInfoList, qapi_free_EvtchnInfoList)
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
struct q_obj_xen_event_inject_arg {
uint32_t port;
};
-#endif /* defined(TARGET_I386) */
#endif /* QAPI_TYPES_MISC_TARGET_H */
diff --git a/build/qapi/qapi-visit-machine-target.h b/build/qapi/qapi-visit-machine-target.h
index fe5ea755987..3a8cff39ebe 100644
--- a/build/qapi/qapi-visit-machine-target.h
+++ b/build/qapi/qapi-visit-machine-target.h
@@ -29,69 +29,45 @@ bool visit_type_CpuModelExpansionType(Visitor *v, const char *name,
bool visit_type_CpuModelCompareResult(Visitor *v, const char *name,
CpuModelCompareResult *obj, Error **errp);
-#if defined(TARGET_S390X)
bool visit_type_CpuModelBaselineInfo_members(Visitor *v, CpuModelBaselineInfo *obj, Error **errp);
bool visit_type_CpuModelBaselineInfo(Visitor *v, const char *name,
CpuModelBaselineInfo **obj, Error **errp);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
bool visit_type_CpuModelCompareInfo_members(Visitor *v, CpuModelCompareInfo *obj, Error **errp);
bool visit_type_CpuModelCompareInfo(Visitor *v, const char *name,
CpuModelCompareInfo **obj, Error **errp);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
bool visit_type_q_obj_query_cpu_model_comparison_arg_members(Visitor *v, q_obj_query_cpu_model_comparison_arg *obj, Error **errp);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
bool visit_type_q_obj_query_cpu_model_baseline_arg_members(Visitor *v, q_obj_query_cpu_model_baseline_arg *obj, Error **errp);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
bool visit_type_CpuModelExpansionInfo_members(Visitor *v, CpuModelExpansionInfo *obj, Error **errp);
bool visit_type_CpuModelExpansionInfo(Visitor *v, const char *name,
CpuModelExpansionInfo **obj, Error **errp);
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
bool visit_type_q_obj_query_cpu_model_expansion_arg_members(Visitor *v, q_obj_query_cpu_model_expansion_arg *obj, Error **errp);
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
bool visit_type_CpuDefinitionInfo_members(Visitor *v, CpuDefinitionInfo *obj, Error **errp);
bool visit_type_CpuDefinitionInfo(Visitor *v, const char *name,
CpuDefinitionInfo **obj, Error **errp);
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
bool visit_type_CpuDefinitionInfoList(Visitor *v, const char *name,
CpuDefinitionInfoList **obj, Error **errp);
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X)
bool visit_type_S390CpuPolarization(Visitor *v, const char *name,
S390CpuPolarization *obj, Error **errp);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
bool visit_type_q_obj_set_cpu_topology_arg_members(Visitor *v, q_obj_set_cpu_topology_arg *obj, Error **errp);
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
bool visit_type_q_obj_CPU_POLARIZATION_CHANGE_arg_members(Visitor *v, q_obj_CPU_POLARIZATION_CHANGE_arg *obj, Error **errp);
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
bool visit_type_CpuPolarizationInfo_members(Visitor *v, CpuPolarizationInfo *obj, Error **errp);
bool visit_type_CpuPolarizationInfo(Visitor *v, const char *name,
CpuPolarizationInfo **obj, Error **errp);
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
#endif /* QAPI_VISIT_MACHINE_TARGET_H */
diff --git a/build/qapi/qapi-visit-misc-target.h b/build/qapi/qapi-visit-misc-target.h
index bd94799ff65..63f3bee9858 100644
--- a/build/qapi/qapi-visit-misc-target.h
+++ b/build/qapi/qapi-visit-misc-target.h
@@ -17,81 +17,55 @@
#include "qapi-types-misc-target.h"
-#if defined(TARGET_I386)
bool visit_type_SevState(Visitor *v, const char *name,
SevState *obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevGuestType(Visitor *v, const char *name,
SevGuestType *obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevGuestInfo_members(Visitor *v, SevGuestInfo *obj, Error **errp);
bool visit_type_SevGuestInfo(Visitor *v, const char *name,
SevGuestInfo **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevSnpGuestInfo_members(Visitor *v, SevSnpGuestInfo *obj, Error **errp);
bool visit_type_SevSnpGuestInfo(Visitor *v, const char *name,
SevSnpGuestInfo **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_q_obj_SevInfo_base_members(Visitor *v, q_obj_SevInfo_base *obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevInfo_members(Visitor *v, SevInfo *obj, Error **errp);
bool visit_type_SevInfo(Visitor *v, const char *name,
SevInfo **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevLaunchMeasureInfo_members(Visitor *v, SevLaunchMeasureInfo *obj, Error **errp);
bool visit_type_SevLaunchMeasureInfo(Visitor *v, const char *name,
SevLaunchMeasureInfo **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevCapability_members(Visitor *v, SevCapability *obj, Error **errp);
bool visit_type_SevCapability(Visitor *v, const char *name,
SevCapability **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_q_obj_sev_inject_launch_secret_arg_members(Visitor *v, q_obj_sev_inject_launch_secret_arg *obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevAttestationReport_members(Visitor *v, SevAttestationReport *obj, Error **errp);
bool visit_type_SevAttestationReport(Visitor *v, const char *name,
SevAttestationReport **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_q_obj_query_sev_attestation_report_arg_members(Visitor *v, q_obj_query_sev_attestation_report_arg *obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
bool visit_type_GICCapability_members(Visitor *v, GICCapability *obj, Error **errp);
bool visit_type_GICCapability(Visitor *v, const char *name,
GICCapability **obj, Error **errp);
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_ARM)
bool visit_type_GICCapabilityList(Visitor *v, const char *name,
GICCapabilityList **obj, Error **errp);
-#endif /* defined(TARGET_ARM) */
bool visit_type_SGXEPCSection_members(Visitor *v, SGXEPCSection *obj, Error **errp);
@@ -101,32 +75,22 @@ bool visit_type_SGXEPCSection(Visitor *v, const char *name,
bool visit_type_SGXEPCSectionList(Visitor *v, const char *name,
SGXEPCSectionList **obj, Error **errp);
-#if defined(TARGET_I386)
bool visit_type_SGXInfo_members(Visitor *v, SGXInfo *obj, Error **errp);
bool visit_type_SGXInfo(Visitor *v, const char *name,
SGXInfo **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_EvtchnPortType(Visitor *v, const char *name,
EvtchnPortType *obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_EvtchnInfo_members(Visitor *v, EvtchnInfo *obj, Error **errp);
bool visit_type_EvtchnInfo(Visitor *v, const char *name,
EvtchnInfo **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_EvtchnInfoList(Visitor *v, const char *name,
EvtchnInfoList **obj, Error **errp);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_q_obj_xen_event_inject_arg_members(Visitor *v, q_obj_xen_event_inject_arg *obj, Error **errp);
-#endif /* defined(TARGET_I386) */
#endif /* QAPI_VISIT_MISC_TARGET_H */
diff --git a/build/qapi/qapi-builtin-visit.c b/build/qapi/qapi-builtin-visit.c
index 09a2e00d52b..51f0b0af111 100644
--- a/build/qapi/qapi-builtin-visit.c
+++ b/build/qapi/qapi-builtin-visit.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi/qapi-builtin-visit.h"
diff --git a/build/qapi/qapi-commands-acpi.c b/build/qapi/qapi-commands-acpi.c
index 874eee92937..3ea63671ffe 100644
--- a/build/qapi/qapi-commands-acpi.c
+++ b/build/qapi/qapi-commands-acpi.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-audio.c b/build/qapi/qapi-commands-audio.c
index afc0e1457ee..8d53e4325c7 100644
--- a/build/qapi/qapi-commands-audio.c
+++ b/build/qapi/qapi-commands-audio.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-authz.c b/build/qapi/qapi-commands-authz.c
index 0b63dcd080b..51dcf3e1049 100644
--- a/build/qapi/qapi-commands-authz.c
+++ b/build/qapi/qapi-commands-authz.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-block-core.c b/build/qapi/qapi-commands-block-core.c
index a28bafe1645..6cd3d7bb5d9 100644
--- a/build/qapi/qapi-commands-block-core.c
+++ b/build/qapi/qapi-commands-block-core.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-block-export.c b/build/qapi/qapi-commands-block-export.c
index ddb844a9389..a8c9ef852a8 100644
--- a/build/qapi/qapi-commands-block-export.c
+++ b/build/qapi/qapi-commands-block-export.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-block.c b/build/qapi/qapi-commands-block.c
index 23063ed2dbe..bbd8c66d53a 100644
--- a/build/qapi/qapi-commands-block.c
+++ b/build/qapi/qapi-commands-block.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-char.c b/build/qapi/qapi-commands-char.c
index 715200ec081..b6c065f8bc8 100644
--- a/build/qapi/qapi-commands-char.c
+++ b/build/qapi/qapi-commands-char.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-common.c b/build/qapi/qapi-commands-common.c
index b4480f93264..b1482337014 100644
--- a/build/qapi/qapi-commands-common.c
+++ b/build/qapi/qapi-commands-common.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-compat.c b/build/qapi/qapi-commands-compat.c
index 2ae394f0223..caf395d16c0 100644
--- a/build/qapi/qapi-commands-compat.c
+++ b/build/qapi/qapi-commands-compat.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-control.c b/build/qapi/qapi-commands-control.c
index 264951abf58..49ee9b7c91e 100644
--- a/build/qapi/qapi-commands-control.c
+++ b/build/qapi/qapi-commands-control.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-crypto.c b/build/qapi/qapi-commands-crypto.c
index e1ff9aeb7bb..606989f243b 100644
--- a/build/qapi/qapi-commands-crypto.c
+++ b/build/qapi/qapi-commands-crypto.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-cryptodev.c b/build/qapi/qapi-commands-cryptodev.c
index 01899e075fb..24c6a12c20d 100644
--- a/build/qapi/qapi-commands-cryptodev.c
+++ b/build/qapi/qapi-commands-cryptodev.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-cxl.c b/build/qapi/qapi-commands-cxl.c
index 7e181fd6038..43b1b65c20d 100644
--- a/build/qapi/qapi-commands-cxl.c
+++ b/build/qapi/qapi-commands-cxl.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-dump.c b/build/qapi/qapi-commands-dump.c
index f2f75bb8b01..f28ed412e19 100644
--- a/build/qapi/qapi-commands-dump.c
+++ b/build/qapi/qapi-commands-dump.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-ebpf.c b/build/qapi/qapi-commands-ebpf.c
index 55b50d655f2..d5184c57f3f 100644
--- a/build/qapi/qapi-commands-ebpf.c
+++ b/build/qapi/qapi-commands-ebpf.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-error.c b/build/qapi/qapi-commands-error.c
index b389572a039..cf276ff0504 100644
--- a/build/qapi/qapi-commands-error.c
+++ b/build/qapi/qapi-commands-error.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-introspect.c b/build/qapi/qapi-commands-introspect.c
index a5d8b87eeb1..5c73bb09326 100644
--- a/build/qapi/qapi-commands-introspect.c
+++ b/build/qapi/qapi-commands-introspect.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-job.c b/build/qapi/qapi-commands-job.c
index adaab4d5785..1e91e01be26 100644
--- a/build/qapi/qapi-commands-job.c
+++ b/build/qapi/qapi-commands-job.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-machine-common.c b/build/qapi/qapi-commands-machine-common.c
index a81689deb63..d3e39993990 100644
--- a/build/qapi/qapi-commands-machine-common.c
+++ b/build/qapi/qapi-commands-machine-common.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-machine-target.c b/build/qapi/qapi-commands-machine-target.c
index 902a7cbcb8c..ce49ae3231f 100644
--- a/build/qapi/qapi-commands-machine-target.c
+++ b/build/qapi/qapi-commands-machine-target.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
@@ -21,7 +22,6 @@
#include "qobject/qjson.h"
#include "trace/trace-qapi_commands_machine_target_trace_events.h"
-#if defined(TARGET_S390X)
static void qmp_marshal_output_CpuModelCompareInfo(CpuModelCompareInfo *ret_in,
QObject **ret_out, Error **errp)
{
@@ -36,9 +36,7 @@ static void qmp_marshal_output_CpuModelCompareInfo(CpuModelCompareInfo *ret_in,
visit_type_CpuModelCompareInfo(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
void qmp_marshal_query_cpu_model_comparison(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -88,9 +86,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
static void qmp_marshal_output_CpuModelBaselineInfo(CpuModelBaselineInfo *ret_in,
QObject **ret_out, Error **errp)
{
@@ -105,9 +101,7 @@ static void qmp_marshal_output_CpuModelBaselineInfo(CpuModelBaselineInfo *ret_in
visit_type_CpuModelBaselineInfo(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
void qmp_marshal_query_cpu_model_baseline(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -157,9 +151,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
static void qmp_marshal_output_CpuModelExpansionInfo(CpuModelExpansionInfo *ret_in,
QObject **ret_out, Error **errp)
{
@@ -174,9 +166,7 @@ static void qmp_marshal_output_CpuModelExpansionInfo(CpuModelExpansionInfo *ret_
visit_type_CpuModelExpansionInfo(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
void qmp_marshal_query_cpu_model_expansion(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -226,9 +216,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
static void qmp_marshal_output_CpuDefinitionInfoList(CpuDefinitionInfoList *ret_in,
QObject **ret_out, Error **errp)
{
@@ -243,9 +231,7 @@ static void qmp_marshal_output_CpuDefinitionInfoList(CpuDefinitionInfoList *ret_
visit_type_CpuDefinitionInfoList(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
void qmp_marshal_query_cpu_definitions(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -291,9 +277,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
void qmp_marshal_set_cpu_topology(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -336,9 +320,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
static void qmp_marshal_output_CpuPolarizationInfo(CpuPolarizationInfo *ret_in,
QObject **ret_out, Error **errp)
{
@@ -353,9 +335,7 @@ static void qmp_marshal_output_CpuPolarizationInfo(CpuPolarizationInfo *ret_in,
visit_type_CpuPolarizationInfo(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
void qmp_marshal_query_s390x_cpu_polarization(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -401,7 +381,6 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_commands_machine_target_c;
diff --git a/build/qapi/qapi-commands-machine.c b/build/qapi/qapi-commands-machine.c
index d428655ccd3..7b19d36cd80 100644
--- a/build/qapi/qapi-commands-machine.c
+++ b/build/qapi/qapi-commands-machine.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-migration.c b/build/qapi/qapi-commands-migration.c
index 040632a2fa8..4bd5776decd 100644
--- a/build/qapi/qapi-commands-migration.c
+++ b/build/qapi/qapi-commands-migration.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-misc-target.c b/build/qapi/qapi-commands-misc-target.c
index fe07b76a8b0..b7535ef2df1 100644
--- a/build/qapi/qapi-commands-misc-target.c
+++ b/build/qapi/qapi-commands-misc-target.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
@@ -21,7 +22,6 @@
#include "qobject/qjson.h"
#include "trace/trace-qapi_commands_misc_target_trace_events.h"
-#if defined(TARGET_I386)
void qmp_marshal_rtc_reset_reinjection(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -60,9 +60,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
static void qmp_marshal_output_SevInfo(SevInfo *ret_in,
QObject **ret_out, Error **errp)
{
@@ -77,9 +75,7 @@ static void qmp_marshal_output_SevInfo(SevInfo *ret_in,
visit_type_SevInfo(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_query_sev(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -125,9 +121,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
static void qmp_marshal_output_SevLaunchMeasureInfo(SevLaunchMeasureInfo *ret_in,
QObject **ret_out, Error **errp)
{
@@ -142,9 +136,7 @@ static void qmp_marshal_output_SevLaunchMeasureInfo(SevLaunchMeasureInfo *ret_in
visit_type_SevLaunchMeasureInfo(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_query_sev_launch_measure(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -190,9 +182,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
static void qmp_marshal_output_SevCapability(SevCapability *ret_in,
QObject **ret_out, Error **errp)
{
@@ -207,9 +197,7 @@ static void qmp_marshal_output_SevCapability(SevCapability *ret_in,
visit_type_SevCapability(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_query_sev_capabilities(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -255,9 +243,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_sev_inject_launch_secret(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -300,9 +286,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
static void qmp_marshal_output_SevAttestationReport(SevAttestationReport *ret_in,
QObject **ret_out, Error **errp)
{
@@ -317,9 +301,7 @@ static void qmp_marshal_output_SevAttestationReport(SevAttestationReport *ret_in
visit_type_SevAttestationReport(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_query_sev_attestation_report(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -369,9 +351,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
static void qmp_marshal_output_GICCapabilityList(GICCapabilityList *ret_in,
QObject **ret_out, Error **errp)
{
@@ -386,9 +366,7 @@ static void qmp_marshal_output_GICCapabilityList(GICCapabilityList *ret_in,
visit_type_GICCapabilityList(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_ARM)
void qmp_marshal_query_gic_capabilities(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -434,9 +412,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_I386)
static void qmp_marshal_output_SGXInfo(SGXInfo *ret_in,
QObject **ret_out, Error **errp)
{
@@ -451,9 +427,7 @@ static void qmp_marshal_output_SGXInfo(SGXInfo *ret_in,
visit_type_SGXInfo(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_query_sgx(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -499,9 +473,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_query_sgx_capabilities(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -547,9 +519,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
static void qmp_marshal_output_EvtchnInfoList(EvtchnInfoList *ret_in,
QObject **ret_out, Error **errp)
{
@@ -564,9 +534,7 @@ static void qmp_marshal_output_EvtchnInfoList(EvtchnInfoList *ret_in,
visit_type_EvtchnInfoList(v, "unused", &ret_in, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_xen_event_list(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -612,9 +580,7 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qmp_marshal_xen_event_inject(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
@@ -657,7 +623,6 @@ out:
visit_end_struct(v, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_commands_misc_target_c;
diff --git a/build/qapi/qapi-commands-misc.c b/build/qapi/qapi-commands-misc.c
index cc10565a251..68e07f583e4 100644
--- a/build/qapi/qapi-commands-misc.c
+++ b/build/qapi/qapi-commands-misc.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-net.c b/build/qapi/qapi-commands-net.c
index 48005e68ca4..8c66a9e1b90 100644
--- a/build/qapi/qapi-commands-net.c
+++ b/build/qapi/qapi-commands-net.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-pci.c b/build/qapi/qapi-commands-pci.c
index a93b6be872d..3fb3cac2aa1 100644
--- a/build/qapi/qapi-commands-pci.c
+++ b/build/qapi/qapi-commands-pci.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-pragma.c b/build/qapi/qapi-commands-pragma.c
index ded9d905d12..c49a4a7ec48 100644
--- a/build/qapi/qapi-commands-pragma.c
+++ b/build/qapi/qapi-commands-pragma.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-qdev.c b/build/qapi/qapi-commands-qdev.c
index 0527bcc42f2..1c43b8aa201 100644
--- a/build/qapi/qapi-commands-qdev.c
+++ b/build/qapi/qapi-commands-qdev.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-qom.c b/build/qapi/qapi-commands-qom.c
index 3cc1f56162f..f61ede2f987 100644
--- a/build/qapi/qapi-commands-qom.c
+++ b/build/qapi/qapi-commands-qom.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-replay.c b/build/qapi/qapi-commands-replay.c
index 67758365e12..55c4e98102f 100644
--- a/build/qapi/qapi-commands-replay.c
+++ b/build/qapi/qapi-commands-replay.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-rocker.c b/build/qapi/qapi-commands-rocker.c
index 8601446a542..153d0ec24bb 100644
--- a/build/qapi/qapi-commands-rocker.c
+++ b/build/qapi/qapi-commands-rocker.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-run-state.c b/build/qapi/qapi-commands-run-state.c
index d629c6fd5ac..11fbea9ca6f 100644
--- a/build/qapi/qapi-commands-run-state.c
+++ b/build/qapi/qapi-commands-run-state.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-sockets.c b/build/qapi/qapi-commands-sockets.c
index 1efed55889c..80b631e4c0a 100644
--- a/build/qapi/qapi-commands-sockets.c
+++ b/build/qapi/qapi-commands-sockets.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-stats.c b/build/qapi/qapi-commands-stats.c
index e8eb8322f96..563edccf03a 100644
--- a/build/qapi/qapi-commands-stats.c
+++ b/build/qapi/qapi-commands-stats.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-tpm.c b/build/qapi/qapi-commands-tpm.c
index 2550155771c..317f0007227 100644
--- a/build/qapi/qapi-commands-tpm.c
+++ b/build/qapi/qapi-commands-tpm.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-trace.c b/build/qapi/qapi-commands-trace.c
index 0518c3c586b..79b8ecf4baa 100644
--- a/build/qapi/qapi-commands-trace.c
+++ b/build/qapi/qapi-commands-trace.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-transaction.c b/build/qapi/qapi-commands-transaction.c
index 25ebee37918..1de65d98993 100644
--- a/build/qapi/qapi-commands-transaction.c
+++ b/build/qapi/qapi-commands-transaction.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-uefi.c b/build/qapi/qapi-commands-uefi.c
index 43e18e05cf3..28dbfe9d0a0 100644
--- a/build/qapi/qapi-commands-uefi.c
+++ b/build/qapi/qapi-commands-uefi.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-ui.c b/build/qapi/qapi-commands-ui.c
index ecd0e5a9c71..49995203443 100644
--- a/build/qapi/qapi-commands-ui.c
+++ b/build/qapi/qapi-commands-ui.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-vfio.c b/build/qapi/qapi-commands-vfio.c
index 2bde1f7302f..02a6ee7403a 100644
--- a/build/qapi/qapi-commands-vfio.c
+++ b/build/qapi/qapi-commands-vfio.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-virtio.c b/build/qapi/qapi-commands-virtio.c
index f305a5504d1..a12c9602c71 100644
--- a/build/qapi/qapi-commands-virtio.c
+++ b/build/qapi/qapi-commands-virtio.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands-yank.c b/build/qapi/qapi-commands-yank.c
index 48943fccb70..632a3bc86a8 100644
--- a/build/qapi/qapi-commands-yank.c
+++ b/build/qapi/qapi-commands-yank.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-commands.c b/build/qapi/qapi-commands.c
index e1219b4e500..7a2b1bbd0ce 100644
--- a/build/qapi/qapi-commands.c
+++ b/build/qapi/qapi-commands.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qobject/qdict.h"
diff --git a/build/qapi/qapi-events-machine-target.c b/build/qapi/qapi-events-machine-target.c
index aee7f0e2ef1..00e5b4e4a84 100644
--- a/build/qapi/qapi-events-machine-target.c
+++ b/build/qapi/qapi-events-machine-target.c
@@ -19,7 +19,6 @@
#include "qobject/qdict.h"
#include "qapi/qmp-event.h"
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
void qapi_event_send_cpu_polarization_change(S390CpuPolarization polarization)
{
QDict *qmp;
@@ -53,7 +52,6 @@ void qapi_event_send_cpu_polarization_change(S390CpuPolarization polarization)
visit_free(v);
qobject_unref(qmp);
}
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_events_machine_target_c;
diff --git a/build/qapi/qapi-init-commands.c b/build/qapi/qapi-init-commands.c
index 2148e704e27..0a1865a7a16 100644
--- a/build/qapi/qapi-init-commands.c
+++ b/build/qapi/qapi-init-commands.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi-commands.h"
#include "qapi-init-commands.h"
#include "qapi-features.h"
@@ -419,30 +420,30 @@ void qmp_init_marshal(QmpCommandList *cmds)
qmp_marshal_x_query_interrupt_controllers, 0, 1u << QAPI_FEATURE_UNSTABLE);
qmp_register_command(cmds, "dump-skeys",
qmp_marshal_dump_skeys, 0, 0);
-#if defined(TARGET_S390X)
+if (target_s390x()) {
qmp_register_command(cmds, "query-cpu-model-comparison",
qmp_marshal_query_cpu_model_comparison, 0, 0);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
+} /* (target_s390x()) */
+if (target_s390x()) {
qmp_register_command(cmds, "query-cpu-model-baseline",
qmp_marshal_query_cpu_model_baseline, 0, 0);
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
+} /* (target_s390x()) */
+if (target_s390x() || target_i386() || target_x86_64() || target_arm() || target_aarch64() || target_loongarch64() || target_riscv32() || target_riscv64()) {
qmp_register_command(cmds, "query-cpu-model-expansion",
qmp_marshal_query_cpu_model_expansion, 0, 0);
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
+} /* (target_s390x() || target_i386() || target_x86_64() || target_arm() || target_aarch64() || target_loongarch64() || target_riscv32() || target_riscv64()) */
+if (target_ppc() || target_ppc64() || target_arm() || target_aarch64() || target_i386() || target_x86_64() || target_s390x() || target_mips() || target_mips64() || target_loongarch64() || target_riscv32() || target_riscv64()) {
qmp_register_command(cmds, "query-cpu-definitions",
qmp_marshal_query_cpu_definitions, 0, 0);
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
+} /* (target_ppc() || target_ppc64() || target_arm() || target_aarch64() || target_i386() || target_x86_64() || target_s390x() || target_mips() || target_mips64() || target_loongarch64() || target_riscv32() || target_riscv64()) */
+if (target_s390x() && target_has_kvm()) {
qmp_register_command(cmds, "set-cpu-topology",
qmp_marshal_set_cpu_topology, 0, 1u << QAPI_FEATURE_UNSTABLE);
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
+} /* (target_s390x() && target_has_kvm()) */
+if (target_s390x() && target_has_kvm()) {
qmp_register_command(cmds, "query-s390x-cpu-polarization",
qmp_marshal_query_s390x_cpu_polarization, 0, 1u << QAPI_FEATURE_UNSTABLE);
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
+} /* (target_s390x() && target_has_kvm()) */
qmp_register_command(cmds, "query-replay",
qmp_marshal_query_replay, 0, 0);
qmp_register_command(cmds, "replay-break",
@@ -487,50 +488,50 @@ void qmp_init_marshal(QmpCommandList *cmds)
qmp_marshal_query_fdsets, 0, 0);
qmp_register_command(cmds, "query-command-line-options",
qmp_marshal_query_command_line_options, QCO_ALLOW_PRECONFIG, 0);
-#if defined(TARGET_I386)
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "rtc-reset-reinjection",
qmp_marshal_rtc_reset_reinjection, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
+} /* (target_i386() || target_x86_64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "query-sev",
qmp_marshal_query_sev, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
+} /* (target_i386() || target_x86_64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "query-sev-launch-measure",
qmp_marshal_query_sev_launch_measure, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
+} /* (target_i386() || target_x86_64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "query-sev-capabilities",
qmp_marshal_query_sev_capabilities, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
+} /* (target_i386() || target_x86_64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "sev-inject-launch-secret",
qmp_marshal_sev_inject_launch_secret, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
+} /* (target_i386() || target_x86_64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "query-sev-attestation-report",
qmp_marshal_query_sev_attestation_report, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
+} /* (target_i386() || target_x86_64()) */
+if (target_arm() || target_aarch64()) {
qmp_register_command(cmds, "query-gic-capabilities",
qmp_marshal_query_gic_capabilities, 0, 0);
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_I386)
+} /* (target_arm() || target_aarch64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "query-sgx",
qmp_marshal_query_sgx, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
+} /* (target_i386() || target_x86_64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "query-sgx-capabilities",
qmp_marshal_query_sgx_capabilities, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
+} /* (target_i386() || target_x86_64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "xen-event-list",
qmp_marshal_xen_event_list, 0, 0);
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
+} /* (target_i386() || target_x86_64()) */
+if (target_i386() || target_x86_64()) {
qmp_register_command(cmds, "xen-event-inject",
qmp_marshal_xen_event_inject, 0, 0);
-#endif /* defined(TARGET_I386) */
+} /* (target_i386() || target_x86_64()) */
qmp_register_command(cmds, "query-audiodevs",
qmp_marshal_query_audiodevs, 0, 0);
qmp_register_command(cmds, "query-acpi-ospm-status",
diff --git a/build/qapi/qapi-introspect.c b/build/qapi/qapi-introspect.c
index 6f7aad0c0a5..71ffb9d420a 100644
--- a/build/qapi/qapi-introspect.c
+++ b/build/qapi/qapi-introspect.c
@@ -10,9 +10,11 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi-introspect.h"
-const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
+QObject *qmp_schema_qobject(void) {
+ const QLitObject res = QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
@@ -1742,44 +1744,35 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "ret-type", QLIT_QSTR("0"), },
{}
})),
-#if defined(TARGET_S390X)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("221"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-cpu-model-comparison"), },
{ "ret-type", QLIT_QSTR("222"), },
{}
- })),
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_s390x()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("223"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-cpu-model-baseline"), },
{ "ret-type", QLIT_QSTR("224"), },
{}
- })),
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_s390x()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("225"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-cpu-model-expansion"), },
{ "ret-type", QLIT_QSTR("226"), },
{}
- })),
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_s390x() || target_i386() || target_x86_64() || target_arm() || target_aarch64() || target_loongarch64() || target_riscv32() || target_riscv64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-cpu-definitions"), },
{ "ret-type", QLIT_QSTR("[227]"), },
{}
- })),
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_ppc() || target_ppc64() || target_arm() || target_aarch64() || target_i386() || target_x86_64() || target_s390x() || target_mips() || target_mips64() || target_loongarch64() || target_riscv32() || target_riscv64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("228"), },
{ "features", QLIT_QLIST(((QLitObject[]) {
QLIT_QSTR("unstable"),
@@ -1789,10 +1782,8 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "name", QLIT_QSTR("set-cpu-topology"), },
{ "ret-type", QLIT_QSTR("0"), },
{}
- })),
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_s390x() && target_has_kvm()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("229"), },
{ "features", QLIT_QLIST(((QLitObject[]) {
QLIT_QSTR("unstable"),
@@ -1801,10 +1792,8 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("event"), },
{ "name", QLIT_QSTR("CPU_POLARIZATION_CHANGE"), },
{}
- })),
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_s390x() && target_has_kvm()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "features", QLIT_QLIST(((QLitObject[]) {
QLIT_QSTR("unstable"),
@@ -1814,8 +1803,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "name", QLIT_QSTR("query-s390x-cpu-polarization"), },
{ "ret-type", QLIT_QSTR("230"), },
{}
- })),
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
+ }), (!(target_s390x() && target_has_kvm()))),
QLIT_QDICT(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
@@ -1982,105 +1970,83 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "name", QLIT_QSTR("VFU_CLIENT_HANGUP"), },
{}
})),
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("rtc-reset-reinjection"), },
{ "ret-type", QLIT_QSTR("0"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-sev"), },
{ "ret-type", QLIT_QSTR("251"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-sev-launch-measure"), },
{ "ret-type", QLIT_QSTR("252"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-sev-capabilities"), },
{ "ret-type", QLIT_QSTR("253"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("254"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("sev-inject-launch-secret"), },
{ "ret-type", QLIT_QSTR("0"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("255"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-sev-attestation-report"), },
{ "ret-type", QLIT_QSTR("256"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-gic-capabilities"), },
{ "ret-type", QLIT_QSTR("[257]"), },
{}
- })),
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_arm() || target_aarch64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-sgx"), },
{ "ret-type", QLIT_QSTR("258"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("query-sgx-capabilities"), },
{ "ret-type", QLIT_QSTR("258"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("xen-event-list"), },
{ "ret-type", QLIT_QSTR("[259]"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("260"), },
{ "meta-type", QLIT_QSTR("command"), },
{ "name", QLIT_QSTR("xen-event-inject"), },
{ "ret-type", QLIT_QSTR("0"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
QLIT_QDICT(((QLitDictEntry[]) {
{ "arg-type", QLIT_QSTR("0"), },
{ "meta-type", QLIT_QSTR("command"), },
@@ -10010,8 +9976,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})),
/* "221" = q_obj_query-cpu-model-comparison-arg */
-#if defined(TARGET_S390X)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("modela"), },
@@ -10028,11 +9993,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("221"), },
{}
- })),
-#endif /* defined(TARGET_S390X) */
+ }), (!(target_s390x()))),
/* "222" = CpuModelCompareInfo */
-#if defined(TARGET_S390X)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("result"), },
@@ -10049,11 +10012,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("222"), },
{}
- })),
-#endif /* defined(TARGET_S390X) */
+ }), (!(target_s390x()))),
/* "223" = q_obj_query-cpu-model-baseline-arg */
-#if defined(TARGET_S390X)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("modela"), },
@@ -10070,11 +10031,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("223"), },
{}
- })),
-#endif /* defined(TARGET_S390X) */
+ }), (!(target_s390x()))),
/* "224" = CpuModelBaselineInfo */
-#if defined(TARGET_S390X)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("model"), },
@@ -10086,11 +10045,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("224"), },
{}
- })),
-#endif /* defined(TARGET_S390X) */
+ }), (!(target_s390x()))),
/* "225" = q_obj_query-cpu-model-expansion-arg */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("type"), },
@@ -10107,42 +10064,34 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("225"), },
{}
- })),
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
+ }), (!(target_s390x() || target_i386() || target_x86_64() || target_arm() || target_aarch64() || target_loongarch64() || target_riscv32() || target_riscv64()))),
/* "226" = CpuModelExpansionInfo */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("model"), },
{ "type", QLIT_QSTR("524"), },
{}
})),
-#if defined(TARGET_S390X)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("deprecated-props"), },
{ "type", QLIT_QSTR("[str]"), },
{}
- })),
-#endif /* defined(TARGET_S390X) */
+ }), (!(target_s390x()))),
{}
})), },
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("226"), },
{}
- })),
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_s390x() || target_i386() || target_x86_64() || target_arm() || target_aarch64() || target_loongarch64() || target_riscv32() || target_riscv64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "element-type", QLIT_QSTR("227"), },
{ "meta-type", QLIT_QSTR("array"), },
{ "name", QLIT_QSTR("[227]"), },
{}
- })),
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
+ }), (!(target_ppc() || target_ppc64() || target_arm() || target_aarch64() || target_i386() || target_x86_64() || target_s390x() || target_mips() || target_mips64() || target_loongarch64() || target_riscv32() || target_riscv64()))),
/* "227" = CpuDefinitionInfo */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("name"), },
@@ -10187,11 +10136,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("227"), },
{}
- })),
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
+ }), (!(target_ppc() || target_ppc64() || target_arm() || target_aarch64() || target_i386() || target_x86_64() || target_s390x() || target_mips() || target_mips64() || target_loongarch64() || target_riscv32() || target_riscv64()))),
/* "228" = q_obj_set-cpu-topology-arg */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("core-id"), },
@@ -10233,11 +10180,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("228"), },
{}
- })),
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
+ }), (!(target_s390x() && target_has_kvm()))),
/* "229" = q_obj_CPU_POLARIZATION_CHANGE-arg */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("polarization"), },
@@ -10249,11 +10194,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("229"), },
{}
- })),
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
+ }), (!(target_s390x() && target_has_kvm()))),
/* "230" = CpuPolarizationInfo */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("polarization"), },
@@ -10265,8 +10208,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("230"), },
{}
- })),
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
+ }), (!(target_s390x() && target_has_kvm()))),
/* "231" = ReplayInfo */
QLIT_QDICT(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
@@ -10709,8 +10651,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})),
/* "251" = SevInfo */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("enabled"), },
@@ -10761,11 +10702,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "252" = SevLaunchMeasureInfo */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("data"), },
@@ -10777,11 +10716,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("252"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "253" = SevCapability */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("pdh"), },
@@ -10813,11 +10750,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("253"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "254" = q_obj_sev-inject-launch-secret-arg */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("packet-header"), },
@@ -10840,11 +10775,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("254"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "255" = q_obj_query-sev-attestation-report-arg */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("mnonce"), },
@@ -10856,11 +10789,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("255"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "256" = SevAttestationReport */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("data"), },
@@ -10872,19 +10803,15 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("256"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "element-type", QLIT_QSTR("257"), },
{ "meta-type", QLIT_QSTR("array"), },
{ "name", QLIT_QSTR("[257]"), },
{}
- })),
-#endif /* defined(TARGET_ARM) */
+ }), (!(target_arm() || target_aarch64()))),
/* "257" = GICCapability */
-#if defined(TARGET_ARM)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("version"), },
@@ -10906,11 +10833,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("257"), },
{}
- })),
-#endif /* defined(TARGET_ARM) */
+ }), (!(target_arm() || target_aarch64()))),
/* "258" = SGXInfo */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("sgx"), },
@@ -10942,19 +10867,15 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("258"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ }), (!(target_i386() || target_x86_64()))),
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "element-type", QLIT_QSTR("259"), },
{ "meta-type", QLIT_QSTR("array"), },
{ "name", QLIT_QSTR("[259]"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "259" = EvtchnInfo */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("port"), },
@@ -10996,11 +10917,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("259"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "260" = q_obj_xen-event-inject-arg */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("port"), },
@@ -11012,8 +10931,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("260"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
QLIT_QDICT(((QLitDictEntry[]) {
{ "element-type", QLIT_QSTR("261"), },
{ "meta-type", QLIT_QSTR("array"), },
@@ -22774,8 +22692,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})),
/* "528" = S390CpuPolarization */
-#if defined(TARGET_S390X)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("horizontal"), },
@@ -22795,8 +22712,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})), },
{}
- })),
-#endif /* defined(TARGET_S390X) */
+ }), (!(target_s390x()))),
/* "529" = ReplayMode */
QLIT_QDICT(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
@@ -22943,8 +22859,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})),
/* "535" = SevState */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("uninit"), },
@@ -22984,11 +22899,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "536" = SevGuestType */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("sev"), },
@@ -23008,11 +22921,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "537" = SevGuestInfo */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("policy"), },
@@ -23029,11 +22940,9 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("537"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "538" = SevSnpGuestInfo */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("snp-policy"), },
@@ -23045,8 +22954,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{ "meta-type", QLIT_QSTR("object"), },
{ "name", QLIT_QSTR("538"), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
QLIT_QDICT(((QLitDictEntry[]) {
{ "element-type", QLIT_QSTR("539"), },
{ "meta-type", QLIT_QSTR("array"), },
@@ -23073,8 +22981,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})),
/* "540" = EvtchnPortType */
-#if defined(TARGET_I386)
- QLIT_QDICT(((QLitDictEntry[]) {
+ QLIT_QDICT_HIDDEN(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
QLIT_QDICT(((QLitDictEntry[]) {
{ "name", QLIT_QSTR("closed"), },
@@ -23114,8 +23021,7 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
{}
})), },
{}
- })),
-#endif /* defined(TARGET_I386) */
+ }), (!(target_i386() || target_x86_64()))),
/* "541" = AudiodevDriver */
QLIT_QDICT(((QLitDictEntry[]) {
{ "members", QLIT_QLIST(((QLitObject[]) {
@@ -32264,6 +32170,8 @@ const QLitObject qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
})),
{}
}));
+ return qobject_from_qlit(&res);
+}
/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_introspect_c;
diff --git a/build/qapi/qapi-types-machine-target.c b/build/qapi/qapi-types-machine-target.c
index d3d2c9e5d65..c8f7e6d2920 100644
--- a/build/qapi/qapi-types-machine-target.c
+++ b/build/qapi/qapi-types-machine-target.c
@@ -47,7 +47,6 @@ const QEnumLookup CpuModelCompareResult_lookup = {
.size = CPU_MODEL_COMPARE_RESULT__MAX
};
-#if defined(TARGET_S390X)
void qapi_free_CpuModelBaselineInfo(CpuModelBaselineInfo *obj)
{
Visitor *v;
@@ -60,9 +59,7 @@ void qapi_free_CpuModelBaselineInfo(CpuModelBaselineInfo *obj)
visit_type_CpuModelBaselineInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
void qapi_free_CpuModelCompareInfo(CpuModelCompareInfo *obj)
{
Visitor *v;
@@ -75,9 +72,7 @@ void qapi_free_CpuModelCompareInfo(CpuModelCompareInfo *obj)
visit_type_CpuModelCompareInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
void qapi_free_CpuModelExpansionInfo(CpuModelExpansionInfo *obj)
{
Visitor *v;
@@ -90,9 +85,7 @@ void qapi_free_CpuModelExpansionInfo(CpuModelExpansionInfo *obj)
visit_type_CpuModelExpansionInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
void qapi_free_CpuDefinitionInfo(CpuDefinitionInfo *obj)
{
Visitor *v;
@@ -105,9 +98,7 @@ void qapi_free_CpuDefinitionInfo(CpuDefinitionInfo *obj)
visit_type_CpuDefinitionInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
void qapi_free_CpuDefinitionInfoList(CpuDefinitionInfoList *obj)
{
Visitor *v;
@@ -120,9 +111,7 @@ void qapi_free_CpuDefinitionInfoList(CpuDefinitionInfoList *obj)
visit_type_CpuDefinitionInfoList(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X)
const QEnumLookup S390CpuPolarization_lookup = {
.array = (const char *const[]) {
[S390_CPU_POLARIZATION_HORIZONTAL] = "horizontal",
@@ -130,9 +119,7 @@ const QEnumLookup S390CpuPolarization_lookup = {
},
.size = S390_CPU_POLARIZATION__MAX
};
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
void qapi_free_CpuPolarizationInfo(CpuPolarizationInfo *obj)
{
Visitor *v;
@@ -145,7 +132,6 @@ void qapi_free_CpuPolarizationInfo(CpuPolarizationInfo *obj)
visit_type_CpuPolarizationInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_types_machine_target_c;
diff --git a/build/qapi/qapi-types-misc-target.c b/build/qapi/qapi-types-misc-target.c
index ed859f7d8fc..4e90fc28756 100644
--- a/build/qapi/qapi-types-misc-target.c
+++ b/build/qapi/qapi-types-misc-target.c
@@ -16,7 +16,6 @@
#include "qapi-visit-misc-target.h"
#include "qapi-features.h"
-#if defined(TARGET_I386)
const QEnumLookup SevState_lookup = {
.array = (const char *const[]) {
[SEV_STATE_UNINIT] = "uninit",
@@ -28,9 +27,7 @@ const QEnumLookup SevState_lookup = {
},
.size = SEV_STATE__MAX
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
const QEnumLookup SevGuestType_lookup = {
.array = (const char *const[]) {
[SEV_GUEST_TYPE_SEV] = "sev",
@@ -38,9 +35,7 @@ const QEnumLookup SevGuestType_lookup = {
},
.size = SEV_GUEST_TYPE__MAX
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevGuestInfo(SevGuestInfo *obj)
{
Visitor *v;
@@ -53,9 +48,7 @@ void qapi_free_SevGuestInfo(SevGuestInfo *obj)
visit_type_SevGuestInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevSnpGuestInfo(SevSnpGuestInfo *obj)
{
Visitor *v;
@@ -68,9 +61,7 @@ void qapi_free_SevSnpGuestInfo(SevSnpGuestInfo *obj)
visit_type_SevSnpGuestInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevInfo(SevInfo *obj)
{
Visitor *v;
@@ -83,9 +74,7 @@ void qapi_free_SevInfo(SevInfo *obj)
visit_type_SevInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevLaunchMeasureInfo(SevLaunchMeasureInfo *obj)
{
Visitor *v;
@@ -98,9 +87,7 @@ void qapi_free_SevLaunchMeasureInfo(SevLaunchMeasureInfo *obj)
visit_type_SevLaunchMeasureInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevCapability(SevCapability *obj)
{
Visitor *v;
@@ -113,9 +100,7 @@ void qapi_free_SevCapability(SevCapability *obj)
visit_type_SevCapability(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_SevAttestationReport(SevAttestationReport *obj)
{
Visitor *v;
@@ -128,9 +113,7 @@ void qapi_free_SevAttestationReport(SevAttestationReport *obj)
visit_type_SevAttestationReport(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
void qapi_free_GICCapability(GICCapability *obj)
{
Visitor *v;
@@ -143,9 +126,7 @@ void qapi_free_GICCapability(GICCapability *obj)
visit_type_GICCapability(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_ARM)
void qapi_free_GICCapabilityList(GICCapabilityList *obj)
{
Visitor *v;
@@ -158,7 +139,6 @@ void qapi_free_GICCapabilityList(GICCapabilityList *obj)
visit_type_GICCapabilityList(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_ARM) */
void qapi_free_SGXEPCSection(SGXEPCSection *obj)
{
@@ -186,7 +166,6 @@ void qapi_free_SGXEPCSectionList(SGXEPCSectionList *obj)
visit_free(v);
}
-#if defined(TARGET_I386)
void qapi_free_SGXInfo(SGXInfo *obj)
{
Visitor *v;
@@ -199,9 +178,7 @@ void qapi_free_SGXInfo(SGXInfo *obj)
visit_type_SGXInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
const QEnumLookup EvtchnPortType_lookup = {
.array = (const char *const[]) {
[EVTCHN_PORT_TYPE_CLOSED] = "closed",
@@ -213,9 +190,7 @@ const QEnumLookup EvtchnPortType_lookup = {
},
.size = EVTCHN_PORT_TYPE__MAX
};
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_EvtchnInfo(EvtchnInfo *obj)
{
Visitor *v;
@@ -228,9 +203,7 @@ void qapi_free_EvtchnInfo(EvtchnInfo *obj)
visit_type_EvtchnInfo(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
void qapi_free_EvtchnInfoList(EvtchnInfoList *obj)
{
Visitor *v;
@@ -243,7 +216,6 @@ void qapi_free_EvtchnInfoList(EvtchnInfoList *obj)
visit_type_EvtchnInfoList(v, NULL, &obj, NULL);
visit_free(v);
}
-#endif /* defined(TARGET_I386) */
/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_types_misc_target_c;
diff --git a/build/qapi/qapi-visit-acpi.c b/build/qapi/qapi-visit-acpi.c
index d84e825417b..78c816a6c2d 100644
--- a/build/qapi/qapi-visit-acpi.c
+++ b/build/qapi/qapi-visit-acpi.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-acpi.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-audio.c b/build/qapi/qapi-visit-audio.c
index a4dd2f16668..064358b66ea 100644
--- a/build/qapi/qapi-visit-audio.c
+++ b/build/qapi/qapi-visit-audio.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-audio.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-authz.c b/build/qapi/qapi-visit-authz.c
index de493708650..a858ef9aebf 100644
--- a/build/qapi/qapi-visit-authz.c
+++ b/build/qapi/qapi-visit-authz.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-authz.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-block-core.c b/build/qapi/qapi-visit-block-core.c
index 453e6e4a789..dbcfe09d7ff 100644
--- a/build/qapi/qapi-visit-block-core.c
+++ b/build/qapi/qapi-visit-block-core.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-block-core.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-block-export.c b/build/qapi/qapi-visit-block-export.c
index b746271f479..61fe484132f 100644
--- a/build/qapi/qapi-visit-block-export.c
+++ b/build/qapi/qapi-visit-block-export.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-block-export.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-block.c b/build/qapi/qapi-visit-block.c
index 37819714e5a..138aff1c32c 100644
--- a/build/qapi/qapi-visit-block.c
+++ b/build/qapi/qapi-visit-block.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-block.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-char.c b/build/qapi/qapi-visit-char.c
index c41648bf194..43aa49b3418 100644
--- a/build/qapi/qapi-visit-char.c
+++ b/build/qapi/qapi-visit-char.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-char.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-common.c b/build/qapi/qapi-visit-common.c
index 37688ec8429..18f09d3b846 100644
--- a/build/qapi/qapi-visit-common.c
+++ b/build/qapi/qapi-visit-common.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-common.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-compat.c b/build/qapi/qapi-visit-compat.c
index fdd47d422dd..858b15a9c1c 100644
--- a/build/qapi/qapi-visit-compat.c
+++ b/build/qapi/qapi-visit-compat.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-compat.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-control.c b/build/qapi/qapi-visit-control.c
index 5b298514772..4aff918cd39 100644
--- a/build/qapi/qapi-visit-control.c
+++ b/build/qapi/qapi-visit-control.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-control.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-crypto.c b/build/qapi/qapi-visit-crypto.c
index b0a98a0e8dc..5b61877593b 100644
--- a/build/qapi/qapi-visit-crypto.c
+++ b/build/qapi/qapi-visit-crypto.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-crypto.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-cryptodev.c b/build/qapi/qapi-visit-cryptodev.c
index efe60bcad23..c5dd74c6a94 100644
--- a/build/qapi/qapi-visit-cryptodev.c
+++ b/build/qapi/qapi-visit-cryptodev.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-cryptodev.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-cxl.c b/build/qapi/qapi-visit-cxl.c
index 9391f1cdc3e..e89a642e2cb 100644
--- a/build/qapi/qapi-visit-cxl.c
+++ b/build/qapi/qapi-visit-cxl.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-cxl.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-dump.c b/build/qapi/qapi-visit-dump.c
index 80aa6d900d4..858f6e670b6 100644
--- a/build/qapi/qapi-visit-dump.c
+++ b/build/qapi/qapi-visit-dump.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-dump.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-ebpf.c b/build/qapi/qapi-visit-ebpf.c
index 991643ed8c6..79a4983c933 100644
--- a/build/qapi/qapi-visit-ebpf.c
+++ b/build/qapi/qapi-visit-ebpf.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-ebpf.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-error.c b/build/qapi/qapi-visit-error.c
index 0df6770fa00..c9948d60448 100644
--- a/build/qapi/qapi-visit-error.c
+++ b/build/qapi/qapi-visit-error.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-error.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-introspect.c b/build/qapi/qapi-visit-introspect.c
index 7fe3350e91a..7b701b04bc0 100644
--- a/build/qapi/qapi-visit-introspect.c
+++ b/build/qapi/qapi-visit-introspect.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-introspect.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-job.c b/build/qapi/qapi-visit-job.c
index 22a14dc97ab..f8b6b59214c 100644
--- a/build/qapi/qapi-visit-job.c
+++ b/build/qapi/qapi-visit-job.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-job.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-machine-common.c b/build/qapi/qapi-visit-machine-common.c
index 3fd491682b0..b35a4df40da 100644
--- a/build/qapi/qapi-visit-machine-common.c
+++ b/build/qapi/qapi-visit-machine-common.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-machine-common.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-machine-target.c b/build/qapi/qapi-visit-machine-target.c
index e0b86544820..548c57958d6 100644
--- a/build/qapi/qapi-visit-machine-target.c
+++ b/build/qapi/qapi-visit-machine-target.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-machine-target.h"
#include "qapi-features.h"
@@ -75,7 +76,6 @@ bool visit_type_CpuModelCompareResult(Visitor *v, const char *name,
return ok;
}
-#if defined(TARGET_S390X)
bool visit_type_CpuModelBaselineInfo_members(Visitor *v, CpuModelBaselineInfo *obj, Error **errp)
{
if (!visit_type_CpuModelInfo(v, "model", &obj->model, errp)) {
@@ -110,9 +110,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
bool visit_type_CpuModelCompareInfo_members(Visitor *v, CpuModelCompareInfo *obj, Error **errp)
{
if (!visit_type_CpuModelCompareResult(v, "result", &obj->result, errp)) {
@@ -150,9 +148,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
bool visit_type_q_obj_query_cpu_model_comparison_arg_members(Visitor *v, q_obj_query_cpu_model_comparison_arg *obj, Error **errp)
{
if (!visit_type_CpuModelInfo(v, "modela", &obj->modela, errp)) {
@@ -163,9 +159,7 @@ bool visit_type_q_obj_query_cpu_model_comparison_arg_members(Visitor *v, q_obj_q
}
return true;
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X)
bool visit_type_q_obj_query_cpu_model_baseline_arg_members(Visitor *v, q_obj_query_cpu_model_baseline_arg *obj, Error **errp)
{
if (!visit_type_CpuModelInfo(v, "modela", &obj->modela, errp)) {
@@ -176,19 +170,17 @@ bool visit_type_q_obj_query_cpu_model_baseline_arg_members(Visitor *v, q_obj_que
}
return true;
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
bool visit_type_CpuModelExpansionInfo_members(Visitor *v, CpuModelExpansionInfo *obj, Error **errp)
{
if (!visit_type_CpuModelInfo(v, "model", &obj->model, errp)) {
return false;
}
-#if defined(TARGET_S390X)
+if (target_s390x()) {
if (!visit_type_strList(v, "deprecated-props", &obj->deprecated_props, errp)) {
return false;
}
-#endif /* defined(TARGET_S390X) */
+} /* (target_s390x()) */
return true;
}
@@ -218,9 +210,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
bool visit_type_q_obj_query_cpu_model_expansion_arg_members(Visitor *v, q_obj_query_cpu_model_expansion_arg *obj, Error **errp)
{
if (!visit_type_CpuModelExpansionType(v, "type", &obj->type, errp)) {
@@ -231,9 +221,7 @@ bool visit_type_q_obj_query_cpu_model_expansion_arg_members(Visitor *v, q_obj_qu
}
return true;
}
-#endif /* defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
bool visit_type_CpuDefinitionInfo_members(Visitor *v, CpuDefinitionInfo *obj, Error **errp)
{
bool has_alias_of = !!obj->alias_of;
@@ -294,9 +282,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV)
bool visit_type_CpuDefinitionInfoList(Visitor *v, const char *name,
CpuDefinitionInfoList **obj, Error **errp)
{
@@ -324,9 +310,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */
-#if defined(TARGET_S390X)
bool visit_type_S390CpuPolarization(Visitor *v, const char *name,
S390CpuPolarization *obj, Error **errp)
{
@@ -335,9 +319,7 @@ bool visit_type_S390CpuPolarization(Visitor *v, const char *name,
*obj = value;
return ok;
}
-#endif /* defined(TARGET_S390X) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
bool visit_type_q_obj_set_cpu_topology_arg_members(Visitor *v, q_obj_set_cpu_topology_arg *obj, Error **errp)
{
if (!visit_type_uint16(v, "core-id", &obj->core_id, errp)) {
@@ -370,9 +352,7 @@ bool visit_type_q_obj_set_cpu_topology_arg_members(Visitor *v, q_obj_set_cpu_top
}
return true;
}
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
bool visit_type_q_obj_CPU_POLARIZATION_CHANGE_arg_members(Visitor *v, q_obj_CPU_POLARIZATION_CHANGE_arg *obj, Error **errp)
{
if (!visit_type_S390CpuPolarization(v, "polarization", &obj->polarization, errp)) {
@@ -380,9 +360,7 @@ bool visit_type_q_obj_CPU_POLARIZATION_CHANGE_arg_members(Visitor *v, q_obj_CPU_
}
return true;
}
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
bool visit_type_CpuPolarizationInfo_members(Visitor *v, CpuPolarizationInfo *obj, Error **errp)
{
if (!visit_type_S390CpuPolarization(v, "polarization", &obj->polarization, errp)) {
@@ -417,7 +395,6 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_S390X) && defined(CONFIG_KVM) */
/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_visit_machine_target_c;
diff --git a/build/qapi/qapi-visit-machine.c b/build/qapi/qapi-visit-machine.c
index 4c70e99c9d1..60be8b9a1ec 100644
--- a/build/qapi/qapi-visit-machine.c
+++ b/build/qapi/qapi-visit-machine.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-machine.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-migration.c b/build/qapi/qapi-visit-migration.c
index a03b6551667..403104cc48b 100644
--- a/build/qapi/qapi-visit-migration.c
+++ b/build/qapi/qapi-visit-migration.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-migration.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-misc-target.c b/build/qapi/qapi-visit-misc-target.c
index e7b895a8e6d..395de1faa05 100644
--- a/build/qapi/qapi-visit-misc-target.c
+++ b/build/qapi/qapi-visit-misc-target.c
@@ -11,11 +11,11 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-misc-target.h"
#include "qapi-features.h"
-#if defined(TARGET_I386)
bool visit_type_SevState(Visitor *v, const char *name,
SevState *obj, Error **errp)
{
@@ -24,9 +24,7 @@ bool visit_type_SevState(Visitor *v, const char *name,
*obj = value;
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevGuestType(Visitor *v, const char *name,
SevGuestType *obj, Error **errp)
{
@@ -35,9 +33,7 @@ bool visit_type_SevGuestType(Visitor *v, const char *name,
*obj = value;
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevGuestInfo_members(Visitor *v, SevGuestInfo *obj, Error **errp)
{
if (!visit_type_uint32(v, "policy", &obj->policy, errp)) {
@@ -75,9 +71,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevSnpGuestInfo_members(Visitor *v, SevSnpGuestInfo *obj, Error **errp)
{
if (!visit_type_uint64(v, "snp-policy", &obj->snp_policy, errp)) {
@@ -112,9 +106,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_q_obj_SevInfo_base_members(Visitor *v, q_obj_SevInfo_base *obj, Error **errp)
{
if (!visit_type_bool(v, "enabled", &obj->enabled, errp)) {
@@ -137,9 +129,7 @@ bool visit_type_q_obj_SevInfo_base_members(Visitor *v, q_obj_SevInfo_base *obj,
}
return true;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevInfo_members(Visitor *v, SevInfo *obj, Error **errp)
{
if (!visit_type_q_obj_SevInfo_base_members(v, (q_obj_SevInfo_base *)obj, errp)) {
@@ -182,9 +172,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevLaunchMeasureInfo_members(Visitor *v, SevLaunchMeasureInfo *obj, Error **errp)
{
if (!visit_type_str(v, "data", &obj->data, errp)) {
@@ -219,9 +207,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevCapability_members(Visitor *v, SevCapability *obj, Error **errp)
{
if (!visit_type_str(v, "pdh", &obj->pdh, errp)) {
@@ -268,9 +254,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_q_obj_sev_inject_launch_secret_arg_members(Visitor *v, q_obj_sev_inject_launch_secret_arg *obj, Error **errp)
{
if (!visit_type_str(v, "packet-header", &obj->packet_header, errp)) {
@@ -286,9 +270,7 @@ bool visit_type_q_obj_sev_inject_launch_secret_arg_members(Visitor *v, q_obj_sev
}
return true;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_SevAttestationReport_members(Visitor *v, SevAttestationReport *obj, Error **errp)
{
if (!visit_type_str(v, "data", &obj->data, errp)) {
@@ -323,9 +305,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_q_obj_query_sev_attestation_report_arg_members(Visitor *v, q_obj_query_sev_attestation_report_arg *obj, Error **errp)
{
if (!visit_type_str(v, "mnonce", &obj->mnonce, errp)) {
@@ -333,9 +313,7 @@ bool visit_type_q_obj_query_sev_attestation_report_arg_members(Visitor *v, q_obj
}
return true;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_ARM)
bool visit_type_GICCapability_members(Visitor *v, GICCapability *obj, Error **errp)
{
if (!visit_type_int(v, "version", &obj->version, errp)) {
@@ -376,9 +354,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_ARM) */
-#if defined(TARGET_ARM)
bool visit_type_GICCapabilityList(Visitor *v, const char *name,
GICCapabilityList **obj, Error **errp)
{
@@ -406,7 +382,6 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_ARM) */
bool visit_type_SGXEPCSection_members(Visitor *v, SGXEPCSection *obj, Error **errp)
{
@@ -474,7 +449,6 @@ out_obj:
return ok;
}
-#if defined(TARGET_I386)
bool visit_type_SGXInfo_members(Visitor *v, SGXInfo *obj, Error **errp)
{
if (!visit_type_bool(v, "sgx", &obj->sgx, errp)) {
@@ -521,9 +495,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_EvtchnPortType(Visitor *v, const char *name,
EvtchnPortType *obj, Error **errp)
{
@@ -532,9 +504,7 @@ bool visit_type_EvtchnPortType(Visitor *v, const char *name,
*obj = value;
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_EvtchnInfo_members(Visitor *v, EvtchnInfo *obj, Error **errp)
{
if (!visit_type_uint16(v, "port", &obj->port, errp)) {
@@ -587,9 +557,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_EvtchnInfoList(Visitor *v, const char *name,
EvtchnInfoList **obj, Error **errp)
{
@@ -617,9 +585,7 @@ out_obj:
}
return ok;
}
-#endif /* defined(TARGET_I386) */
-#if defined(TARGET_I386)
bool visit_type_q_obj_xen_event_inject_arg_members(Visitor *v, q_obj_xen_event_inject_arg *obj, Error **errp)
{
if (!visit_type_uint32(v, "port", &obj->port, errp)) {
@@ -627,7 +593,6 @@ bool visit_type_q_obj_xen_event_inject_arg_members(Visitor *v, q_obj_xen_event_i
}
return true;
}
-#endif /* defined(TARGET_I386) */
/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_visit_misc_target_c;
diff --git a/build/qapi/qapi-visit-misc.c b/build/qapi/qapi-visit-misc.c
index 09b14915147..f1b7344a8cf 100644
--- a/build/qapi/qapi-visit-misc.c
+++ b/build/qapi/qapi-visit-misc.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-misc.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-net.c b/build/qapi/qapi-visit-net.c
index dfa997909b9..ed46cb8f46e 100644
--- a/build/qapi/qapi-visit-net.c
+++ b/build/qapi/qapi-visit-net.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-net.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-pci.c b/build/qapi/qapi-visit-pci.c
index 9b25a684b8c..371f750858e 100644
--- a/build/qapi/qapi-visit-pci.c
+++ b/build/qapi/qapi-visit-pci.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-pci.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-pragma.c b/build/qapi/qapi-visit-pragma.c
index 9e88b232d6f..12e616f946e 100644
--- a/build/qapi/qapi-visit-pragma.c
+++ b/build/qapi/qapi-visit-pragma.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-pragma.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-qdev.c b/build/qapi/qapi-visit-qdev.c
index 5b456eceed8..391dfd00b3d 100644
--- a/build/qapi/qapi-visit-qdev.c
+++ b/build/qapi/qapi-visit-qdev.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-qdev.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-qom.c b/build/qapi/qapi-visit-qom.c
index 9b9b595c061..591763a9ab7 100644
--- a/build/qapi/qapi-visit-qom.c
+++ b/build/qapi/qapi-visit-qom.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-qom.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-replay.c b/build/qapi/qapi-visit-replay.c
index da6de7e30a9..78913d5d3ed 100644
--- a/build/qapi/qapi-visit-replay.c
+++ b/build/qapi/qapi-visit-replay.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-replay.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-rocker.c b/build/qapi/qapi-visit-rocker.c
index bccef3f1d57..30cfe22f221 100644
--- a/build/qapi/qapi-visit-rocker.c
+++ b/build/qapi/qapi-visit-rocker.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-rocker.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-run-state.c b/build/qapi/qapi-visit-run-state.c
index 22569fb84dc..0c6578c35dc 100644
--- a/build/qapi/qapi-visit-run-state.c
+++ b/build/qapi/qapi-visit-run-state.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-run-state.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-sockets.c b/build/qapi/qapi-visit-sockets.c
index 90e339f3615..c3aad4b24a3 100644
--- a/build/qapi/qapi-visit-sockets.c
+++ b/build/qapi/qapi-visit-sockets.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-sockets.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-stats.c b/build/qapi/qapi-visit-stats.c
index 3722c2ca43d..fa8b36df0da 100644
--- a/build/qapi/qapi-visit-stats.c
+++ b/build/qapi/qapi-visit-stats.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-stats.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-tpm.c b/build/qapi/qapi-visit-tpm.c
index 209f71c461c..89f81e374cc 100644
--- a/build/qapi/qapi-visit-tpm.c
+++ b/build/qapi/qapi-visit-tpm.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-tpm.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-trace.c b/build/qapi/qapi-visit-trace.c
index 393af1ed7e7..0e158ed4bad 100644
--- a/build/qapi/qapi-visit-trace.c
+++ b/build/qapi/qapi-visit-trace.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-trace.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-transaction.c b/build/qapi/qapi-visit-transaction.c
index 04ca76ff8d7..32b2e720bcd 100644
--- a/build/qapi/qapi-visit-transaction.c
+++ b/build/qapi/qapi-visit-transaction.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-transaction.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-uefi.c b/build/qapi/qapi-visit-uefi.c
index 7743183b045..b2869b58ed4 100644
--- a/build/qapi/qapi-visit-uefi.c
+++ b/build/qapi/qapi-visit-uefi.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-uefi.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-ui.c b/build/qapi/qapi-visit-ui.c
index 88cadba2644..170428b2919 100644
--- a/build/qapi/qapi-visit-ui.c
+++ b/build/qapi/qapi-visit-ui.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-ui.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-vfio.c b/build/qapi/qapi-visit-vfio.c
index 41a05e57c7b..12c4116e0cf 100644
--- a/build/qapi/qapi-visit-vfio.c
+++ b/build/qapi/qapi-visit-vfio.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-vfio.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-virtio.c b/build/qapi/qapi-visit-virtio.c
index 0b3b314f0e3..ed83afd1b76 100644
--- a/build/qapi/qapi-visit-virtio.c
+++ b/build/qapi/qapi-visit-virtio.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-virtio.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit-yank.c b/build/qapi/qapi-visit-yank.c
index 547c94de5ff..4b0d3864a3c 100644
--- a/build/qapi/qapi-visit-yank.c
+++ b/build/qapi/qapi-visit-yank.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit-yank.h"
#include "qapi-features.h"
diff --git a/build/qapi/qapi-visit.c b/build/qapi/qapi-visit.c
index 4fbbc419ea4..69438643a42 100644
--- a/build/qapi/qapi-visit.c
+++ b/build/qapi/qapi-visit.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target-info.h"
#include "qapi/error.h"
#include "qapi-visit.h"
#include "qapi-features.h"
--
2.47.2
^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCH 00/13] single-binary: make QAPI generated files common
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
` (11 preceding siblings ...)
2025-05-07 23:14 ` [PATCH 13/13] [ANNEX] build/qapi: after series Pierrick Bouvier
@ 2025-05-07 23:33 ` Pierrick Bouvier
12 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-07 23:33 UTC (permalink / raw)
To: qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, philmd, berrange, thuth,
Michael Roth
For people who would be interested to try this series, I used attached
script.
$ ./qmp_schema.sh ./build/qemu-system-x86_64 -M none > x86_64
$ ./qmp_schema.sh ./build/qemu-system-s390x -M none > s390x
$ vimdiff x86_64 s390x
----
diff --git a/qmp_schema.sh b/qmp_schema.sh
new file mode 100755
index 00000000000..576f7d71dfd
--- /dev/null
+++ b/qmp_schema.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+if [ $# -lt 1 ]; then
+ echo 'usage: qemu_cmd' 1>&2
+ exit 1
+fi
+
+qemu_cmd=$*
+
+$qemu_cmd \
+-display none \
+-qmp unix:qmp-socket,server \
+&
+
+qemu_pid=$!
+
+sleep 1
+
+qmp_session()
+{
+ cat << EOF
+ { "execute": "qmp_capabilities" }
+ { "execute": "query-qmp-schema" }
+ { "execute": "query-cpu-model-expansion",
+ "arguments": { "type": "full", "model": { "name": "max" } } }
+EOF
+}
+
+qmp_session | socat - unix-connect:qmp-socket | jq
+kill $qemu_pid
^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCH 08/13] qemu/target-info: implement missing helpers
2025-05-07 23:14 ` [PATCH 08/13] qemu/target-info: implement missing helpers Pierrick Bouvier
@ 2025-05-08 6:40 ` Philippe Mathieu-Daudé
2025-05-08 20:30 ` Pierrick Bouvier
0 siblings, 1 reply; 37+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-08 6:40 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 8/5/25 01:14, Pierrick Bouvier wrote:
> Add runtime helpers for target and config queries.
>
> Note: This will be reimplemented later [1] using proper information in
> TargetInfo. Meanwhile, just add a simple implementation.
>
> [1] https://patchew.org/QEMU/20250424222112.36194-1-philmd@linaro.org/20250424222112.36194-19-philmd@linaro.org/
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> meson.build | 2 +-
> include/qemu/target-info.h | 14 +++++
> target-info.c | 117 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 132 insertions(+), 1 deletion(-)
> +bool target_mips(void)
I know this is the same lowercase name, but maybe we could consider
directly using target_mips32() instead of keeping the technical debt
of having TARGET_MIPS defined for both 32 and 64-bit targets.
Thankfully we cleared that with recent targets (i.e. LoongArch or
RISC-V -- AVR is a bit different, since 8-bit AVR and AVR32 are
distinct architectures).
For x86 we often use 'x86' as any of (i386, x86_64, amd64), maybe
we can introduce target_x86() too.
> +{
> +#ifdef TARGET_MIPS
> + return true;
> +#else
> + return false;
> +#endif
> +}
> +
> +bool target_mips64(void)
> +{
> +#ifdef TARGET_MIPS64
> + return true;
> +#else
> + return false;
> +#endif
> +}
> +
> +bool target_loongarch64(void)
> +{
> +#ifdef TARGET_LOONGARCH64
> + return true;
> +#else
> + return false;
> +#endif
> +}
> +
> +bool target_riscv32(void)
> +{
> +#ifdef TARGET_RISCV32
> + return true;
> +#else
> + return false;
> +#endif
> +}
> +
> +bool target_riscv64(void)
> +{
> +#ifdef TARGET_RISCV64
> + return true;
> +#else
> + return false;
> +#endif
> +}
> +
> +bool target_ppc(void)
Ditto, target_ppc32()?
> +{
> +#ifdef TARGET_PPC
> + return true;
> +#else
> + return false;
> +#endif
> +}
> +
> +bool target_ppc64(void)
> +{
> +#ifdef TARGET_ppc64
> + return true;
> +#else
> + return false;
> +#endif
> +}
> +
> +bool target_has_kvm(void)
> +{
> +#ifdef CONFIG_KVM
> + return true;
> +#else
> + return false;
> +#endif
> +}
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-07 23:14 ` [PATCH 09/13] qapi: transform target specific 'if' in runtime checks Pierrick Bouvier
@ 2025-05-08 6:44 ` Philippe Mathieu-Daudé
2025-05-08 14:40 ` Daniel P. Berrangé
2025-05-14 14:09 ` Markus Armbruster
2 siblings, 0 replies; 37+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-08 6:44 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 8/5/25 01:14, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/machine-target.json | 84 ++++++++++++++++++++++++----------------
> qapi/misc-target.json | 48 ++++++++++++-----------
> scripts/qapi/expr.py | 9 +++--
> 3 files changed, 81 insertions(+), 60 deletions(-)
> @@ -378,13 +384,18 @@
> 'typename': 'str',
> '*alias-of' : 'str',
> 'deprecated' : 'bool' },
> - 'if': { 'any': [ 'TARGET_PPC',
> - 'TARGET_ARM',
> - 'TARGET_I386',
> - 'TARGET_S390X',
> - 'TARGET_MIPS',
> - 'TARGET_LOONGARCH64',
> - 'TARGET_RISCV' ] } }
> + 'runtime_if': { 'any': [ 'target_ppc()',
> + 'target_ppc64()',
> + 'target_arm()',
> + 'target_aarch64()',
> + 'target_i386()',
> + 'target_x86_64()',
> + 'target_s390x()',
> + 'target_mips()',
> + 'target_mips64()',
> + 'target_loongarch64()',
> + 'target_riscv32()',
> + 'target_riscv64()' ] } }
I'd keep target_riscv() for "any RISC-V".
target_arm() and target_aarch64() could be merged as
target_arm_based()?
> @@ -272,7 +272,7 @@
> { 'command': 'query-sev-attestation-report',
> 'data': { 'mnonce': 'str' },
> 'returns': 'SevAttestationReport',
> - 'if': 'TARGET_I386' }
> + 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
Suggested as target_x86().
>
> ##
> # @GICCapability:
> @@ -297,7 +297,7 @@
> 'data': { 'version': 'int',
> 'emulated': 'bool',
> 'kernel': 'bool' },
> - 'if': 'TARGET_ARM' }
> + 'runtime_if': { 'any': [ 'target_arm()', 'target_aarch64()' ] } }
Up to here:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
> index 5ae26395964..f31f28ecb10 100644
> --- a/scripts/qapi/expr.py
> +++ b/scripts/qapi/expr.py
> @@ -638,7 +638,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
>
> if meta == 'enum':
> check_keys(expr, info, meta,
> - ['enum', 'data'], ['if', 'features', 'prefix'])
> + ['enum', 'data'], ['if', 'runtime_if', 'features',
> + 'prefix'])
> check_enum(expr)
> elif meta == 'union':
> check_keys(expr, info, meta,
> @@ -654,7 +655,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
> check_alternate(expr)
> elif meta == 'struct':
> check_keys(expr, info, meta,
> - ['struct', 'data'], ['base', 'if', 'features'])
> + ['struct', 'data'], ['base', 'if', 'runtime_if',
> + 'features'])
> normalize_members(expr['data'])
> check_struct(expr)
> elif meta == 'command':
> @@ -667,7 +669,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
> check_command(expr)
> elif meta == 'event':
> check_keys(expr, info, meta,
> - ['event'], ['data', 'boxed', 'if', 'features'])
> + ['event'], ['data', 'boxed', 'if', 'runtime_if',
> + 'features'])
> normalize_members(expr.get('data'))
> check_event(expr)
> else:
Changes in scripts/qapi/expr.py seem to belong to a previous
patch (existing or not).
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json
2025-05-07 23:14 ` [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json Pierrick Bouvier
@ 2025-05-08 6:53 ` Philippe Mathieu-Daudé
2025-05-08 20:22 ` Pierrick Bouvier
2025-05-15 4:39 ` Markus Armbruster
1 sibling, 1 reply; 37+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-08 6:53 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 8/5/25 01:14, Pierrick Bouvier wrote:
> This new entry can be used in QAPI json to specify a runtime conditional
> to expose any entry, similar to existing 'if', that applies at compile
> time, thanks to ifdef. The element is always defined in C, but not
> exposed through the schema and visit functions, thus being hidden for a
> QMP consumer.
>
> QAPISchemaIfCond is extended to parse this information. A first version
> was tried duplicating this, but this proved to be much more boilerplate
> than needed to pass information through all function calls.
>
> 'if' and 'runtime_if' can be combined elegantly on a single item,
> allowing to restrict an element to be present based on compile time
> defines, and runtime checks at the same time.
>
> Note: This commit only adds parsing of runtime_if, and does not hide
> anything yet.
>
> For review:
>
> - I don't really like "runtime_if" name.
> What would make sense, IMHO, is to rename existing 'if' to 'ifdef',
> and reuse 'if' for 'runtime_if'. Since it requires invasive changes, I
> would prefer to get agreement before wasting time in case you prefer
> any other naming convention. Let me know what you'd like.
Or rename 'if' as 'buildtime_if'. /s!
>
> - As mentioned in second paragraph, I think our best implementation
> would be to extend existing QAPISchemaIfCond, as it's really
> complicated to extend all call sites if we have another new object.
>
> - No tests/doc added at this time, as I prefer to wait that we decide
> about naming and proposed approach first.
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> scripts/qapi/common.py | 16 +++++++++++-
> scripts/qapi/expr.py | 9 ++++---
> scripts/qapi/gen.py | 56 +++++++++++++++++++++++++++++++++++++++++-
> scripts/qapi/schema.py | 44 ++++++++++++++++++++++++---------
> 4 files changed, 107 insertions(+), 18 deletions(-)
>
> diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
> index d7c8aa3365c..0e8e2abeb58 100644
> --- a/scripts/qapi/common.py
> +++ b/scripts/qapi/common.py
> @@ -229,6 +229,8 @@ def gen_infix(operator: str, operands: Sequence[Any]) -> str:
> def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
> return gen_ifcond(ifcond, 'defined(%s)', '!%s', ' && ', ' || ')
>
> +def cgen_runtime_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
> + return gen_ifcond(ifcond, '%s', '!%s', ' && ', ' || ')
>
> def docgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
> # TODO Doc generated for conditions needs polish
> @@ -242,7 +244,6 @@ def gen_if(cond: str) -> str:
> #if %(cond)s
> ''', cond=cond)
>
> -
> def gen_endif(cond: str) -> str:
> if not cond:
> return ''
> @@ -250,6 +251,19 @@ def gen_endif(cond: str) -> str:
> #endif /* %(cond)s */
> ''', cond=cond)
>
> +def gen_runtime_if(cond: str) -> str:
> + if not cond:
> + return ''
> + return mcgen('''
> +if (%(cond)s) {
> +''', cond=cond)
> +
> +def gen_runtime_endif(cond: str) -> str:
> + if not cond:
> + return ''
> + return mcgen('''
> +} /* (%(cond)s) */
No need for extra parenthesis in comment:
+} /* %(cond)s */
> +''', cond=cond)
>
> def must_match(pattern: str, string: str) -> Match[str]:
> match = re.match(pattern, string)
> diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
> index cae0a083591..5ae26395964 100644
> --- a/scripts/qapi/expr.py
> +++ b/scripts/qapi/expr.py
> @@ -392,7 +392,8 @@ def check_type_implicit(value: Optional[object],
> permit_underscore=permissive)
> if c_name(key, False) == 'u' or c_name(key, False).startswith('has_'):
> raise QAPISemError(info, "%s uses reserved name" % key_source)
> - check_keys(arg, info, key_source, ['type'], ['if', 'features'])
> + check_keys(arg, info, key_source, ['type'], ['if', 'features',
> + 'runtime_if'])
> check_if(arg, info, key_source)
> check_features(arg.get('features'), info)
> check_type_name_or_array(arg['type'], info, key_source)
> @@ -642,7 +643,7 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
> elif meta == 'union':
> check_keys(expr, info, meta,
> ['union', 'base', 'discriminator', 'data'],
> - ['if', 'features'])
> + ['if', 'runtime_if', 'features'])
> normalize_members(expr.get('base'))
> normalize_members(expr['data'])
> check_union(expr)
> @@ -659,8 +660,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
> elif meta == 'command':
> check_keys(expr, info, meta,
> ['command'],
> - ['data', 'returns', 'boxed', 'if', 'features',
> - 'gen', 'success-response', 'allow-oob',
> + ['data', 'returns', 'boxed', 'if', 'runtime_if',
> + 'features', 'gen', 'success-response', 'allow-oob',
> 'allow-preconfig', 'coroutine'])
> normalize_members(expr.get('data'))
> check_command(expr)
Why can't we merge here the changes from patch 9?
-- >8 --
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 5ae26395964..f31f28ecb10 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -638,7 +638,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
if meta == 'enum':
check_keys(expr, info, meta,
- ['enum', 'data'], ['if', 'features', 'prefix'])
+ ['enum', 'data'], ['if', 'runtime_if', 'features',
+ 'prefix'])
check_enum(expr)
elif meta == 'union':
check_keys(expr, info, meta,
@@ -654,7 +655,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
check_alternate(expr)
elif meta == 'struct':
check_keys(expr, info, meta,
- ['struct', 'data'], ['base', 'if', 'features'])
+ ['struct', 'data'], ['base', 'if', 'runtime_if',
+ 'features'])
normalize_members(expr['data'])
check_struct(expr)
elif meta == 'command':
@@ -667,7 +669,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
check_command(expr)
elif meta == 'event':
check_keys(expr, info, meta,
- ['event'], ['data', 'boxed', 'if', 'features'])
+ ['event'], ['data', 'boxed', 'if', 'runtime_if',
+ 'features'])
normalize_members(expr.get('data'))
check_event(expr)
else:
---
Otherwise, patch LGTM :)
^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCH 10/13] qapi: add weak stubs for target specific commands
2025-05-07 23:14 ` [PATCH 10/13] qapi: add weak stubs for target specific commands Pierrick Bouvier
@ 2025-05-08 6:57 ` Philippe Mathieu-Daudé
2025-05-08 20:33 ` Pierrick Bouvier
0 siblings, 1 reply; 37+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-08 6:57 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 8/5/25 01:14, Pierrick Bouvier wrote:
> We are about to expose various target specific commands for all targets,
> so we need to stub not implemented qmp_* functions.
>
> MinGW does not support weak symbols without at least one strong
> definition, so we'll have to detail stubs per target. Sad.
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/commands-weak-stubs.c | 38 ++++++++++++++++++++++++++++++++++++++
> qapi/meson.build | 2 ++
> 2 files changed, 40 insertions(+)
> create mode 100644 qapi/commands-weak-stubs.c
>
> diff --git a/qapi/commands-weak-stubs.c b/qapi/commands-weak-stubs.c
> new file mode 100644
> index 00000000000..9734263c32e
> --- /dev/null
> +++ b/qapi/commands-weak-stubs.c
> @@ -0,0 +1,38 @@
> +/*
> + * Weak symbols for target specific commands
> + *
> + * Copyright Linaro, 2025
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
> + * See the COPYING.LIB file in the top-level directory.
> + *
> + */
> +
> +#include "qemu/osdep.h"
> +#include <glib.h>
> +
> +#define NOT_REACHABLE(symbol) \
> +void __attribute__((weak)) symbol(void); \
> +void __attribute__((weak)) symbol(void) { g_assert_not_reached(); }
> +
> +#define WEAK_STUB(command) \
> +NOT_REACHABLE(qmp_marshal_##command) \
> +NOT_REACHABLE(qmp_##command)
> +
> +WEAK_STUB(query_cpu_model_comparison);
> +WEAK_STUB(query_cpu_model_baseline);
> +WEAK_STUB(set_cpu_topology);
> +WEAK_STUB(query_s390x_cpu_polarization);
> +WEAK_STUB(rtc_reset_reinjection);
> +WEAK_STUB(query_sev);
> +WEAK_STUB(query_sev_launch_measure);
> +WEAK_STUB(query_sev_capabilities);
> +WEAK_STUB(sev_inject_launch_secret);
> +WEAK_STUB(query_sev_attestation_report);
> +WEAK_STUB(query_sgx);
> +WEAK_STUB(query_sgx_capabilities);
> +WEAK_STUB(xen_event_list);
> +WEAK_STUB(xen_event_inject);
> +WEAK_STUB(query_cpu_model_expansion);
> +WEAK_STUB(query_cpu_definitions);
> +WEAK_STUB(query_gic_capabilities);
Shouldn't this also be generated by QAPI scripts?
> diff --git a/qapi/meson.build b/qapi/meson.build
> index eadde4db307..60fc958ec10 100644
> --- a/qapi/meson.build
> +++ b/qapi/meson.build
> @@ -147,3 +147,5 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
> specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: qapi_files[i])
> i = i + 1
> endforeach
> +
> +system_ss.add(files('commands-weak-stubs.c'))
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 11/13] qapi: make all generated files common
2025-05-07 23:14 ` [PATCH 11/13] qapi: make all generated files common Pierrick Bouvier
@ 2025-05-08 6:57 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 37+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-08 6:57 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 8/5/25 01:14, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/meson.build | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 07/13] qapi: add access to qemu/target-info.h
2025-05-07 23:14 ` [PATCH 07/13] qapi: add access to qemu/target-info.h Pierrick Bouvier
@ 2025-05-08 6:57 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 37+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-08 6:57 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 8/5/25 01:14, Pierrick Bouvier wrote:
> Add a default include qemu/target-info.h in QAPI generated code. This
> allows runtime conditionals to use any function defined in this header.
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> scripts/qapi/commands.py | 2 ++
> scripts/qapi/introspect.py | 1 +
> scripts/qapi/visit.py | 2 ++
> 3 files changed, 5 insertions(+)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 03/13] qobject/qlit: allow to hide dict or list entries
2025-05-07 23:14 ` [PATCH 03/13] qobject/qlit: allow to hide dict or list entries Pierrick Bouvier
@ 2025-05-08 14:21 ` Daniel P. Berrangé
2025-05-08 20:25 ` Pierrick Bouvier
0 siblings, 1 reply; 37+ messages in thread
From: Daniel P. Berrangé @ 2025-05-08 14:21 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
thuth, Michael Roth
On Wed, May 07, 2025 at 04:14:33PM -0700, Pierrick Bouvier wrote:
> We add a new .hidden field to qlit entries, which gets ignored when
> creating the associated QObject.
> By default .hidden is 0, so it means the entry is visible. This way,
> only potentially hidden elements need to be assigned.
IMHO this feels like a somewhat dubious concept to have in the
qobject code, as it is quite specialized to a single use case.
A more general purpose approach would be to have some mechanism
for cloning while applying a data filter, though I admit that
may be more tedious to actually use.
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> include/qobject/qlit.h | 12 ++++++++++++
> qobject/qlit.c | 10 ++++++++--
> 2 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/include/qobject/qlit.h b/include/qobject/qlit.h
> index c0676d5daf2..3b66c22013c 100644
> --- a/include/qobject/qlit.h
> +++ b/include/qobject/qlit.h
> @@ -28,25 +28,37 @@ struct QLitObject {
> QLitDictEntry *qdict;
> QLitObject *qlist;
> } value;
> + bool hidden;
> };
>
> struct QLitDictEntry {
> const char *key;
> QLitObject value;
> + bool hidden;
> };
>
> #define QLIT_QNULL \
> { .type = QTYPE_QNULL }
> #define QLIT_QBOOL(val) \
> { .type = QTYPE_QBOOL, .value.qbool = (val) }
> +#define QLIT_QBOOL_HIDDEN(val, cond) \
> + { .type = QTYPE_QBOOL, .value.qbool = (val), .hidden = (cond) }
> #define QLIT_QNUM(val) \
> { .type = QTYPE_QNUM, .value.qnum = (val) }
> +#define QLIT_QNUM_HIDDEN(val, cond) \
> + { .type = QTYPE_QNUM, .value.qnum = (val), .hidden = (cond) }
> #define QLIT_QSTR(val) \
> { .type = QTYPE_QSTRING, .value.qstr = (val) }
> +#define QLIT_QSTR_HIDDEN(val, cond) \
> + { .type = QTYPE_QSTRING, .value.qstr = (val), .hidden = (cond) }
> #define QLIT_QDICT(val) \
> { .type = QTYPE_QDICT, .value.qdict = (val) }
> +#define QLIT_QDICT_HIDDEN(val, cond) \
> + { .type = QTYPE_QDICT, .value.qdict = (val), .hidden = (cond) }
> #define QLIT_QLIST(val) \
> { .type = QTYPE_QLIST, .value.qlist = (val) }
> +#define QLIT_QLIST_HIDDEN(val, cond) \
> + { .type = QTYPE_QLIST, .value.qlist = (val), .hidden = (cond) }
>
> bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs);
>
> diff --git a/qobject/qlit.c b/qobject/qlit.c
> index a44f47eaa57..7b372c5ebaa 100644
> --- a/qobject/qlit.c
> +++ b/qobject/qlit.c
> @@ -90,6 +90,8 @@ bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs)
>
> QObject *qobject_from_qlit(const QLitObject *qlit)
> {
> + g_assert(!qlit->hidden);
> +
> switch (qlit->type) {
> case QTYPE_QNULL:
> return QOBJECT(qnull());
> @@ -102,7 +104,9 @@ QObject *qobject_from_qlit(const QLitObject *qlit)
> QLitDictEntry *e;
>
> for (e = qlit->value.qdict; e->key; e++) {
> - qdict_put_obj(qdict, e->key, qobject_from_qlit(&e->value));
> + if (!e->hidden) {
> + qdict_put_obj(qdict, e->key, qobject_from_qlit(&e->value));
> + }
> }
> return QOBJECT(qdict);
> }
> @@ -111,7 +115,9 @@ QObject *qobject_from_qlit(const QLitObject *qlit)
> QLitObject *e;
>
> for (e = qlit->value.qlist; e->type != QTYPE_NONE; e++) {
> - qlist_append_obj(qlist, qobject_from_qlit(e));
> + if (!e->hidden) {
> + qlist_append_obj(qlist, qobject_from_qlit(e));
> + }
> }
> return QOBJECT(qlist);
> }
> --
> 2.47.2
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-07 23:14 ` [PATCH 09/13] qapi: transform target specific 'if' in runtime checks Pierrick Bouvier
2025-05-08 6:44 ` Philippe Mathieu-Daudé
@ 2025-05-08 14:40 ` Daniel P. Berrangé
2025-05-08 20:48 ` Pierrick Bouvier
2025-05-10 6:57 ` Markus Armbruster
2025-05-14 14:09 ` Markus Armbruster
2 siblings, 2 replies; 37+ messages in thread
From: Daniel P. Berrangé @ 2025-05-08 14:40 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
thuth, Michael Roth
On Wed, May 07, 2025 at 04:14:39PM -0700, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/machine-target.json | 84 ++++++++++++++++++++++++----------------
> qapi/misc-target.json | 48 ++++++++++++-----------
> scripts/qapi/expr.py | 9 +++--
> 3 files changed, 81 insertions(+), 60 deletions(-)
>
> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
> index 541f93eeb78..6174b7291ca 100644
> --- a/qapi/machine-target.json
> +++ b/qapi/machine-target.json
> @@ -96,7 +96,7 @@
> ##
> { 'struct': 'CpuModelBaselineInfo',
> 'data': { 'model': 'CpuModelInfo' },
> - 'if': 'TARGET_S390X' }
> + 'runtime_if': 'target_s390x()' }
The existing 'if' conditions are already slightly uncomfortable
for QAPI when considering alternate code generators, because the
definition of what "CONFIG_xxx" or "TARGET_xxx" condition means,
is essentially known only to our build system. While we expose
the conditions in the docs, the meaning of those conditions is
totally opaque to anyone reading the docs. Essentially our QAPI
schema ceased to be self-documenting/self-describing when we
introduced the 'if' conditions :-(
In retrospect, IMHO, for 'if' conditions we probably should have
created some kind of built-in QAPI concept of feature flag constants
with well defined & documented meaning.
eg hypothetically
##
# @target-s390x
#
# Whether this is an s390x emulator target
{ 'constant': 'target-s390x' }
##
# @accel-kvm
#
# Whether the KVM accelerator is built
{ 'constant': 'accel-kvm' }
Then our 'if' conditions would have only been permitted to
reference defined 'constant'.
{ 'struct': 'CpuModelCompareInfo',
'data': { 'result': 'CpuModelCompareResult',
'responsible-properties': ['str'] },
'if': 'target-s390x' }
The build system would need generate an input document for the
QAPI visitor that defines whether each constant is set to true
or false, based on suitable CONFIG/TARGET conditions from meson.
With this QAPI schemas would have remained fully self-contained.
Anyway, this is a long way of saying that having 'runtime_if'
conditions directly referencing the names of internal C
functions makes me even more uncomfortable than I already am
with the 'if' conditions.
The meaning of the QAPI schema now varies based on both the build
system, and an arbitrary amount of C, and is thus (conceptually)
even more opaque, even if you could infer some meaning from the
'target_s390x()' function name you've used. I think this is a very
undesirable characteristic for what is our public API definition.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json
2025-05-08 6:53 ` Philippe Mathieu-Daudé
@ 2025-05-08 20:22 ` Pierrick Bouvier
0 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-08 20:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 5/7/25 11:53 PM, Philippe Mathieu-Daudé wrote:
> On 8/5/25 01:14, Pierrick Bouvier wrote:
>> This new entry can be used in QAPI json to specify a runtime conditional
>> to expose any entry, similar to existing 'if', that applies at compile
>> time, thanks to ifdef. The element is always defined in C, but not
>> exposed through the schema and visit functions, thus being hidden for a
>> QMP consumer.
>>
>> QAPISchemaIfCond is extended to parse this information. A first version
>> was tried duplicating this, but this proved to be much more boilerplate
>> than needed to pass information through all function calls.
>>
>> 'if' and 'runtime_if' can be combined elegantly on a single item,
>> allowing to restrict an element to be present based on compile time
>> defines, and runtime checks at the same time.
>>
>> Note: This commit only adds parsing of runtime_if, and does not hide
>> anything yet.
>>
>> For review:
>>
>> - I don't really like "runtime_if" name.
>> What would make sense, IMHO, is to rename existing 'if' to 'ifdef',
>> and reuse 'if' for 'runtime_if'. Since it requires invasive changes, I
>> would prefer to get agreement before wasting time in case you prefer
>> any other naming convention. Let me know what you'd like.
>
> Or rename 'if' as 'buildtime_if'. /s!
>
I'll let Markus do the bikeshed as he's the maintainer and the one who
may finally (or not) merge this.
>>
>> - As mentioned in second paragraph, I think our best implementation
>> would be to extend existing QAPISchemaIfCond, as it's really
>> complicated to extend all call sites if we have another new object.
>>
>> - No tests/doc added at this time, as I prefer to wait that we decide
>> about naming and proposed approach first.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> scripts/qapi/common.py | 16 +++++++++++-
>> scripts/qapi/expr.py | 9 ++++---
>> scripts/qapi/gen.py | 56 +++++++++++++++++++++++++++++++++++++++++-
>> scripts/qapi/schema.py | 44 ++++++++++++++++++++++++---------
>> 4 files changed, 107 insertions(+), 18 deletions(-)
>>
>> diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
>> index d7c8aa3365c..0e8e2abeb58 100644
>> --- a/scripts/qapi/common.py
>> +++ b/scripts/qapi/common.py
>> @@ -229,6 +229,8 @@ def gen_infix(operator: str, operands: Sequence[Any]) -> str:
>> def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
>> return gen_ifcond(ifcond, 'defined(%s)', '!%s', ' && ', ' || ')
>>
>> +def cgen_runtime_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
>> + return gen_ifcond(ifcond, '%s', '!%s', ' && ', ' || ')
>>
>> def docgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
>> # TODO Doc generated for conditions needs polish
>> @@ -242,7 +244,6 @@ def gen_if(cond: str) -> str:
>> #if %(cond)s
>> ''', cond=cond)
>>
>> -
>> def gen_endif(cond: str) -> str:
>> if not cond:
>> return ''
>> @@ -250,6 +251,19 @@ def gen_endif(cond: str) -> str:
>> #endif /* %(cond)s */
>> ''', cond=cond)
>>
>> +def gen_runtime_if(cond: str) -> str:
>> + if not cond:
>> + return ''
>> + return mcgen('''
>> +if (%(cond)s) {
>> +''', cond=cond)
>> +
>> +def gen_runtime_endif(cond: str) -> str:
>> + if not cond:
>> + return ''
>> + return mcgen('''
>> +} /* (%(cond)s) */
>
> No need for extra parenthesis in comment:
>
> +} /* %(cond)s */
>
>> +''', cond=cond)
>>
>> def must_match(pattern: str, string: str) -> Match[str]:
>> match = re.match(pattern, string)
>> diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
>> index cae0a083591..5ae26395964 100644
>> --- a/scripts/qapi/expr.py
>> +++ b/scripts/qapi/expr.py
>> @@ -392,7 +392,8 @@ def check_type_implicit(value: Optional[object],
>> permit_underscore=permissive)
>> if c_name(key, False) == 'u' or c_name(key, False).startswith('has_'):
>> raise QAPISemError(info, "%s uses reserved name" % key_source)
>> - check_keys(arg, info, key_source, ['type'], ['if', 'features'])
>> + check_keys(arg, info, key_source, ['type'], ['if', 'features',
>> + 'runtime_if'])
>> check_if(arg, info, key_source)
>> check_features(arg.get('features'), info)
>> check_type_name_or_array(arg['type'], info, key_source)
>> @@ -642,7 +643,7 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
>> elif meta == 'union':
>> check_keys(expr, info, meta,
>> ['union', 'base', 'discriminator', 'data'],
>> - ['if', 'features'])
>> + ['if', 'runtime_if', 'features'])
>> normalize_members(expr.get('base'))
>> normalize_members(expr['data'])
>> check_union(expr)
>> @@ -659,8 +660,8 @@ def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
>> elif meta == 'command':
>> check_keys(expr, info, meta,
>> ['command'],
>> - ['data', 'returns', 'boxed', 'if', 'features',
>> - 'gen', 'success-response', 'allow-oob',
>> + ['data', 'returns', 'boxed', 'if', 'runtime_if',
>> + 'features', 'gen', 'success-response', 'allow-oob',
>> 'allow-preconfig', 'coroutine'])
>> normalize_members(expr.get('data'))
>> check_command(expr)
>
> Why can't we merge here the changes from patch 9?
>
Oops, that's a rebase mistake, thanks. It belongs here indeed.
> -- >8 --
> diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
> index 5ae26395964..f31f28ecb10 100644
> --- a/scripts/qapi/expr.py
> +++ b/scripts/qapi/expr.py
> @@ -638,7 +638,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
> List[QAPIExpression]:
>
> if meta == 'enum':
> check_keys(expr, info, meta,
> - ['enum', 'data'], ['if', 'features', 'prefix'])
> + ['enum', 'data'], ['if', 'runtime_if', 'features',
> + 'prefix'])
> check_enum(expr)
> elif meta == 'union':
> check_keys(expr, info, meta,
> @@ -654,7 +655,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
> List[QAPIExpression]:
> check_alternate(expr)
> elif meta == 'struct':
> check_keys(expr, info, meta,
> - ['struct', 'data'], ['base', 'if', 'features'])
> + ['struct', 'data'], ['base', 'if', 'runtime_if',
> + 'features'])
> normalize_members(expr['data'])
> check_struct(expr)
> elif meta == 'command':
> @@ -667,7 +669,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
> List[QAPIExpression]:
> check_command(expr)
> elif meta == 'event':
> check_keys(expr, info, meta,
> - ['event'], ['data', 'boxed', 'if', 'features'])
> + ['event'], ['data', 'boxed', 'if', 'runtime_if',
> + 'features'])
> normalize_members(expr.get('data'))
> check_event(expr)
> else:
> ---
>
> Otherwise, patch LGTM :)
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 03/13] qobject/qlit: allow to hide dict or list entries
2025-05-08 14:21 ` Daniel P. Berrangé
@ 2025-05-08 20:25 ` Pierrick Bouvier
0 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-08 20:25 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
thuth, Michael Roth
On 5/8/25 7:21 AM, Daniel P. Berrangé wrote:
> On Wed, May 07, 2025 at 04:14:33PM -0700, Pierrick Bouvier wrote:
>> We add a new .hidden field to qlit entries, which gets ignored when
>> creating the associated QObject.
>> By default .hidden is 0, so it means the entry is visible. This way,
>> only potentially hidden elements need to be assigned.
>
> IMHO this feels like a somewhat dubious concept to have in the
> qobject code, as it is quite specialized to a single use case.
> A more general purpose approach would be to have some mechanism
> for cloning while applying a data filter, though I admit that
> may be more tedious to actually use.
>
It's the least worse solution I found, for conditionally defining the
schema.
Trying to dynamically create the qlit stuff with individual .push() was
a nightmare in code generator, so I dropped this idea.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> include/qobject/qlit.h | 12 ++++++++++++
>> qobject/qlit.c | 10 ++++++++--
>> 2 files changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/qobject/qlit.h b/include/qobject/qlit.h
>> index c0676d5daf2..3b66c22013c 100644
>> --- a/include/qobject/qlit.h
>> +++ b/include/qobject/qlit.h
>> @@ -28,25 +28,37 @@ struct QLitObject {
>> QLitDictEntry *qdict;
>> QLitObject *qlist;
>> } value;
>> + bool hidden;
>> };
>>
>> struct QLitDictEntry {
>> const char *key;
>> QLitObject value;
>> + bool hidden;
>> };
>>
>> #define QLIT_QNULL \
>> { .type = QTYPE_QNULL }
>> #define QLIT_QBOOL(val) \
>> { .type = QTYPE_QBOOL, .value.qbool = (val) }
>> +#define QLIT_QBOOL_HIDDEN(val, cond) \
>> + { .type = QTYPE_QBOOL, .value.qbool = (val), .hidden = (cond) }
>> #define QLIT_QNUM(val) \
>> { .type = QTYPE_QNUM, .value.qnum = (val) }
>> +#define QLIT_QNUM_HIDDEN(val, cond) \
>> + { .type = QTYPE_QNUM, .value.qnum = (val), .hidden = (cond) }
>> #define QLIT_QSTR(val) \
>> { .type = QTYPE_QSTRING, .value.qstr = (val) }
>> +#define QLIT_QSTR_HIDDEN(val, cond) \
>> + { .type = QTYPE_QSTRING, .value.qstr = (val), .hidden = (cond) }
>> #define QLIT_QDICT(val) \
>> { .type = QTYPE_QDICT, .value.qdict = (val) }
>> +#define QLIT_QDICT_HIDDEN(val, cond) \
>> + { .type = QTYPE_QDICT, .value.qdict = (val), .hidden = (cond) }
>> #define QLIT_QLIST(val) \
>> { .type = QTYPE_QLIST, .value.qlist = (val) }
>> +#define QLIT_QLIST_HIDDEN(val, cond) \
>> + { .type = QTYPE_QLIST, .value.qlist = (val), .hidden = (cond) }
>>
>> bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs);
>>
>> diff --git a/qobject/qlit.c b/qobject/qlit.c
>> index a44f47eaa57..7b372c5ebaa 100644
>> --- a/qobject/qlit.c
>> +++ b/qobject/qlit.c
>> @@ -90,6 +90,8 @@ bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs)
>>
>> QObject *qobject_from_qlit(const QLitObject *qlit)
>> {
>> + g_assert(!qlit->hidden);
>> +
>> switch (qlit->type) {
>> case QTYPE_QNULL:
>> return QOBJECT(qnull());
>> @@ -102,7 +104,9 @@ QObject *qobject_from_qlit(const QLitObject *qlit)
>> QLitDictEntry *e;
>>
>> for (e = qlit->value.qdict; e->key; e++) {
>> - qdict_put_obj(qdict, e->key, qobject_from_qlit(&e->value));
>> + if (!e->hidden) {
>> + qdict_put_obj(qdict, e->key, qobject_from_qlit(&e->value));
>> + }
>> }
>> return QOBJECT(qdict);
>> }
>> @@ -111,7 +115,9 @@ QObject *qobject_from_qlit(const QLitObject *qlit)
>> QLitObject *e;
>>
>> for (e = qlit->value.qlist; e->type != QTYPE_NONE; e++) {
>> - qlist_append_obj(qlist, qobject_from_qlit(e));
>> + if (!e->hidden) {
>> + qlist_append_obj(qlist, qobject_from_qlit(e));
>> + }
>> }
>> return QOBJECT(qlist);
>> }
>> --
>> 2.47.2
>>
>
> With regards,
> Daniel
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 08/13] qemu/target-info: implement missing helpers
2025-05-08 6:40 ` Philippe Mathieu-Daudé
@ 2025-05-08 20:30 ` Pierrick Bouvier
0 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-08 20:30 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 5/7/25 11:40 PM, Philippe Mathieu-Daudé wrote:
> On 8/5/25 01:14, Pierrick Bouvier wrote:
>> Add runtime helpers for target and config queries.
>>
>> Note: This will be reimplemented later [1] using proper information in
>> TargetInfo. Meanwhile, just add a simple implementation.
>>
>> [1] https://patchew.org/QEMU/20250424222112.36194-1-philmd@linaro.org/20250424222112.36194-19-philmd@linaro.org/
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> meson.build | 2 +-
>> include/qemu/target-info.h | 14 +++++
>> target-info.c | 117 +++++++++++++++++++++++++++++++++++++
>> 3 files changed, 132 insertions(+), 1 deletion(-)
>
>
>> +bool target_mips(void)
>
> I know this is the same lowercase name, but maybe we could consider
> directly using target_mips32() instead of keeping the technical debt
> of having TARGET_MIPS defined for both 32 and 64-bit targets.
> Thankfully we cleared that with recent targets (i.e. LoongArch or
> RISC-V -- AVR is a bit different, since 8-bit AVR and AVR32 are
> distinct architectures).
>
> For x86 we often use 'x86' as any of (i386, x86_64, amd64), maybe
> we can introduce target_x86() too.
>
>> +{
>> +#ifdef TARGET_MIPS
>> + return true;
>> +#else
>> + return false;
>> +#endif
>> +}
>> +
>> +bool target_mips64(void)
>> +{
>> +#ifdef TARGET_MIPS64
>> + return true;
>> +#else
>> + return false;
>> +#endif
>> +}
>> +
>> +bool target_loongarch64(void)
>> +{
>> +#ifdef TARGET_LOONGARCH64
>> + return true;
>> +#else
>> + return false;
>> +#endif
>> +}
>> +
>> +bool target_riscv32(void)
>> +{
>> +#ifdef TARGET_RISCV32
>> + return true;
>> +#else
>> + return false;
>> +#endif
>> +}
>> +
>> +bool target_riscv64(void)
>> +{
>> +#ifdef TARGET_RISCV64
>> + return true;
>> +#else
>> + return false;
>> +#endif
>> +}
>> +
>> +bool target_ppc(void)
>
> Ditto, target_ppc32()?
>
>> +{
>> +#ifdef TARGET_PPC
>> + return true;
>> +#else
>> + return false;
>> +#endif
>> +}
>> +
>> +bool target_ppc64(void)
>> +{
>> +#ifdef TARGET_ppc64
>> + return true;
>> +#else
>> + return false;
>> +#endif
>> +}
>> +
>> +bool target_has_kvm(void)
>> +{
>> +#ifdef CONFIG_KVM
>> + return true;
>> +#else
>> + return false;
>> +#endif
>> +}
>
I simply tried to reflect existing TARGET_* (so there is no
TARGET_PPC32, which is incoherent with having TARGET_RISCV{,32,64}).
For the long term, I think we should aim for a 1-1 mapping with
SysEmuTarget instead, which is *coherent*. As well, we'll probably want
a way to identify target base architecture, like target_base_arm(),
target_base_i386(), ..., which will include 32 and 64 bits variants.
Since patches for TargetInfo bringing target_arch() are not there yet, I
didn't want to bring all the material for a new bike shed, so I simply
followed existing TARGET_*. I hope we can have this whole conversation
on another dedicated series, once upstream TargetInfo will contain a
target_arch field.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 10/13] qapi: add weak stubs for target specific commands
2025-05-08 6:57 ` Philippe Mathieu-Daudé
@ 2025-05-08 20:33 ` Pierrick Bouvier
0 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-08 20:33 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: alex.bennee, stefanha, peter.maydell, Markus Armbruster,
richard.henderson, pbonzini, jsnow, berrange, thuth, Michael Roth
On 5/7/25 11:57 PM, Philippe Mathieu-Daudé wrote:
> On 8/5/25 01:14, Pierrick Bouvier wrote:
>> We are about to expose various target specific commands for all targets,
>> so we need to stub not implemented qmp_* functions.
>>
>> MinGW does not support weak symbols without at least one strong
>> definition, so we'll have to detail stubs per target. Sad.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> qapi/commands-weak-stubs.c | 38 ++++++++++++++++++++++++++++++++++++++
>> qapi/meson.build | 2 ++
>> 2 files changed, 40 insertions(+)
>> create mode 100644 qapi/commands-weak-stubs.c
>>
>> diff --git a/qapi/commands-weak-stubs.c b/qapi/commands-weak-stubs.c
>> new file mode 100644
>> index 00000000000..9734263c32e
>> --- /dev/null
>> +++ b/qapi/commands-weak-stubs.c
>> @@ -0,0 +1,38 @@
>> +/*
>> + * Weak symbols for target specific commands
>> + *
>> + * Copyright Linaro, 2025
>> + *
>> + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
>> + * See the COPYING.LIB file in the top-level directory.
>> + *
>> + */
>> +
>> +#include "qemu/osdep.h"
>> +#include <glib.h>
>> +
>> +#define NOT_REACHABLE(symbol) \
>> +void __attribute__((weak)) symbol(void); \
>> +void __attribute__((weak)) symbol(void) { g_assert_not_reached(); }
>> +
>> +#define WEAK_STUB(command) \
>> +NOT_REACHABLE(qmp_marshal_##command) \
>> +NOT_REACHABLE(qmp_##command)
>> +
>> +WEAK_STUB(query_cpu_model_comparison);
>> +WEAK_STUB(query_cpu_model_baseline);
>> +WEAK_STUB(set_cpu_topology);
>> +WEAK_STUB(query_s390x_cpu_polarization);
>> +WEAK_STUB(rtc_reset_reinjection);
>> +WEAK_STUB(query_sev);
>> +WEAK_STUB(query_sev_launch_measure);
>> +WEAK_STUB(query_sev_capabilities);
>> +WEAK_STUB(sev_inject_launch_secret);
>> +WEAK_STUB(query_sev_attestation_report);
>> +WEAK_STUB(query_sgx);
>> +WEAK_STUB(query_sgx_capabilities);
>> +WEAK_STUB(xen_event_list);
>> +WEAK_STUB(xen_event_inject);
>> +WEAK_STUB(query_cpu_model_expansion);
>> +WEAK_STUB(query_cpu_definitions);
>> +WEAK_STUB(query_gic_capabilities);
>
> Shouldn't this also be generated by QAPI scripts?
>
It's a bit tricky, because we would need to generate the build system
also (which targets links what), and meson is a sane tool so it prevents
users from doing that.
>> diff --git a/qapi/meson.build b/qapi/meson.build
>> index eadde4db307..60fc958ec10 100644
>> --- a/qapi/meson.build
>> +++ b/qapi/meson.build
>> @@ -147,3 +147,5 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
>> specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: qapi_files[i])
>> i = i + 1
>> endforeach
>> +
>> +system_ss.add(files('commands-weak-stubs.c'))
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-08 14:40 ` Daniel P. Berrangé
@ 2025-05-08 20:48 ` Pierrick Bouvier
2025-05-10 6:57 ` Markus Armbruster
1 sibling, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-08 20:48 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
Markus Armbruster, richard.henderson, pbonzini, jsnow, philmd,
thuth, Michael Roth
On 5/8/25 7:40 AM, Daniel P. Berrangé wrote:
> On Wed, May 07, 2025 at 04:14:39PM -0700, Pierrick Bouvier wrote:
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> qapi/machine-target.json | 84 ++++++++++++++++++++++++----------------
>> qapi/misc-target.json | 48 ++++++++++++-----------
>> scripts/qapi/expr.py | 9 +++--
>> 3 files changed, 81 insertions(+), 60 deletions(-)
>>
>> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
>> index 541f93eeb78..6174b7291ca 100644
>> --- a/qapi/machine-target.json
>> +++ b/qapi/machine-target.json
>> @@ -96,7 +96,7 @@
>> ##
>> { 'struct': 'CpuModelBaselineInfo',
>> 'data': { 'model': 'CpuModelInfo' },
>> - 'if': 'TARGET_S390X' }
>> + 'runtime_if': 'target_s390x()' }
>
> The existing 'if' conditions are already slightly uncomfortable
> for QAPI when considering alternate code generators, because the
> definition of what "CONFIG_xxx" or "TARGET_xxx" condition means,
> is essentially known only to our build system. While we expose
> the conditions in the docs, the meaning of those conditions is
> totally opaque to anyone reading the docs. Essentially our QAPI
> schema ceased to be self-documenting/self-describing when we
> introduced the 'if' conditions :-(
>
>
> In retrospect, IMHO, for 'if' conditions we probably should have
> created some kind of built-in QAPI concept of feature flag constants
> with well defined & documented meaning.
>
> eg hypothetically
>
> ##
> # @target-s390x
> #
> # Whether this is an s390x emulator target
> { 'constant': 'target-s390x' }
>
> ##
> # @accel-kvm
> #
> # Whether the KVM accelerator is built
> { 'constant': 'accel-kvm' }
>
> Then our 'if' conditions would have only been permitted to
> reference defined 'constant'.
>
> { 'struct': 'CpuModelCompareInfo',
> 'data': { 'result': 'CpuModelCompareResult',
> 'responsible-properties': ['str'] },
> 'if': 'target-s390x' }
>
> The build system would need generate an input document for the
> QAPI visitor that defines whether each constant is set to true
> or false, based on suitable CONFIG/TARGET conditions from meson.
>
> With this QAPI schemas would have remained fully self-contained.
>
> Anyway, this is a long way of saying that having 'runtime_if'
> conditions directly referencing the names of internal C
> functions makes me even more uncomfortable than I already am
> with the 'if' conditions.
>
I understand the concern.
However, one argument may be that QAPI json, as perfect as we could
expect they are, are simply known and used inside QEMU right now, which
is written in C at the moment.
Even if that assumption should change, I'm pretty sure we can create
functions named in the same way in C, python, Go, Rust or any other
languages we would like to generate code for.
It's not like if we started using complex expressions that only works in
nightly version of Rust.
> The meaning of the QAPI schema now varies based on both the build
> system, and an arbitrary amount of C, and is thus (conceptually)
> even more opaque, even if you could infer some meaning from the
> 'target_s390x()' function name you've used. I think this is a very
> undesirable characteristic for what is our public API definition.
>
Correct if I'm wrong, but it was said in previous threads that those
json are simply used and consumed by QEMU itself, and not by any
external projects.
I would be prudent to call this a public API definition, when it's just
a DSL for an ad-hoc code generator internal to QEMU.
> With regards,
> Daniel
Overall, and I would like to state it again, I'm really open to any
solution to get rid of TARGET_* compile time defines in QAPI json.
And I appreciate the solution you posted as well.
For now, it's blocking the single binary work, because any file pulling
QAPI definitions is tainted with TARGET_* defines, so we are blocked
waiting for them to be removed upstream, before being able to post a
series touching those files.
I hope we can get a clear answer from QAPI maintainers, so you or I can
take ownership of this and finish the work. From the previous thread, I
thought (and I may be wrong) that Markus was more enclined to the
current solution, but it was not entirely clear for me to be honest.
Let's hope that having both approaches implemented will give a good
insight of where things should go.
Thanks,
Pierrick
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-08 14:40 ` Daniel P. Berrangé
2025-05-08 20:48 ` Pierrick Bouvier
@ 2025-05-10 6:57 ` Markus Armbruster
2025-05-13 0:36 ` Pierrick Bouvier
1 sibling, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2025-05-10 6:57 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: Pierrick Bouvier, qemu-devel, alex.bennee, stefanha,
peter.maydell, richard.henderson, pbonzini, jsnow, philmd, thuth,
Michael Roth
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Wed, May 07, 2025 at 04:14:39PM -0700, Pierrick Bouvier wrote:
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> qapi/machine-target.json | 84 ++++++++++++++++++++++++----------------
>> qapi/misc-target.json | 48 ++++++++++++-----------
>> scripts/qapi/expr.py | 9 +++--
>> 3 files changed, 81 insertions(+), 60 deletions(-)
>>
>> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
>> index 541f93eeb78..6174b7291ca 100644
>> --- a/qapi/machine-target.json
>> +++ b/qapi/machine-target.json
>> @@ -96,7 +96,7 @@
>> ##
>> { 'struct': 'CpuModelBaselineInfo',
>> 'data': { 'model': 'CpuModelInfo' },
>> - 'if': 'TARGET_S390X' }
>> + 'runtime_if': 'target_s390x()' }
>
> The existing 'if' conditions are already slightly uncomfortable
> for QAPI when considering alternate code generators, because the
> definition of what "CONFIG_xxx" or "TARGET_xxx" condition means,
> is essentially known only to our build system. While we expose
> the conditions in the docs, the meaning of those conditions is
> totally opaque to anyone reading the docs. Essentially our QAPI
> schema ceased to be self-documenting/self-describing when we
> introduced the 'if' conditions :-(
>
>
> In retrospect, IMHO, for 'if' conditions we probably should have
> created some kind of built-in QAPI concept of feature flag constants
> with well defined & documented meaning.
>
> eg hypothetically
>
> ##
> # @target-s390x
> #
> # Whether this is an s390x emulator target
> { 'constant': 'target-s390x' }
>
> ##
> # @accel-kvm
> #
> # Whether the KVM accelerator is built
> { 'constant': 'accel-kvm' }
>
> Then our 'if' conditions would have only been permitted to
> reference defined 'constant'.
>
> { 'struct': 'CpuModelCompareInfo',
> 'data': { 'result': 'CpuModelCompareResult',
> 'responsible-properties': ['str'] },
> 'if': 'target-s390x' }
This adds mandatory declaration of identifiers used in conditions to the
QAPI schema language.
The declarations can then serve as hooks for doc comments. These should
ineed result in a more complete and useful generated manual. John,
thoughts?
The condition documentation would supplement / partially duplicate the
configure flag documentation in meson_options.txt.
We'd need to tie the two together to make the code work (see your next
paragraph). We should also tie their documentation together somehow.
Feels like a solvable problem.
> The build system would need generate an input document for the
> QAPI visitor that defines whether each constant is set to true
> or false, based on suitable CONFIG/TARGET conditions from meson.
I think the conditions that are evaluated at build time in handwritten C
code (with #if) should also be evaluated at build time in generated C
code.
Certain conditions are evaluated at build time in target-specific code,
and at runtime in target-independent code. Again, I think handwritten
and generated code should work the same way.
Thus, to eliminate target-specific QAPI-generated code, we either
evaluate them at runtime, or simply eliminate them. Elsewhere, we've
come to the conclusion (I think) that the latter should do at least for
now, likely forever, so we should try that first.
> With this QAPI schemas would have remained fully self-contained.
Fortunately, this is merely a matter of filling a gap we left, not a
matter of replacing a fundamentally flawed design.
> Anyway, this is a long way of saying that having 'runtime_if'
> conditions directly referencing the names of internal C
> functions makes me even more uncomfortable than I already am
> with the 'if' conditions.
>
> The meaning of the QAPI schema now varies based on both the build
> system, and an arbitrary amount of C, and is thus (conceptually)
> even more opaque, even if you could infer some meaning from the
> 'target_s390x()' function name you've used. I think this is a very
> undesirable characteristic for what is our public API definition.
I don't see much of a difference, to be honest.
Both kinds of conditionals have the exact same argument structure:
expression tree where the leaves are identifiers.
The meaning of these identifiers is not documented in the QAPI schema
now, and barely documented in the code.
This defect could be remedied the exact same way whether the identifiers
are preprocessor macros or function names.
I actually find another argument of yours (not repeated above) more
compelling: that certain aspects of the external interface should not
vary at runtime.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-10 6:57 ` Markus Armbruster
@ 2025-05-13 0:36 ` Pierrick Bouvier
2025-05-13 7:08 ` Markus Armbruster
0 siblings, 1 reply; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-13 0:36 UTC (permalink / raw)
To: Markus Armbruster, Daniel P. Berrangé
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
richard.henderson, pbonzini, jsnow, philmd, thuth, Michael Roth
On 5/9/25 11:57 PM, Markus Armbruster wrote:
>> The build system would need generate an input document for the
>> QAPI visitor that defines whether each constant is set to true
>> or false, based on suitable CONFIG/TARGET conditions from meson.
>
> I think the conditions that are evaluated at build time in handwritten C
> code (with #if) should also be evaluated at build time in generated C
> code.
>
> Certain conditions are evaluated at build time in target-specific code,
> and at runtime in target-independent code. Again, I think handwritten
> and generated code should work the same way.
>
> Thus, to eliminate target-specific QAPI-generated code, we either
> evaluate them at runtime, or simply eliminate them. Elsewhere, we've
> come to the conclusion (I think) that the latter should do at least for
> now, likely forever, so we should try that first.
>
I'm not sure if you mean you'd prefer to eradicate #if completely.
We have to keep in mind that some config host #if have to stay there, or
they expose things that the rest of QEMU code is not supposed to see
(hidden under those same CONFIG_ ifdef also).
So we would need both if and runtime_if.
>> With this QAPI schemas would have remained fully self-contained.
>
> Fortunately, this is merely a matter of filling a gap we left, not a
> matter of replacing a fundamentally flawed design.
>
>> Anyway, this is a long way of saying that having 'runtime_if'
>> conditions directly referencing the names of internal C
>> functions makes me even more uncomfortable than I already am
>> with the 'if' conditions.
>>
>> The meaning of the QAPI schema now varies based on both the build
>> system, and an arbitrary amount of C, and is thus (conceptually)
>> even more opaque, even if you could infer some meaning from the
>> 'target_s390x()' function name you've used. I think this is a very
>> undesirable characteristic for what is our public API definition.
>
> I don't see much of a difference, to be honest.
> Both kinds of conditionals have the exact same argument structure:> expression tree where the leaves are identifiers.
>
> The meaning of these identifiers is not documented in the QAPI schema
> now, and barely documented in the code.
>
I agree on that, and I'm not sure that introducing another level of
symbolic names (target-s390x vs target_s390x()) to match the same C
function name really adds any value to the QAPI definition.
As mentioned before, it's easy to guarantee that the function is named
the same in any language, and ban any use of C complex expression
(through code review), so the argument about generating bindings in
other languages does not really matter IMHO.
> This defect could be remedied the exact same way whether the identifiers
> are preprocessor macros or function names.
>
> I actually find another argument of yours (not repeated above) more
> compelling: that certain aspects of the external interface should not
> vary at runtime.
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-13 0:36 ` Pierrick Bouvier
@ 2025-05-13 7:08 ` Markus Armbruster
2025-05-13 22:52 ` Pierrick Bouvier
0 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2025-05-13 7:08 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: Daniel P. Berrangé, qemu-devel, alex.bennee, stefanha,
peter.maydell, richard.henderson, pbonzini, jsnow, philmd, thuth,
Michael Roth
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> On 5/9/25 11:57 PM, Markus Armbruster wrote:
>>> The build system would need generate an input document for the
>>> QAPI visitor that defines whether each constant is set to true
>>> or false, based on suitable CONFIG/TARGET conditions from meson.
>>
>> I think the conditions that are evaluated at build time in handwritten C
>> code (with #if) should also be evaluated at build time in generated C
>> code.
>>
>> Certain conditions are evaluated at build time in target-specific code,
>> and at runtime in target-independent code. Again, I think handwritten
>> and generated code should work the same way.
>>
>> Thus, to eliminate target-specific QAPI-generated code, we either
>> evaluate them at runtime, or simply eliminate them. Elsewhere, we've
>> come to the conclusion (I think) that the latter should do at least for
>> now, likely forever, so we should try that first.
>>
>
> I'm not sure if you mean you'd prefer to eradicate #if completely.
I do not!
> We have to keep in mind that some config host #if have to stay there, or
> they expose things that the rest of QEMU code is not supposed to see
> (hidden under those same CONFIG_ ifdef also).
Letting people configure their QEMU build is useful and must stay.
We provide this via conditional compilation, of complete source files
(done in meson), as well as within source files (#if in C and 'if' in
QAPI).
> So we would need both if and runtime_if.
I don't understand the need for runtime_if. Can you give an example?
[...]
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-13 7:08 ` Markus Armbruster
@ 2025-05-13 22:52 ` Pierrick Bouvier
2025-05-14 7:13 ` Markus Armbruster
0 siblings, 1 reply; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-13 22:52 UTC (permalink / raw)
To: Markus Armbruster
Cc: Daniel P. Berrangé, qemu-devel, alex.bennee, stefanha,
peter.maydell, richard.henderson, pbonzini, jsnow, philmd, thuth,
Michael Roth
On 5/13/25 12:08 AM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> On 5/9/25 11:57 PM, Markus Armbruster wrote:
>>>> The build system would need generate an input document for the
>>>> QAPI visitor that defines whether each constant is set to true
>>>> or false, based on suitable CONFIG/TARGET conditions from meson.
>>>
>>> I think the conditions that are evaluated at build time in handwritten C
>>> code (with #if) should also be evaluated at build time in generated C
>>> code.
>>>
>>> Certain conditions are evaluated at build time in target-specific code,
>>> and at runtime in target-independent code. Again, I think handwritten
>>> and generated code should work the same way.
>>>
>>> Thus, to eliminate target-specific QAPI-generated code, we either
>>> evaluate them at runtime, or simply eliminate them. Elsewhere, we've
>>> come to the conclusion (I think) that the latter should do at least for
>>> now, likely forever, so we should try that first.
>>>
>>
>> I'm not sure if you mean you'd prefer to eradicate #if completely.
>
> I do not!
>
>> We have to keep in mind that some config host #if have to stay there, or
>> they expose things that the rest of QEMU code is not supposed to see
>> (hidden under those same CONFIG_ ifdef also).
>
> Letting people configure their QEMU build is useful and must stay.
>
> We provide this via conditional compilation, of complete source files
> (done in meson), as well as within source files (#if in C and 'if' in
> QAPI).
>
>> So we would need both if and runtime_if.
>
> I don't understand the need for runtime_if. Can you give an example?
>
That is the point of this whole series, which explores introducing a
'runtime' if in the schema, to keep it as it is today, while removing
target specific compile time defines.
It is another approach that one Daniel followed on his series.
I invite you to give a quick read to this series, especially the related
commit introducing 'runtime_if'
(20250507231442.879619-2-pierrick.bouvier@linaro.org).
As well, I would appreciate if you could state clearly where we are
going with all this (or at least, where you *don't* want this to go), so
we can avoid spending time in the wrong direction.
I am ok to pursue Daniel's approach, or continue the approach in the
current series, no strong opinion in my side, I am just trying to move
QAPI generated code out of the way for the single binary goal.
Thanks,
Pierrick
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-13 22:52 ` Pierrick Bouvier
@ 2025-05-14 7:13 ` Markus Armbruster
2025-05-14 16:54 ` Pierrick Bouvier
0 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2025-05-14 7:13 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: Daniel P. Berrangé, qemu-devel, alex.bennee, stefanha,
peter.maydell, richard.henderson, pbonzini, jsnow, philmd, thuth,
Michael Roth
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> On 5/13/25 12:08 AM, Markus Armbruster wrote:
>> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>>
>>> On 5/9/25 11:57 PM, Markus Armbruster wrote:
>>>>> The build system would need generate an input document for the
>>>>> QAPI visitor that defines whether each constant is set to true
>>>>> or false, based on suitable CONFIG/TARGET conditions from meson.
>>>>
>>>> I think the conditions that are evaluated at build time in handwritten C
>>>> code (with #if) should also be evaluated at build time in generated C
>>>> code.
>>>>
>>>> Certain conditions are evaluated at build time in target-specific code,
>>>> and at runtime in target-independent code. Again, I think handwritten
>>>> and generated code should work the same way.
>>>>
>>>> Thus, to eliminate target-specific QAPI-generated code, we either
>>>> evaluate them at runtime, or simply eliminate them. Elsewhere, we've
>>>> come to the conclusion (I think) that the latter should do at least for
>>>> now, likely forever, so we should try that first.
>>>>
>>>
>>> I'm not sure if you mean you'd prefer to eradicate #if completely.
>>
>> I do not!
>>
>>> We have to keep in mind that some config host #if have to stay there, or
>>> they expose things that the rest of QEMU code is not supposed to see
>>> (hidden under those same CONFIG_ ifdef also).
>>
>> Letting people configure their QEMU build is useful and must stay.
>>
>> We provide this via conditional compilation, of complete source files
>> (done in meson), as well as within source files (#if in C and 'if' in
>> QAPI).
>>
>>> So we would need both if and runtime_if.
>>
>> I don't understand the need for runtime_if. Can you give an example?
>>
>
> That is the point of this whole series, which explores introducing a
> 'runtime' if in the schema, to keep it as it is today, while removing
> target specific compile time defines.
Ah, I lost the wider context, sorry!
We identified three ways to deal with target-specific conditionals in a
single binary, and 'runtime_if' is one of them:
(1) Drop target-specific conditionals.
(2) Replace them by run-time checks.
(3) Have target-specific QAPI-generated code for multiple targets
coexist in the single binary.
Both (2) and (3) keep the QAPI schema work as it does now. None of us
likes (3) due to bloat and complexity.
The other two look both workable to me. (2) keeps the QAPI schema work
exactly as it does now. (1) is simpler, but the external interface
changes somewhat. Its users seem to be okay with it.
So let's go with (1).
> It is another approach that one Daniel followed on his series.
>
> I invite you to give a quick read to this series, especially the related
> commit introducing 'runtime_if'
> (20250507231442.879619-2-pierrick.bouvier@linaro.org).
I can't afford a thorough review now, but I'll have a look, and I will
hold onto your series just in case.
> As well, I would appreciate if you could state clearly where we are
> going with all this (or at least, where you *don't* want this to go), so
> we can avoid spending time in the wrong direction.
The discussion was spread over multiple threads, which makes it hard to
follow. I hope the conclusion is clear now. If not, please ask for
further clarification.
> I am ok to pursue Daniel's approach, or continue the approach in the
> current series, no strong opinion in my side, I am just trying to move
> QAPI generated code out of the way for the single binary goal.
Understood!
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-07 23:14 ` [PATCH 09/13] qapi: transform target specific 'if' in runtime checks Pierrick Bouvier
2025-05-08 6:44 ` Philippe Mathieu-Daudé
2025-05-08 14:40 ` Daniel P. Berrangé
@ 2025-05-14 14:09 ` Markus Armbruster
2025-05-14 16:50 ` Pierrick Bouvier
2 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2025-05-14 14:09 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
richard.henderson, pbonzini, jsnow, philmd, berrange, thuth,
Michael Roth
Fails to build:
/usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-machine-target.c.o: in function `qmp_marshal_query_cpu_model_comparison':
/work/armbru/qemu/bld-x86/qapi/qapi-commands-machine-target.c:66:(.text+0x10c9): undefined reference to `qmp_query_cpu_model_comparison'
/usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-machine-target.c.o: in function `qmp_marshal_query_cpu_model_baseline':
/work/armbru/qemu/bld-x86/qapi/qapi-commands-machine-target.c:131:(.text+0x143c): undefined reference to `qmp_query_cpu_model_baseline'
/usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-machine-target.c.o: in function `qmp_marshal_set_cpu_topology':
/work/armbru/qemu/bld-x86/qapi/qapi-commands-machine-target.c:306:(.text+0x1de1): undefined reference to `qmp_set_cpu_topology'
/usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-machine-target.c.o: in function `qmp_marshal_query_s390x_cpu_polarization':
/work/armbru/qemu/bld-x86/qapi/qapi-commands-machine-target.c:362:(.text+0x20c6): undefined reference to `qmp_query_s390x_cpu_polarization'
/usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-misc-target.c.o: in function `qmp_marshal_query_gic_capabilities':
/work/armbru/qemu/bld-x86/qapi/qapi-commands-misc-target.c:393:(.text+0x2d2d): undefined reference to `qmp_query_gic_capabilities'
collect2: error: ld returned 1 exit status
The next commit fixes it. It then fails tests:
stdout:
--- /work/armbru/qemu/bld-x86/../tests/qapi-schema/unknown-expr-key.err
+++
@@ -1,3 +1,3 @@
unknown-expr-key.json: In struct 'Bar':
unknown-expr-key.json:2: struct has unknown keys 'bogus', 'phony'
-Valid keys are 'base', 'data', 'features', 'if', 'struct'.
+Valid keys are 'base', 'data', 'features', 'if', 'runtime_if', 'struct'.
stderr:
unknown-expr-key FAIL
Fixup:
diff --git a/tests/qapi-schema/unknown-expr-key.err b/tests/qapi-schema/unknown-expr-key.err
index f2538e3ce7..8184f3c768 100644
--- a/tests/qapi-schema/unknown-expr-key.err
+++ b/tests/qapi-schema/unknown-expr-key.err
@@ -1,3 +1,3 @@
unknown-expr-key.json: In struct 'Bar':
unknown-expr-key.json:2: struct has unknown keys 'bogus', 'phony'
-Valid keys are 'base', 'data', 'features', 'if', 'struct'.
+Valid keys are 'base', 'data', 'features', 'if', 'runtime_if', 'struct'.
^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-14 14:09 ` Markus Armbruster
@ 2025-05-14 16:50 ` Pierrick Bouvier
0 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-14 16:50 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
richard.henderson, pbonzini, jsnow, philmd, berrange, thuth,
Michael Roth
On 5/14/25 7:09 AM, Markus Armbruster wrote:
> Fails to build:
>
> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-machine-target.c.o: in function `qmp_marshal_query_cpu_model_comparison':
> /work/armbru/qemu/bld-x86/qapi/qapi-commands-machine-target.c:66:(.text+0x10c9): undefined reference to `qmp_query_cpu_model_comparison'
> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-machine-target.c.o: in function `qmp_marshal_query_cpu_model_baseline':
> /work/armbru/qemu/bld-x86/qapi/qapi-commands-machine-target.c:131:(.text+0x143c): undefined reference to `qmp_query_cpu_model_baseline'
> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-machine-target.c.o: in function `qmp_marshal_set_cpu_topology':
> /work/armbru/qemu/bld-x86/qapi/qapi-commands-machine-target.c:306:(.text+0x1de1): undefined reference to `qmp_set_cpu_topology'
> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-machine-target.c.o: in function `qmp_marshal_query_s390x_cpu_polarization':
> /work/armbru/qemu/bld-x86/qapi/qapi-commands-machine-target.c:362:(.text+0x20c6): undefined reference to `qmp_query_s390x_cpu_polarization'
> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/meson-generated_.._qapi_qapi-commands-misc-target.c.o: in function `qmp_marshal_query_gic_capabilities':
> /work/armbru/qemu/bld-x86/qapi/qapi-commands-misc-target.c:393:(.text+0x2d2d): undefined reference to `qmp_query_gic_capabilities'
> collect2: error: ld returned 1 exit status
>
> The next commit fixes it. It then fails tests:
>
Oops indeed, I wrongly ordered this when rebasing (stubs should come first).
> stdout:
> --- /work/armbru/qemu/bld-x86/../tests/qapi-schema/unknown-expr-key.err
> +++
> @@ -1,3 +1,3 @@
> unknown-expr-key.json: In struct 'Bar':
> unknown-expr-key.json:2: struct has unknown keys 'bogus', 'phony'
> -Valid keys are 'base', 'data', 'features', 'if', 'struct'.
> +Valid keys are 'base', 'data', 'features', 'if', 'runtime_if', 'struct'.
> stderr:
> unknown-expr-key FAIL
>
> Fixup:
>
> diff --git a/tests/qapi-schema/unknown-expr-key.err b/tests/qapi-schema/unknown-expr-key.err
> index f2538e3ce7..8184f3c768 100644
> --- a/tests/qapi-schema/unknown-expr-key.err
> +++ b/tests/qapi-schema/unknown-expr-key.err
> @@ -1,3 +1,3 @@
> unknown-expr-key.json: In struct 'Bar':
> unknown-expr-key.json:2: struct has unknown keys 'bogus', 'phony'
> -Valid keys are 'base', 'data', 'features', 'if', 'struct'.
> +Valid keys are 'base', 'data', 'features', 'if', 'runtime_if', 'struct'.
>
Yes, I noticed this test failure, but as mentioned in cover letter, I
let tests and doc out of the scope of this series.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 09/13] qapi: transform target specific 'if' in runtime checks
2025-05-14 7:13 ` Markus Armbruster
@ 2025-05-14 16:54 ` Pierrick Bouvier
0 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-14 16:54 UTC (permalink / raw)
To: Markus Armbruster
Cc: Daniel P. Berrangé, qemu-devel, alex.bennee, stefanha,
peter.maydell, richard.henderson, pbonzini, jsnow, philmd, thuth,
Michael Roth
On 5/14/25 12:13 AM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> On 5/13/25 12:08 AM, Markus Armbruster wrote:
>>> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>>>
>>>> On 5/9/25 11:57 PM, Markus Armbruster wrote:
>>>>>> The build system would need generate an input document for the
>>>>>> QAPI visitor that defines whether each constant is set to true
>>>>>> or false, based on suitable CONFIG/TARGET conditions from meson.
>>>>>
>>>>> I think the conditions that are evaluated at build time in handwritten C
>>>>> code (with #if) should also be evaluated at build time in generated C
>>>>> code.
>>>>>
>>>>> Certain conditions are evaluated at build time in target-specific code,
>>>>> and at runtime in target-independent code. Again, I think handwritten
>>>>> and generated code should work the same way.
>>>>>
>>>>> Thus, to eliminate target-specific QAPI-generated code, we either
>>>>> evaluate them at runtime, or simply eliminate them. Elsewhere, we've
>>>>> come to the conclusion (I think) that the latter should do at least for
>>>>> now, likely forever, so we should try that first.
>>>>>
>>>>
>>>> I'm not sure if you mean you'd prefer to eradicate #if completely.
>>>
>>> I do not!
>>>
>>>> We have to keep in mind that some config host #if have to stay there, or
>>>> they expose things that the rest of QEMU code is not supposed to see
>>>> (hidden under those same CONFIG_ ifdef also).
>>>
>>> Letting people configure their QEMU build is useful and must stay.
>>>
>>> We provide this via conditional compilation, of complete source files
>>> (done in meson), as well as within source files (#if in C and 'if' in
>>> QAPI).
>>>
>>>> So we would need both if and runtime_if.
>>>
>>> I don't understand the need for runtime_if. Can you give an example?
>>>
>>
>> That is the point of this whole series, which explores introducing a
>> 'runtime' if in the schema, to keep it as it is today, while removing
>> target specific compile time defines.
>
> Ah, I lost the wider context, sorry!
>
No worries, I was not sure if you missed information or simply waited
for more feedback, so I did well to ask you directly.
> We identified three ways to deal with target-specific conditionals in a
> single binary, and 'runtime_if' is one of them:
>
> (1) Drop target-specific conditionals.
>
> (2) Replace them by run-time checks.
>
> (3) Have target-specific QAPI-generated code for multiple targets
> coexist in the single binary.
>
> Both (2) and (3) keep the QAPI schema work as it does now. None of us
> likes (3) due to bloat and complexity.
>
> The other two look both workable to me. (2) keeps the QAPI schema work
> exactly as it does now. (1) is simpler, but the external interface
> changes somewhat. Its users seem to be okay with it.
>
> So let's go with (1).
>
Sounds good to me. I agree that Daniel approach is simpler and better as
well, as long as we accept the resulting changes in the schema, which
seems ok for users.
Thus, I'll drop current series, and focus on respinning Daniel series
and adding the changes requested.
>> It is another approach that one Daniel followed on his series.
>>
>> I invite you to give a quick read to this series, especially the related
>> commit introducing 'runtime_if'
>> (20250507231442.879619-2-pierrick.bouvier@linaro.org).
>
> I can't afford a thorough review now, but I'll have a look, and I will
> hold onto your series just in case.
>
>> As well, I would appreciate if you could state clearly where we are
>> going with all this (or at least, where you *don't* want this to go), so
>> we can avoid spending time in the wrong direction.
>
> The discussion was spread over multiple threads, which makes it hard to
> follow. I hope the conclusion is clear now. If not, please ask for
> further clarification.
>
Yes, I agree. At least we are all on the same page right now, I'll
pursue Daniel's approach.
>> I am ok to pursue Daniel's approach, or continue the approach in the
>> current series, no strong opinion in my side, I am just trying to move
>> QAPI generated code out of the way for the single binary goal.
>
> Understood!
>
Thanks Markus!
Pierrick
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json
2025-05-07 23:14 ` [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json Pierrick Bouvier
2025-05-08 6:53 ` Philippe Mathieu-Daudé
@ 2025-05-15 4:39 ` Markus Armbruster
2025-05-15 15:42 ` Pierrick Bouvier
1 sibling, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2025-05-15 4:39 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
richard.henderson, pbonzini, jsnow, philmd, berrange, thuth,
Michael Roth
Consensus is to shelve this series, and eliminate target-specific
conditionals instead. But let me scribble down a few notes for
posterity just in case we ever take it off the shelf again.
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> This new entry can be used in QAPI json to specify a runtime conditional
> to expose any entry, similar to existing 'if', that applies at compile
> time, thanks to ifdef. The element is always defined in C, but not
> exposed through the schema and visit functions, thus being hidden for a
> QMP consumer.
>
> QAPISchemaIfCond is extended to parse this information. A first version
> was tried duplicating this, but this proved to be much more boilerplate
> than needed to pass information through all function calls.
>
> 'if' and 'runtime_if' can be combined elegantly on a single item,
> allowing to restrict an element to be present based on compile time
> defines, and runtime checks at the same time.
I understand the combination is "and", i.e. both conditions need to be
satisfied.
The syntax change I'd consider elegant (it's subjective!) is *none*.
Instead of
'if': 'CONFIG_DINGS',
'runtime_if': 'target_bums()'
use
'if': ['all': ['CONFIG_DINGS', 'target_bums()']]
Might need semantic restrictions to simplify the implementation.
> Note: This commit only adds parsing of runtime_if, and does not hide
> anything yet.
>
> For review:
>
> - I don't really like "runtime_if" name.
> What would make sense, IMHO, is to rename existing 'if' to 'ifdef',
> and reuse 'if' for 'runtime_if'. Since it requires invasive changes, I
> would prefer to get agreement before wasting time in case you prefer
> any other naming convention. Let me know what you'd like.
>
> - As mentioned in second paragraph, I think our best implementation
> would be to extend existing QAPISchemaIfCond, as it's really
> complicated to extend all call sites if we have another new object.
I figure the alternative is an abstract type with two concrete subtypes,
one for each kind of conditional.
> - No tests/doc added at this time, as I prefer to wait that we decide
> about naming and proposed approach first.
We'd need
* Positive test(s) in tests/qapi-schema/qapi-schema-test.json
* Negative tests similar to the ones with have for 'if'
* Documentation update docs/devel/qapi-code-gen.rst
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json
2025-05-15 4:39 ` Markus Armbruster
@ 2025-05-15 15:42 ` Pierrick Bouvier
0 siblings, 0 replies; 37+ messages in thread
From: Pierrick Bouvier @ 2025-05-15 15:42 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, alex.bennee, stefanha, peter.maydell,
richard.henderson, pbonzini, jsnow, philmd, berrange, thuth,
Michael Roth
On 5/14/25 9:39 PM, Markus Armbruster wrote:
> Consensus is to shelve this series, and eliminate target-specific
> conditionals instead. But let me scribble down a few notes for
> posterity just in case we ever take it off the shelf again.
>
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> This new entry can be used in QAPI json to specify a runtime conditional
>> to expose any entry, similar to existing 'if', that applies at compile
>> time, thanks to ifdef. The element is always defined in C, but not
>> exposed through the schema and visit functions, thus being hidden for a
>> QMP consumer.
>>
>> QAPISchemaIfCond is extended to parse this information. A first version
>> was tried duplicating this, but this proved to be much more boilerplate
>> than needed to pass information through all function calls.
>>
>> 'if' and 'runtime_if' can be combined elegantly on a single item,
>> allowing to restrict an element to be present based on compile time
>> defines, and runtime checks at the same time.
>
> I understand the combination is "and", i.e. both conditions need to be
> satisfied.
>
Yes, if results in introduction of an ifdef, and runtime_if, an if.
#ifdef IF_CONDITION
if (runtime_if_condition()) {
...
}
#endif
> The syntax change I'd consider elegant (it's subjective!) is *none*.
> Instead of
>
> 'if': 'CONFIG_DINGS',
> 'runtime_if': 'target_bums()'
>
> use
>
> 'if': ['all': ['CONFIG_DINGS', 'target_bums()']]
>
Why not, but I don't see how to identify what would be an ifdef, vs what
is an if, and I don't think that using something like
"is_capital_letters" or "has_parentheses" is a good thing.
> Might need semantic restrictions to simplify the implementation.
>
>> Note: This commit only adds parsing of runtime_if, and does not hide
>> anything yet.
>>
>> For review:
>>
>> - I don't really like "runtime_if" name.
>> What would make sense, IMHO, is to rename existing 'if' to 'ifdef',
>> and reuse 'if' for 'runtime_if'. Since it requires invasive changes, I
>> would prefer to get agreement before wasting time in case you prefer
>> any other naming convention. Let me know what you'd like.
>>
>> - As mentioned in second paragraph, I think our best implementation
>> would be to extend existing QAPISchemaIfCond, as it's really
>> complicated to extend all call sites if we have another new object.
>
> I figure the alternative is an abstract type with two concrete subtypes,
> one for each kind of conditional.
>
>> - No tests/doc added at this time, as I prefer to wait that we decide
>> about naming and proposed approach first.
>
> We'd need
>
> * Positive test(s) in tests/qapi-schema/qapi-schema-test.json
>
> * Negative tests similar to the ones with have for 'if'
>
> * Documentation update docs/devel/qapi-code-gen.rst
>
As we decided to follow the approach (1) "Drop target-specific
conditionals", I will focus on the other series, and drop this one.
Thanks,
Pierrick
^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2025-05-15 15:43 UTC | newest]
Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json Pierrick Bouvier
2025-05-08 6:53 ` Philippe Mathieu-Daudé
2025-05-08 20:22 ` Pierrick Bouvier
2025-05-15 4:39 ` Markus Armbruster
2025-05-15 15:42 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 02/13] qapi/introspect: generate schema as a QObject directly Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 03/13] qobject/qlit: allow to hide dict or list entries Pierrick Bouvier
2025-05-08 14:21 ` Daniel P. Berrangé
2025-05-08 20:25 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 04/13] qapi/introspect: hide fields in schema Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 05/13] qapi/commands: register commands conditionally Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 06/13] qapi/visit: hide fields in JSON marshalling Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 07/13] qapi: add access to qemu/target-info.h Pierrick Bouvier
2025-05-08 6:57 ` Philippe Mathieu-Daudé
2025-05-07 23:14 ` [PATCH 08/13] qemu/target-info: implement missing helpers Pierrick Bouvier
2025-05-08 6:40 ` Philippe Mathieu-Daudé
2025-05-08 20:30 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 09/13] qapi: transform target specific 'if' in runtime checks Pierrick Bouvier
2025-05-08 6:44 ` Philippe Mathieu-Daudé
2025-05-08 14:40 ` Daniel P. Berrangé
2025-05-08 20:48 ` Pierrick Bouvier
2025-05-10 6:57 ` Markus Armbruster
2025-05-13 0:36 ` Pierrick Bouvier
2025-05-13 7:08 ` Markus Armbruster
2025-05-13 22:52 ` Pierrick Bouvier
2025-05-14 7:13 ` Markus Armbruster
2025-05-14 16:54 ` Pierrick Bouvier
2025-05-14 14:09 ` Markus Armbruster
2025-05-14 16:50 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 10/13] qapi: add weak stubs for target specific commands Pierrick Bouvier
2025-05-08 6:57 ` Philippe Mathieu-Daudé
2025-05-08 20:33 ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 11/13] qapi: make all generated files common Pierrick Bouvier
2025-05-08 6:57 ` Philippe Mathieu-Daudé
2025-05-07 23:14 ` [PATCH 13/13] [ANNEX] build/qapi: after series Pierrick Bouvier
2025-05-07 23:33 ` [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
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).