qapi: remove all TARGET_* conditionals from the schema
Subsystems (2)
cover qapi: remove all TARGET_* conditionals from the schema
Pierrick has proposed a series that introduces a concept of runtime conditionals to the QAPI schema, in order to adapt the TARGET_* conditionals currently used at build time:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01699.html
For the sake of comparison & evaluation, this series illustrates the alternative approach that we've discussed of entirely removing any concept of TARGET_* conditionals.
With this the QAPI schema varies solely based on CONFIG_* conditionals, and is thus invariant across different target emulators.
In this PoC I've taken the minimal effort approach to the problem.
The QAPI schema has removed the TARGET_* conditionals and in order to make all the emulators then compile, the stubs/ directory is populated with a bunch of files to provide dummy impls of the target specific QMP commands.
This is sufficient to make the current QEMU binaries build successfully.
To make the "single binary" concept work, however, would require additional followup work to eliminate the stubs.
Instead of having stubs we would need to de-couple the QMP command impl from the machine internals. This would likely require greater use of interfaces and/or virtual method dispatchers on the machine class. This would enable the 'qmp_XXXXX' command impls to exist once. Then they call out to virtual methods on the machine to provide the real impl, and/or generate an error if the virtual method is not implemented for the machine.
Daniel P. Berrangé (9):
qapi: expose rtc-reset-reinjection command unconditionally
qapi: expand docs for SEV commands
qapi: make SEV commands unconditionally available
qapi: expose query-gic-capability command unconditionally
qapi: make SGX commands unconditionally available
qapi: make Xen event commands unconditionally available
qapi: remove the misc-target.json file
qapi: make most CPU commands unconditionally available
qapi: make s390x specific CPU commands unconditionally available
Philippe Mathieu-Daudé (1):
qapi: Make CpuModelExpansionInfo::deprecated-props optional and
generic
hw/i386/kvm/xen-stubs.c | 13 - hw/i386/kvm/xen_evtchn.c | 2 +- hw/i386/monitor.c | 2 +- hw/i386/sgx-stub.c | 13 - hw/i386/sgx.c | 2 +- hw/s390x/cpu-topology.c | 4 +- hw/s390x/s390-skeys.c | 1 - include/hw/s390x/cpu-topology.h | 2 +- qapi/machine-s390x.json | 120 ++++++ qapi/machine-target.json | 523 -------------------------- qapi/machine.json | 363 ++++++++++++++++++ qapi/meson.build | 5 +- qapi/misc-arm.json | 49 +++ qapi/misc-i386.json | 479 +++++++++++++++++++++++ qapi/misc-target.json | 504 ------------------------- qapi/qapi-schema.json | 5 +- stubs/meson.build | 8 + stubs/monitor-arm-gic.c | 12 + stubs/monitor-cpu-s390x-kvm.c | 22 ++ stubs/monitor-cpu-s390x.c | 23 ++ stubs/monitor-cpu.c | 21 ++ stubs/monitor-i386-rtc.c | 10 + stubs/monitor-i386-sev.c | 36 ++ stubs/monitor-i386-sgx.c | 17 + stubs/monitor-i386-xen.c | 16 + target/arm/arm-qmp-cmds.c | 4 +- target/i386/cpu-system.c | 2 +- target/i386/cpu.c | 2 +- target/i386/monitor.c | 1 - target/i386/sev-system-stub.c | 32 -- target/i386/sev.c | 2 +- target/loongarch/loongarch-qmp-cmds.c | 2 +- target/mips/system/mips-qmp-cmds.c | 12 +- target/ppc/ppc-qmp-cmds.c | 12 +- target/riscv/riscv-qmp-cmds.c | 2 +- target/s390x/cpu_models_system.c | 2 +- tests/qtest/qmp-cmd-test.c | 1 + 37 files changed, 1219 insertions(+), 1107 deletions(-) create mode 100644 qapi/machine-s390x.json delete mode 100644 qapi/machine-target.json create mode 100644 qapi/misc-arm.json create mode 100644 qapi/misc-i386.json create mode 100644 stubs/monitor-arm-gic.c create mode 100644 stubs/monitor-cpu-s390x-kvm.c create mode 100644 stubs/monitor-cpu-s390x.c create mode 100644 stubs/monitor-cpu.c create mode 100644 stubs/monitor-i386-rtc.c create mode 100644 stubs/monitor-i386-sev.c create mode 100644 stubs/monitor-i386-sgx.c create mode 100644 stubs/monitor-i386-xen.c
Signature · 1 line
2.49.0
PATCH 1/10 qapi: expose rtc-reset-reinjection command unconditionally
This removes the TARGET_I386 condition from the rtc-reset-reinjection command. This requires providing a QMP command stub for non-i386 target. This in turn requires moving the command out of misc-target.json, since that will trigger symbol poisoning errors when built from target independent code.
Rather than putting the command into misc.json, it is proposed to create misc-$TARGET.json files to hold commands whose impl is conceptually only applicable to a single target. This gives an obvious docs hint to consumers that the command is only useful in relation a specific target, while misc.json is for commands applicable to 2 or more targets.
The current impl of qmp_rtc_reset_reinject() is a no-op if the i386 RTC is disabled in Kconfig, or if the running machine type lack any RTC device. Thus the stub impl for non-i386 targets retains this no-op behaviour, instead of reporting a Error which is the more usual choice for commands invoked against unsupported configurations.
--- hw/i386/monitor.c | 2 +- qapi/meson.build | 1 + qapi/misc-i386.json | 24 ++++++++++++++++++++++++ qapi/misc-target.json | 17 ----------------- qapi/qapi-schema.json | 1 + stubs/meson.build | 1 + stubs/monitor-i386-rtc.c | 10 ++++++++++ 7 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 qapi/misc-i386.json create mode 100644 stubs/monitor-i386-rtc.c
hw/i386/monitor.c +1 -1
@@ -26,7 +26,7 @@#include "monitor/monitor.h" #include "qobject/qdict.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qapi-commands-misc-i386.h" #include "hw/i386/x86.h" #include "hw/rtc/mc146818rtc.h"
qapi/meson.build +1 -0
@@ -64,6 +64,7 @@ if have_system 'qdev', 'pci', 'rocker', + 'misc-i386', 'tpm', 'uefi', ]
qapi/misc-i386.json new file +24 -0
@@ -0,0 +1,24 @@ +# -*- Mode: Python -*- +# vim: filetype=python +# +# SPDX-License-Identifier: GPL-2.0-or-later + +## +# @rtc-reset-reinjection: +# +# This command will reset the RTC interrupt reinjection backlog. Can +# be used if another mechanism to synchronize guest time is in effect, +# for example QEMU guest agent's guest-set-time command. +# +# Use of this command is only applicable for x86 machines with an RTC, +# and on other machines will silently return without performing any +# action. +# +# Since: 2.1 +# +# .. qmp-example:: +# +# -> { "execute": "rtc-reset-reinjection" } +# <- { "return": {} } +## +{ 'command': 'rtc-reset-reinjection' }
qapi/misc-target.json +0 -17
@@ -2,23 +2,6 @@ # vim: filetype=python # -## -# @rtc-reset-reinjection: -# -# This command will reset the RTC interrupt reinjection backlog. Can -# be used if another mechanism to synchronize guest time is in effect, -# for example QEMU guest agent's guest-set-time command. -# -# Since: 2.1 -# -# .. qmp-example:: -# -# -> { "execute": "rtc-reset-reinjection" } -# <- { "return": {} } -## -{ 'command': 'rtc-reset-reinjection', - 'if': 'TARGET_I386' } - ## # @SevState: #
qapi/qapi-schema.json +1 -0
@@ -61,6 +61,7 @@ { 'include': 'replay.json' } { 'include': 'yank.json' } { 'include': 'misc.json' } +{ 'include': 'misc-i386.json' } { 'include': 'misc-target.json' } { 'include': 'audio.json' } { 'include': 'acpi.json' }
stubs/meson.build +1 -0
@@ -77,6 +77,7 @@ if have_system stub_ss.add(files('target-monitor-defs.c')) stub_ss.add(files('win32-kbd-hook.c')) stub_ss.add(files('xen-hw-stub.c')) + stub_ss.add(files('monitor-i386-rtc.c')) endif if have_system or have_user
stubs/monitor-i386-rtc.c new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-i386.h" + +void qmp_rtc_reset_reinjection (Error **errp) +{ +/* Nothing to do since non-x86 machines lack an RTC */ +}
Signature · 1 line
2.49.0
Re: [PATCH 01/10] qapi: expose rtc-reset-reinjection command unconditionally
Quoted 11 lines · Daniel P. Berrangé
This removes the
TARGET_I386condition from the rtc-reset-reinjection command. This requires providing a QMP command stub for non-i386 target. This in turn requires moving the command out of misc-target.json, since that will trigger symbol poisoning errors when built from target independent code.Rather than putting the command into misc.json, it is proposed to create misc-$TARGET.json files to hold commands whose impl is conceptually only applicable to a single target. This gives an obvious docs hint to consumers that the command is only useful in relation a specific target, while misc.json is for commands applicable to 2 or more targets.
Starting with this patch, the series structures the manual like this:
= Machines
... contents of machine.json ...
== Specific to S390
... contents of machine-s390.json ...and
= Miscellanea
... contents of misc.json ...
== Specific to ARM
... contents of misc-arm.json ...
== Specific to i386
... contents of misc-i386.json ...Except it doesn't add == subsection headers, but that's detail. The text I show for them here is crap.
Possible alternative: collect the target-specific stuff in one place rather than two:
= Targets
== ARM
== i386
== S390Again the header text is crap.
Is separating the current contents of misc-<target>.json from machine-<target>.json useful?
Quoted 50 lines
The current impl of
qmp_rtc_reset_reinject()is a no-op if the i386 RTC is disabled inKconfig, or if the running machine type lack any RTC device. Thus the stub impl for non-i386 targets retains this no-op behaviour, instead of reporting a Error which is the more usual choice for commands invoked against unsupported configurations.Signed-off-by Daniel P. Berrangé <[email protected]>--- hw/i386/monitor.c | 2 +- qapi/meson.build | 1 + qapi/misc-i386.json | 24 ++++++++++++++++++++++++ qapi/misc-target.json | 17 ----------------- qapi/qapi-schema.json | 1 + stubs/meson.build | 1 + stubs/monitor-i386-rtc.c | 10 ++++++++++ 7 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 qapi/misc-i386.json create mode 100644 stubs/monitor-i386-rtc.chw/i386/monitor.c +1
-1@@ -26,7 +26,7 @@#include "monitor/monitor.h" #include "qobject/qdict.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qapi-commands-misc-i386.h" #include "hw/i386/x86.h" #include "hw/rtc/mc146818rtc.h" qapi/meson.build +1
-0@@ -64,6 +64,7 @@ if have_system 'qdev', 'pci', 'rocker', + 'misc-i386', 'tpm', 'uefi', ]qapi/misc-i386.json new file +0
-0
qapi/misc-i386.json line 4
Quoted 4 lines
qapi/misc-i386.json new file +4
-0@@ -0,0 +1,24 @@ +# -*- Mode: Python -*- +# vim: filetype=python +# +# SPDX-License-Identifier: GPL-2.0-or-later
Might be cleaner to add this to all qapi/*.json first, and in a separate patch.
qapi/misc-i386.json line 15
Quoted 11 lines
qapi/misc-i386.json new file +11
-0+ +## +# @rtc-reset-reinjection: +# +# This command will reset the RTC interrupt reinjection backlog. Can +# be used if another mechanism to synchronize guest time is in effect, +# for example QEMU guest agent's guest-set-time command. +# +# Use of this command is only applicable for x86 machines with an RTC, +# and on other machines will silently return without performing any +# action.
This paragraph replaces ...
Quoted 23 lines
qapi/misc-i386.json new file +9
-0+# +# Since: 2.1 +# +# .. qmp-example:: +# +# -> { "execute": "rtc-reset-reinjection" } +# <- { "return": {} } +## +{ 'command': 'rtc-reset-reinjection' }qapi/misc-target.json +0
-6@@ -2,23 +2,6 @@ # vim: filetype=python # -## -# @rtc-reset-reinjection: -# -# This command will reset the RTC interrupt reinjection backlog. Can -# be used if another mechanism to synchronize guest time is in effect, -# for example QEMU guest agent's guest-set-time command.
qapi/misc-target.json line 20
Quoted 10 lines
qapi/misc-target.json +0
-10-# -# Since: 2.1 -# -# .. qmp-example:: -# -# -> { "execute": "rtc-reset-reinjection" } -# <- { "return": {} } -## -{ 'command': 'rtc-reset-reinjection', - 'if': 'TARGET_I386' }
... the conditional.
Before, attempting to execute the command fails with CommandNotFound.
Afterwards it succeeds without doing anything. I think it should fail instead. CommandNotFound would be a lie, so change it to GenericError.
"Specific to target" is no longer machine-readable. Should machine-readability be (or become) desirable, we could expose it via suitable QAPI features, e.g. 'features': ['target-i386'].
Quoted 34 lines
qapi/misc-target.json +0
-1- ## # @SevState: #qapi/qapi-schema.json +1
-0@@ -61,6 +61,7 @@ { 'include': 'replay.json' } { 'include': 'yank.json' } { 'include': 'misc.json' } +{ 'include': 'misc-i386.json' } { 'include': 'misc-target.json' } { 'include': 'audio.json' } { 'include': 'acpi.json' }stubs/meson.build +1
-0@@ -77,6 +77,7 @@ if have_system stub_ss.add(files('target-monitor-defs.c')) stub_ss.add(files('win32-kbd-hook.c')) stub_ss.add(files('xen-hw-stub.c')) + stub_ss.add(files('monitor-i386-rtc.c')) endif if have_system or have_userstubs/monitor-i386-rtc.c new file +0
-0
stubs/monitor-i386-rtc.c line 10
Quoted 10 lines
stubs/monitor-i386-rtc.c new file +10
-0@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-i386.h" + +void qmp_rtc_reset_reinjection (Error **errp) +{ +/* Nothing to do since non-x86 machines lack an RTC */ +}
I think I'd create one stub file per qapi/<foo>-<target>.json.
Re: [PATCH 01/10] qapi: expose rtc-reset-reinjection command unconditionally
Quoted 41 lines · Markus Armbruster
Quoted 11 lines · Daniel P. Berrangé
This removes the
TARGET_I386condition from the rtc-reset-reinjection command. This requires providing a QMP command stub for non-i386 target. This in turn requires moving the command out of misc-target.json, since that will trigger symbol poisoning errors when built from target independent code.Rather than putting the command into misc.json, it is proposed to create misc-$TARGET.json files to hold commands whose impl is conceptually only applicable to a single target. This gives an obvious docs hint to consumers that the command is only useful in relation a specific target, while misc.json is for commands applicable to 2 or more targets.
Starting with this patch, the series structures the manual like this:
= Machines ... contents of machine.json ... == Specific to S390 ... contents of machine-s390.json ...and
= Miscellanea ... contents of misc.json ... == Specific to ARM ... contents of misc-arm.json ... == Specific to i386 ... contents of misc-i386.json ...Except it doesn't add == subsection headers, but that's detail. The text I show for them here is crap.
Possible alternative: collect the target-specific stuff in one place rather than two:
= Targets == ARM == i386 == S390
Quoted 4 lines
Again the header text is crap.
Is separating the current contents of misc-<target>.json from machine-<target>.json useful?
I'm fairly confused what the intended difference is between stuff in 'misc.json' and stuff in 'machine.json' already, and just preserved that split rather than try to think about it in more detail.
Quoted 5 lines
Quoted 5 lines
qapi/misc-i386.json new file +0
-0
Quoted 8 lines
qapi/misc-i386.json line 4
Quoted 5 lines
qapi/misc-i386.json new file +4
-0@@ -0,0 +1,24 @@ +# -*- Mode: Python -*- +# vim: filetype=python +# +# SPDX-License-Identifier: GPL-2.0-or-laterMight be cleaner to add this to all qapi/*.json first, and in a separate patch.
Adding SPDX-License-Identifier to existing files is something we're not generally doing, only newly created files are getting it.
Quoted 50 lines
qapi/misc-i386.json line 15
Quoted 11 lines
qapi/misc-i386.json new file +11
-0+ +## +# @rtc-reset-reinjection: +# +# This command will reset the RTC interrupt reinjection backlog. Can +# be used if another mechanism to synchronize guest time is in effect, +# for example QEMU guest agent's guest-set-time command. +# +# Use of this command is only applicable for x86 machines with an RTC, +# and on other machines will silently return without performing any +# action.This paragraph replaces ...
Quoted 23 lines
qapi/misc-i386.json new file +9
-0+# +# Since: 2.1 +# +# .. qmp-example:: +# +# -> { "execute": "rtc-reset-reinjection" } +# <- { "return": {} } +## +{ 'command': 'rtc-reset-reinjection' }qapi/misc-target.json +0
-6@@ -2,23 +2,6 @@ # vim: filetype=python # -## -# @rtc-reset-reinjection: -# -# This command will reset the RTC interrupt reinjection backlog. Can -# be used if another mechanism to synchronize guest time is in effect, -# for example QEMU guest agent's guest-set-time command.qapi/misc-target.json line 20
Quoted 10 lines
qapi/misc-target.json +0
-10-# -# Since: 2.1 -# -# .. qmp-example:: -# -# -> { "execute": "rtc-reset-reinjection" } -# <- { "return": {} } -## -{ 'command': 'rtc-reset-reinjection', - 'if': 'TARGET_I386' }... the conditional.
Quoted 4 lines
Before, attempting to execute the command fails with CommandNotFound.
Afterwards it succeeds without doing anything. I think it should fail instead. CommandNotFound would be a lie, so change it to GenericError.
See also my comment in the commit message that this has different behaviour on x86 vs non-x86, when no RTC is present - x86 treats "no RTC" as a no-op, but non-x86 treats it as an error.
I don't mind if we preserve this inconsistency though.
Quoted 10 lines
Quoted 10 lines
stubs/monitor-i386-rtc.c new file +4
-0@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h"
Quoted 8 lines
stubs/monitor-i386-rtc.c line 10
Quoted 6 lines
stubs/monitor-i386-rtc.c new file +6
-0+#include "qapi/qapi-commands-misc-i386.h" + +void qmp_rtc_reset_reinjection (Error **errp) +{ +/* Nothing to do since non-x86 machines lack an RTC */ +}I think I'd create one stub file per qapi/<foo>-<target>.json.
That's what I started doing but I forgot that doesn't work out well with the linker.
The linker's granularity for dropping stubs is per-file, not per-symbol.
If /any/ method in a stub/nnn.c file is needed, the linker will pull in all methods. This results in duplicate symbol errors if only a subset of stub methods were actually needed.
This forces us to have a separate stub file per build configuration scenario that can affect use of stubs.
With regards,
Daniel
Signature · 3 lines
|: 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 :|
Re: [PATCH 01/10] qapi: expose rtc-reset-reinjection command unconditionally
Quoted 19 lines · Daniel P. Berrangé
Quoted 10 lines
Quoted 10 lines
stubs/monitor-i386-rtc.c new file +4
-0@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" Quoted 8 lines
stubs/monitor-i386-rtc.c line 10
Quoted 6 lines
stubs/monitor-i386-rtc.c new file +6
-0+#include "qapi/qapi-commands-misc-i386.h" + +void qmp_rtc_reset_reinjection (Error **errp) +{ +/* Nothing to do since non-x86 machines lack an RTC */ +}I think I'd create one stub file per qapi/<foo>-<target>.json.
Quoted 9 lines
That's what I started doing but I forgot that doesn't work out well with the linker.
The linker's granularity for dropping stubs is per-file, not per-symbol.
If /any/ method in a
stub/nnn.cfile is needed, the linker will pull in all methods. This results in duplicate symbol errors if only a subset of stub methods were actually needed.
Richard mentioned this behaviour as well, but I could not see where it is implemented in our build system.
The only thing possibly related is the undefsyms mechanic, but from what I understand, it's only for ensuring modules can be linked.
Quoted 5 lines
This forces us to have a separate stub file per build configuration scenario that can affect use of stubs.
With regards,
Daniel
Re: [PATCH 01/10] qapi: expose rtc-reset-reinjection command unconditionally
Quoted 30 lines · Pierrick Bouvier
Quoted 19 lines · Daniel P. Berrangé
Quoted 10 lines
Quoted 10 lines
stubs/monitor-i386-rtc.c new file +4
-0@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" Quoted 8 lines
stubs/monitor-i386-rtc.c line 10
Quoted 6 lines
stubs/monitor-i386-rtc.c new file +6
-0+#include "qapi/qapi-commands-misc-i386.h" + +void qmp_rtc_reset_reinjection (Error **errp) +{ +/* Nothing to do since non-x86 machines lack an RTC */ +}I think I'd create one stub file per qapi/<foo>-<target>.json.
Quoted 9 lines
That's what I started doing but I forgot that doesn't work out well with the linker.
The linker's granularity for dropping stubs is per-file, not per-symbol.
If /any/ method in a
stub/nnn.cfile is needed, the linker will pull in all methods. This results in duplicate symbol errors if only a subset of stub methods were actually needed.
Quoted 6 lines
Richard mentioned this behaviour as well, but I could not see where it is implemented in our build system.
The only thing possibly related is the undefsyms mechanic, but from what I understand, it's only for ensuring modules can be linked.
Answer: it's an implicit behaviour, due to the fact libqemuutil is built as a (real) static library, so the linker only adds code as needed.
Quoted 6 lines
Quoted 5 lines
This forces us to have a separate stub file per build configuration scenario that can affect use of stubs.
With regards,
Daniel
Re: [PATCH 01/10] qapi: expose rtc-reset-reinjection command unconditionally
In reply to Daniel P. BerrangéQuoted 44 lines · Daniel P. Berrangé
Quoted 43 lines · Markus Armbruster
Quoted 11 lines · Daniel P. Berrangé
This removes the
TARGET_I386condition from the rtc-reset-reinjection command. This requires providing a QMP command stub for non-i386 target. This in turn requires moving the command out of misc-target.json, since that will trigger symbol poisoning errors when built from target independent code.Rather than putting the command into misc.json, it is proposed to create misc-$TARGET.json files to hold commands whose impl is conceptually only applicable to a single target. This gives an obvious docs hint to consumers that the command is only useful in relation a specific target, while misc.json is for commands applicable to 2 or more targets.
Starting with this patch, the series structures the manual like this:
= Machines ... contents of machine.json ... == Specific to S390 ... contents of machine-s390.json ...and
= Miscellanea ... contents of misc.json ... == Specific to ARM ... contents of misc-arm.json ... == Specific to i386 ... contents of misc-i386.json ...Except it doesn't add == subsection headers, but that's detail. The text I show for them here is crap.
Possible alternative: collect the target-specific stuff in one place rather than two:
= Targets == ARM == i386 == S390Again the header text is crap.
Quoted 7 lines
Quoted 2 lines
Is separating the current contents of misc-<target>.json from machine-<target>.json useful?
I'm fairly confused what the intended difference is between stuff in 'misc.json' and stuff in 'machine.json' already, and just preserved that split rather than try to think about it in more detail.
Fair enough, we can always rearrange things on top.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
The current impl of
qmp_rtc_reset_reinject()is a no-op if the i386 RTC is disabled inKconfig, or if the running machine type lack any RTC device. Thus the stub impl for non-i386 targets retains this no-op behaviour, instead of reporting a Error which is the more usual choice for commands invoked against unsupported configurations.Signed-off-by Daniel P. Berrangé <[email protected]>
[...]
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
qapi/misc-i386.json new file +0
-0Quoted 8 lines
qapi/misc-i386.json line 4
Quoted 5 lines
qapi/misc-i386.json new file +4
-0@@ -0,0 +1,24 @@ +# -*- Mode: Python -*- +# vim: filetype=python +# +# SPDX-License-Identifier: GPL-2.0-or-laterMight be cleaner to add this to all qapi/*.json first, and in a separate patch.
Quoted 2 lines
Adding SPDX-License-Identifier to existing files is something we're not generally doing, only newly created files are getting it.
I see.
Code motion between files where the license isn't obviously the same gives me pause.
Quoted 52 lines
Quoted 52 lines
qapi/misc-i386.json line 15
Quoted 11 lines
qapi/misc-i386.json new file +11
-0+ +## +# @rtc-reset-reinjection: +# +# This command will reset the RTC interrupt reinjection backlog. Can +# be used if another mechanism to synchronize guest time is in effect, +# for example QEMU guest agent's guest-set-time command. +# +# Use of this command is only applicable for x86 machines with an RTC, +# and on other machines will silently return without performing any +# action.This paragraph replaces ...
Quoted 23 lines
qapi/misc-i386.json new file +9
-0+# +# Since: 2.1 +# +# .. qmp-example:: +# +# -> { "execute": "rtc-reset-reinjection" } +# <- { "return": {} } +## +{ 'command': 'rtc-reset-reinjection' }qapi/misc-target.json +0
-6@@ -2,23 +2,6 @@ # vim: filetype=python # -## -# @rtc-reset-reinjection: -# -# This command will reset the RTC interrupt reinjection backlog. Can -# be used if another mechanism to synchronize guest time is in effect, -# for example QEMU guest agent's guest-set-time command.qapi/misc-target.json line 20
Quoted 10 lines
qapi/misc-target.json +0
-10-# -# Since: 2.1 -# -# .. qmp-example:: -# -# -> { "execute": "rtc-reset-reinjection" } -# <- { "return": {} } -## -{ 'command': 'rtc-reset-reinjection', - 'if': 'TARGET_I386' }... the conditional.
Before, attempting to execute the command fails with CommandNotFound.
Quoted 8 lines
Quoted 2 lines
Afterwards it succeeds without doing anything. I think it should fail instead. CommandNotFound would be a lie, so change it to GenericError.
See also my comment in the commit message that this has different behaviour on x86 vs non-x86, when no RTC is present - x86 treats "no RTC" as a no-op, but non-x86 treats it as an error.
I don't mind if we preserve this inconsistency though.
I see.
The command is a mess. It goes back to commit f2ae8abf1fa (mc146818rtc:
add rtc-reset-reinjection QMP command). Here's the commit message's rationale:
It is necessary to reset RTC interrupt reinjection backlog if guest time is synchronized via a different mechanism, such as QGA's guest-set-time command.
Failing to do so causes both corrections to be applied (summed), resulting in an incorrect guest time.
Plausible enough, but why is the solution limited to target i386 machines with an MC146818 RTC? I think I found the answer in recent commit d0be0ac2c37 (hw/i386: move rtc-reset-reinjection command out of hw/rtc):
The rtc-reset-reinjection QMP command is specific to x86, other boards do not have the ACK tracking functionality that is needed for RTC interrupt reinjection. Therefore the QMP command is only included in x86, but qmp_rtc_reset_reinjection() is implemented by hw/rtc/mc146818rtc.c and requires tracking of all created RTC devices. Move the implementation to hw/i386, so that 1) it is available even if no RTC device exist
2) the only RTC that exists is easily found in x86ms->rtc.
So, the time sync problem is serious enough for us to provide a solution, but it's only serious enough for i386 machines that use the RTC most common there. This makes no sense to me.
Code:
void qmp_rtc_reset_reinjection(Error **errp)
{
X86MachineState *x86ms = X86_MACHINE(qdev_get_machine());
#ifdef CONFIG_MC146818RTC
if (x86ms->rtc) {
rtc_reset_reinjection(MC146818_RTC(x86ms->rtc));
}
#else
assert(!x86ms->rtc);
#endif
}Behavior:
* target other than i386: CommandNotFound
* else if the machine's ->rtc is null: silently do nothing
* else if CONFIG_MC146818RTC: works as advertized as long ->rtc is an MC146818, else crash
* else: crash
WTF!?!
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
stubs/monitor-i386-rtc.c new file +1
-0@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */
Quoted 8 lines
Quoted 8 lines
stubs/monitor-i386-rtc.c line 9
Quoted 8 lines
stubs/monitor-i386-rtc.c new file +8
-0+ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-i386.h" + +void qmp_rtc_reset_reinjection (Error **errp) +{ +/* Nothing to do since non-x86 machines lack an RTC */
The comment is wrong: pretty much all machines do have a real time clock.
Quoted 7 lines
Quoted 3 lines
stubs/monitor-i386-rtc.c line 10
Quoted 1 line
stubs/monitor-i386-rtc.c new file +1
-0+}I think I'd create one stub file per qapi/<foo>-<target>.json.
That's what I started doing but I forgot that doesn't work out well with the linker.
Quoted 8 lines
The linker's granularity for dropping stubs is per-file, not per-symbol.
If /any/ method in a
stub/nnn.cfile is needed, the linker will pull in all methods. This results in duplicate symbol errors if only a subset of stub methods were actually needed.This forces us to have a separate stub file per build configuration scenario that can affect use of stubs.
You're right.
PATCH 2/10 qapi: expand docs for SEV commands
In reply to Daniel P. BerrangéThis gives some more context about the behaviour of the commands in unsupported guest configuration or platform scenarios.
--- qapi/misc-target.json | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)
qapi/misc-target.json +36 -7
@@ -110,7 +110,11 @@ ## # @query-sev: # -# Returns information about SEV +# Returns information about SEV/SEV-ES/SEV-SNP. +# +# If unavailable due to an incompatible configuration the +# returned @enabled field will be set to 'false' and the +# state of all other fields is undefined. # # Returns: @SevInfo #
@@ -141,7 +145,16 @@ ## # @query-sev-launch-measure: # -# Query the SEV guest launch information. +# Query the SEV/SEV-ES guest launch information. +# +# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. The launch +# measurement for SEV-SNP guests is only available within +# the guest. +# +# This will return an error if the launch measurement is +# unavailable, either due to an invalid guest configuration +# or if the guest has not reached the required SEV state. # # Returns: The @SevLaunchMeasureInfo for the guest #
@@ -185,8 +198,9 @@ ## # @query-sev-capabilities: # -# This command is used to get the SEV capabilities, and is supported -# on AMD X86 platforms only. +# This command is used to get the SEV capabilities, and is only +# supported on AMD X86 platforms with KVM enabled. If SEV is not +# available on the platform an error will be returned. # # Returns: SevCapability objects. #
@@ -205,7 +219,15 @@ ## # @sev-inject-launch-secret: # -# This command injects a secret blob into memory of SEV guest. +# This command injects a secret blob into memory of a SEV/SEV-ES guest. +# +# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. SEV-SNP guests +# do not support launch secret injection +# +# This will return an error if launch secret injection is not possible, +# either due to an invalid guest configuration, or if the guest has not +# reached the required SEV state. # # @packet-header: the launch secret packet header encoded in base64 #
@@ -236,8 +258,15 @@ ## # @query-sev-attestation-report: # -# This command is used to get the SEV attestation report, and is -# supported on AMD X86 platforms only. +# This command is used to get the SEV attestation report. +# +# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. The attestation +# report for SEV-SNP guests is only available within the guest. +# +# This will return an error if the attestation report is +# unavailable, either due to an invalid guest configuration +# or if the guest has not reached the required SEV state. # # @mnonce: a random 16 bytes value encoded in base64 (it will be # included in report)
Signature · 1 line
2.49.0
Re: [PATCH 02/10] qapi: expand docs for SEV commands
Quoted 13 lines · Daniel P. Berrangé
This gives some more context about the behaviour of the commands in unsupported guest configuration or platform scenarios.
Signed-off-by Daniel P. Berrangé <[email protected]>--- qapi/misc-target.json | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)qapi/misc-target.json +0
-0
qapi/misc-target.json line 117
Quoted 9 lines
qapi/misc-target.json +5
-1@@ -110,7 +110,11 @@ ## # @query-sev: # -# Returns information about SEV +# Returns information about SEV/SEV-ES/SEV-SNP. +# +# If unavailable due to an incompatible configuration the +# returned @enabled field will be set to 'false' and the +# state of all other fields is undefined.
That's awful. Not this patch's fault.
What's "incompatible configuration"?
Actual behavior as far as I can tell:
* If !CONFIG_SEV: GenericError "SEV is not available in this QEMU".
* If CONFIG_SEV and !sev_enabled(): SevInfo filled with zero bytes
* If CONFIG_SEV and sev_enabled(): SevInfo filled properly
sev_enabled() is true when the machine's cgs member is an instance of "sev-common".
Quoted 22 lines
qapi/misc-target.json +10
-1# # Returns: @SevInfo #@@ -141,7 +145,16 @@ ## # @query-sev-launch-measure: # -# Query the SEV guest launch information. +# Query the SEV/SEV-ES guest launch information. +# +# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. The launch +# measurement for SEV-SNP guests is only available within +# the guest. +# +# This will return an error if the launch measurement is +# unavailable, either due to an invalid guest configuration +# or if the guest has not reached the required SEV state. # # Returns: The @SevLaunchMeasureInfo for the guest #
qapi/misc-target.json line 203
Quoted 8 lines
qapi/misc-target.json +3
-2@@ -185,8 +198,9 @@ ## # @query-sev-capabilities: # -# This command is used to get the SEV capabilities, and is supported -# on AMD X86 platforms only. +# This command is used to get the SEV capabilities, and is only +# supported on AMD X86 platforms with KVM enabled. If SEV is not +# available on the platform an error will be returned.
What does "not supported" mean here?
Quoted 28 lines
qapi/misc-target.json +11
-3# # Returns: SevCapability objects. #@@ -205,7 +219,15 @@ ## # @sev-inject-launch-secret: # -# This command injects a secret blob into memory of SEV guest. +# This command injects a secret blob into memory of a SEV/SEV-ES guest. +# +# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. SEV-SNP guests +# do not support launch secret injection +# +# This will return an error if launch secret injection is not possible, +# either due to an invalid guest configuration, or if the guest has not +# reached the required SEV state. # # @packet-header: the launch secret packet header encoded in base64 #@@ -236,8 +258,15 @@ ## # @query-sev-attestation-report: # -# This command is used to get the SEV attestation report, and is -# supported on AMD X86 platforms only. +# This command is used to get the SEV attestation report. +#
qapi/misc-target.json line 272
Quoted 10 lines
qapi/misc-target.json +7
-0+# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. The attestation +# report for SEV-SNP guests is only available within the guest. +# +# This will return an error if the attestation report is +# unavailable, either due to an invalid guest configuration +# or if the guest has not reached the required SEV state. # # @mnonce: a random 16 bytes value encoded in base64 (it will be # included in report)
Strict improvemement already, so
Re: [PATCH 02/10] qapi: expand docs for SEV commands
Quoted 10 lines · Markus Armbruster
Quoted 8 lines · Daniel P. Berrangé
This gives some more context about the behaviour of the commands in unsupported guest configuration or platform scenarios.
Signed-off-by Daniel P. Berrangé <[email protected]>--- qapi/misc-target.json | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)
Quoted 16 lines
Quoted 5 lines
qapi/misc-target.json +0
-0qapi/misc-target.json line 117
Quoted 9 lines
qapi/misc-target.json +5
-1@@ -110,7 +110,11 @@ ## # @query-sev: # -# Returns information about SEV +# Returns information about SEV/SEV-ES/SEV-SNP. +# +# If unavailable due to an incompatible configuration the +# returned @enabled field will be set to 'false' and the +# state of all other fields is undefined.That's awful. Not this patch's fault.
Yep, IMHO, all the fields except 'enabled' should have been optional, and omitted when @enabled==false. Probably too later
Quoted 1 line
What's "incompatible configuration"?
Essentially it'll only set values for the extra fields beyond @enabled when a configuration includes the following:
'-object sev-guest,id=sev -machine ...,confidential-guest-support=sev"
(or sev-snp-guest object)
Quoted 5 lines
Actual behavior as far as I can tell:
* If !CONFIG_SEV: GenericError "SEV is not available in this QEMU".
* If
CONFIG_SEVand !sev_enabled(): SevInfo filled with zero bytes
Having these two scenarios be different feels wrong to me - they are both "SEV not enabled" scenarios IMHO, and whether or not SEV is enabled should be irrelevant.
A difference is justified in query-sev-capabilities as that's a feature probing method, where as this one is a runtime state query method.
Quoted 4 lines
* If
CONFIG_SEVandsev_enabled(): SevInfo filled properly
sev_enabled()is true when the machine's cgs member is an instance of "sev-common".
Yep.
Quoted 11 lines
qapi/misc-target.json line 203
Quoted 9 lines
qapi/misc-target.json +3
-2@@ -185,8 +198,9 @@ ## # @query-sev-capabilities: # -# This command is used to get the SEV capabilities, and is supported -# on AMD X86 platforms only. +# This command is used to get the SEV capabilities, and is only +# supported on AMD X86 platforms with KVM enabled. If SEV is not +# available on the platform an error will be returned.What does "not supported" mean here?
Any of at least:
* Not x86 system target
* Not KVM accelerator
* No SEV in host kernel
* No SEV in host CPUs
* SEV not enabled in host UEFI
* /dev/sev device not accessible / not present
With regards,
Daniel
Signature · 3 lines
|: 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 :|
PATCH 3/10 qapi: make SEV commands unconditionally available
In reply to Daniel P. BerrangéThis removes the TARGET_I386 condition from the SEV confidential virtualization commands, moving them to the recently introduced misc-i386.json QAPI file, given they are inherantly i386 specific commands.
--- qapi/misc-i386.json | 271 ++++++++++++++++++++++++++++++++ qapi/misc-target.json | 284 ---------------------------------- stubs/meson.build | 1 + stubs/monitor-i386-sev.c | 36 +++++ target/i386/sev-system-stub.c | 32 ---- target/i386/sev.c | 2 +- 6 files changed, 309 insertions(+), 317 deletions(-) create mode 100644 stubs/monitor-i386-sev.c
qapi/misc-i386.json +271 -0
@@ -22,3 +22,274 @@ # <- { "return": {} } ## { 'command': 'rtc-reset-reinjection' } + +## +# @SevState: +# +# An enumeration of SEV state information used during @query-sev. +# +# @uninit: The guest is uninitialized. +# +# @launch-update: The guest is currently being launched; plaintext +# data and register state is being imported. +# +# @launch-secret: The guest is currently being launched; ciphertext +# data is being imported. +# +# @running: The guest is fully launched or migrated in. +# +# @send-update: The guest is currently being migrated out to another +# machine. +# +# @receive-update: The guest is currently being migrated from another +# machine. +# +# Since: 2.12 +## +{ 'enum': 'SevState', + 'data': ['uninit', 'launch-update', 'launch-secret', 'running', + 'send-update', 'receive-update' ] } + +## +# @SevGuestType: +# +# An enumeration indicating the type of SEV guest being run. +# +# @sev: The guest is a legacy SEV or SEV-ES guest. +# +# @sev-snp: The guest is an SEV-SNP guest. +# +# Since: 6.2 +## +{ 'enum': 'SevGuestType', + 'data': [ 'sev', 'sev-snp' ] } + +## +# @SevGuestInfo: +# +# Information specific to legacy SEV/SEV-ES guests. +# +# @policy: SEV policy value +# +# @handle: SEV firmware handle +# +# Since: 2.12 +## +{ 'struct': 'SevGuestInfo', + 'data': { 'policy': 'uint32', + 'handle': 'uint32' } } + +## +# @SevSnpGuestInfo: +# +# Information specific to SEV-SNP guests. +# +# @snp-policy: SEV-SNP policy value +# +# Since: 9.1 +## +{ 'struct': 'SevSnpGuestInfo', + 'data': { 'snp-policy': 'uint64' } } + +## +# @SevInfo: +# +# Information about Secure Encrypted Virtualization (SEV) support +# +# @enabled: true if SEV is active +# +# @api-major: SEV API major version +# +# @api-minor: SEV API minor version +# +# @build-id: SEV FW build id +# +# @state: SEV guest state +# +# @sev-type: Type of SEV guest being run +# +# Since: 2.12 +## +{ 'union': 'SevInfo', + 'base': { 'enabled': 'bool', + 'api-major': 'uint8', + 'api-minor' : 'uint8', + 'build-id' : 'uint8', + 'state' : 'SevState', + 'sev-type' : 'SevGuestType' }, + 'discriminator': 'sev-type', + 'data': { + 'sev': 'SevGuestInfo', + 'sev-snp': 'SevSnpGuestInfo' } } + + +## +# @query-sev: +# +# Returns information about SEV/SEV-ES/SEV-SNP. +# +# If unavailable due to an incompatible configuration the +# returned @enabled field will be set to 'false' and the +# state of all other fields is undefined. +# +# Returns: @SevInfo +# +# Since: 2.12 +# +# .. qmp-example:: +# +# -> { "execute": "query-sev" } +# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0, +# "build-id" : 0, "policy" : 0, "state" : "running", +# "handle" : 1 } } +## +{ 'command': 'query-sev', 'returns': 'SevInfo' } + +## +# @SevLaunchMeasureInfo: +# +# SEV Guest Launch measurement information +# +# @data: the measurement value encoded in base64 +# +# Since: 2.12 +## +{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'} } + +## +# @query-sev-launch-measure: +# +# Query the SEV/SEV-ES guest launch information. +# +# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. The launch +# measurement for SEV-SNP guests is only available within +# the guest. +# +# This will return an error if the launch measurement is +# unavailable, either due to an invalid guest configuration +# or if the guest has not reached the required SEV state. +# +# Returns: The @SevLaunchMeasureInfo for the guest +# +# Since: 2.12 +# +# .. qmp-example:: +# +# -> { "execute": "query-sev-launch-measure" } +# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } } +## +{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' } + +## +# @SevCapability: +# +# The struct describes capability for a Secure Encrypted +# Virtualization feature. +# +# @pdh: Platform Diffie-Hellman key (base64 encoded) +# +# @cert-chain: PDH certificate chain (base64 encoded) +# +# @cpu0-id: Unique ID of CPU0 (base64 encoded) (since 7.1) +# +# @cbitpos: C-bit location in page table entry +# +# @reduced-phys-bits: Number of physical Address bit reduction when +# SEV is enabled +# +# Since: 2.12 +## +{ 'struct': 'SevCapability', + 'data': { 'pdh': 'str', + 'cert-chain': 'str', + 'cpu0-id': 'str', + 'cbitpos': 'int', + 'reduced-phys-bits': 'int'} } + +## +# @query-sev-capabilities: +# +# This command is used to get the SEV capabilities, and is only +# supported on AMD X86 platforms with KVM enabled. If SEV is not +# available on the platform an error will be returned. +# +# Returns: SevCapability objects. +# +# Since: 2.12 +# +# .. qmp-example:: +# +# -> { "execute": "query-sev-capabilities" } +# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE", +# "cpu0-id": "2lvmGwo+...61iEinw==", +# "cbitpos": 47, "reduced-phys-bits": 1}} +## +{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability' } + +## +# @sev-inject-launch-secret: +# +# This command injects a secret blob into memory of a SEV/SEV-ES guest. +# +# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. SEV-SNP guests +# do not support launch secret injection +# +# This will return an error if launch secret injection is not possible, +# either due to an invalid guest configuration, or if the guest has not +# reached the required SEV state. +# +# @packet-header: the launch secret packet header encoded in base64 +# +# @secret: the launch secret data to be injected encoded in base64 +# +# @gpa: the guest physical address where secret will be injected. +# +# Since: 6.0 +## +{ 'command': 'sev-inject-launch-secret', + 'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' } } + +## +# @SevAttestationReport: +# +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. +# +# @data: guest attestation report (base64 encoded) +# +# Since: 6.1 +## +{ 'struct': 'SevAttestationReport', + 'data': { 'data': 'str'} } + +## +# @query-sev-attestation-report: +# +# This command is used to get the SEV attestation report. +# +# This is only valid on x86 machines configured with KVM and the +# 'sev-guest' confidential virtualization object. The attestation +# report for SEV-SNP guests is only available within the guest. +# +# This will return an error if the attestation report is +# unavailable, either due to an invalid guest configuration +# or if the guest has not reached the required SEV state. +# +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) +# +# Returns: SevAttestationReport objects. +# +# Since: 6.1 +# +# .. qmp-example:: +# +# -> { "execute" : "query-sev-attestation-report", +# "arguments": { "mnonce": "aaaaaaa" } } +# <- { "return" : { "data": "aaaaaaaabbbddddd"} } +## +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, + 'returns': 'SevAttestationReport' }
qapi/misc-target.json +0 -284
290 lines not on this page · raw message
stubs/meson.build +1 -0
@@ -78,6 +78,7 @@ if have_system stub_ss.add(files('win32-kbd-hook.c')) stub_ss.add(files('xen-hw-stub.c')) stub_ss.add(files('monitor-i386-rtc.c')) + stub_ss.add(files('monitor-i386-sev.c')) endif if have_system or have_user
stubs/monitor-i386-sev.c new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-i386.h" + +SevInfo *qmp_query_sev (Error **errp) +{ +error_setg (errp,"SEV is not available in this QEMU" ); +return NULL ; +} + +SevLaunchMeasureInfo *qmp_query_sev_launch_measure (Error **errp) +{ +error_setg (errp,"SEV is not available in this QEMU" ); +return NULL ; +} + +SevCapability *qmp_query_sev_capabilities (Error **errp) +{ +error_setg (errp,"SEV is not available in this QEMU" ); +return NULL ; +} + +void qmp_sev_inject_launch_secret (const char *packet_header,const char *secret, +bool has_gpa,uint64_t gpa,Error **errp) +{ +error_setg (errp,"SEV is not available in this QEMU" ); +} + +SevAttestationReport *qmp_query_sev_attestation_report (const char *mnonce, +Error **errp) +{ +error_setg (errp,"SEV is not available in this QEMU" ); +return NULL ; +}
target/i386/sev-system-stub.c +0 -32
@@ -14,34 +14,9 @@#include "qemu/osdep.h" #include "monitor/monitor.h" #include "monitor/hmp-target.h" -#include "qapi/qapi-commands-misc-target.h" #include "qapi/error.h" #include "sev.h" -SevInfo *qmp_query_sev (Error **errp) -{ -error_setg (errp,"SEV is not available in this QEMU" ); -return NULL ; -} - -SevLaunchMeasureInfo *qmp_query_sev_launch_measure (Error **errp) -{ -error_setg (errp,"SEV is not available in this QEMU" ); -return NULL ; -} - -SevCapability *qmp_query_sev_capabilities (Error **errp) -{ -error_setg (errp,"SEV is not available in this QEMU" ); -return NULL ; -} - -void qmp_sev_inject_launch_secret (const char *packet_header,const char *secret, -bool has_gpa,uint64_t gpa,Error **errp) -{ -error_setg (errp,"SEV is not available in this QEMU" ); -} -int sev_encrypt_flash (hwaddr gpa,uint8_t *ptr,uint64_t len,Error **errp) {g_assert_not_reached ();
@@ -56,13 +31,6 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size)g_assert_not_reached (); } -SevAttestationReport *qmp_query_sev_attestation_report (const char *mnonce, -Error **errp) -{ -error_setg (errp,"SEV is not available in this QEMU" ); -return NULL ; -} -void hmp_info_sev (Monitor *mon,const QDict *qdict) {monitor_printf (mon,"SEV is not available in this QEMU\n" );
target/i386/sev.c +1 -1
@@ -37,7 +37,7 @@#include "qom/object.h" #include "monitor/monitor.h" #include "monitor/hmp-target.h" -#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qapi-commands-misc-i386.h" #include "confidential-guest.h" #include "hw/i386/pc.h" #include "system/address-spaces.h"
Signature · 1 line
2.49.0
PATCH 4/10 qapi: expose query-gic-capability command unconditionally
In reply to Daniel P. BerrangéThis removes the TARGET_ARM condition from the query-gic-capability command. This requires providing a QMP command stub for non-ARM targets. This in turn requires moving the command out of misc-target.json, since that will trigger symbol poisoning errors when built from target independent code.
Following the earlier precedent, this creates a misc-arm.json file to hold this ARM specific command.
--- qapi/meson.build | 1 + qapi/misc-arm.json | 49 +++++++++++++++++++++++++++++++++++++++ qapi/misc-target.json | 44 ----------------------------------- qapi/qapi-schema.json | 1 + stubs/meson.build | 1 + stubs/monitor-arm-gic.c | 12 ++++++++++ target/arm/arm-qmp-cmds.c | 2 +- 7 files changed, 65 insertions(+), 45 deletions(-) create mode 100644 qapi/misc-arm.json create mode 100644 stubs/monitor-arm-gic.c
qapi/meson.build +1 -0
@@ -64,6 +64,7 @@ if have_system 'qdev', 'pci', 'rocker', + 'misc-arm', 'misc-i386', 'tpm', 'uefi',
qapi/misc-arm.json new file +49 -0
49 lines not on this page · raw message
qapi/misc-target.json +0 -44
50 lines not on this page · raw message
qapi/qapi-schema.json +1 -0
@@ -61,6 +61,7 @@ { 'include': 'replay.json' } { 'include': 'yank.json' } { 'include': 'misc.json' } +{ 'include': 'misc-arm.json' } { 'include': 'misc-i386.json' } { 'include': 'misc-target.json' } { 'include': 'audio.json' }
stubs/meson.build +1 -0
@@ -77,6 +77,7 @@ if have_system stub_ss.add(files('target-monitor-defs.c')) stub_ss.add(files('win32-kbd-hook.c')) stub_ss.add(files('xen-hw-stub.c')) + stub_ss.add(files('monitor-arm-gic.c')) stub_ss.add(files('monitor-i386-rtc.c')) stub_ss.add(files('monitor-i386-sev.c')) endif
stubs/monitor-arm-gic.c new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-arm.h" + + +GICCapabilityList *qmp_query_gic_capabilities (Error **errp) +{ +error_setg (errp,"GIC hardware is not available on this target" ); +return NULL ; +}
target/arm/arm-qmp-cmds.c +1 -1
@@ -27,7 +27,7 @@#include "qapi/visitor.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qapi-commands-machine-target.h" -#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qapi-commands-misc-arm.h" #include "qobject/qdict.h" #include "qom/qom-qobject.h"
Signature · 1 line
2.49.0
PATCH 5/10 qapi: make SGX commands unconditionally available
In reply to Daniel P. BerrangéThis removes the TARGET_I386 condition from the SGX confidential virtualization commands, moving them to the recently introduced misc-i386.json QAPI file, given they are inherantly i386 specific commands.
Observe a pre-existing bug that the "SGXEPCSection" struct lacked a TARGET_I386 condition, despite its only usage being behind a TARGET_I386 condition.
--- hw/i386/sgx-stub.c | 13 ------- hw/i386/sgx.c | 2 +- qapi/misc-i386.json | 77 +++++++++++++++++++++++++++++++++++++++ qapi/misc-target.json | 78 ---------------------------------------- stubs/meson.build | 1 + stubs/monitor-i386-sgx.c | 17 +++++++++ 6 files changed, 96 insertions(+), 92 deletions(-) create mode 100644 stubs/monitor-i386-sgx.c
hw/i386/sgx-stub.c +0 -13
@@ -4,24 +4,11 @@#include "hw/i386/pc.h" #include "hw/i386/sgx-epc.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc-target.h" void sgx_epc_build_srat (GArray *table_data) { } -SGXInfo *qmp_query_sgx (Error **errp) -{ -error_setg (errp,"SGX support is not compiled in" ); -return NULL ; -} - -SGXInfo *qmp_query_sgx_capabilities (Error **errp) -{ -error_setg (errp,"SGX support is not compiled in" ); -return NULL ; -} -void hmp_info_sgx (Monitor *mon,const QDict *qdict) {monitor_printf (mon,"SGX is not available in this QEMU\n" );
hw/i386/sgx.c +1 -1
@@ -19,7 +19,7 @@#include "monitor/hmp-target.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qapi-commands-misc-i386.h" #include "system/address-spaces.h" #include "system/hw_accel.h" #include "system/reset.h"
qapi/misc-i386.json +77 -0
80 lines not on this page · raw message
qapi/misc-target.json +0 -78
84 lines not on this page · raw message
stubs/meson.build +1 -0
@@ -80,6 +80,7 @@ if have_system stub_ss.add(files('monitor-arm-gic.c')) stub_ss.add(files('monitor-i386-rtc.c')) stub_ss.add(files('monitor-i386-sev.c')) + stub_ss.add(files('monitor-i386-sgx.c')) endif if have_system or have_user
stubs/monitor-i386-sgx.c new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-i386.h" + +SGXInfo *qmp_query_sgx (Error **errp) +{ +error_setg (errp,"SGX support is not compiled in" ); +return NULL ; +} + +SGXInfo *qmp_query_sgx_capabilities (Error **errp) +{ +error_setg (errp,"SGX support is not compiled in" ); +return NULL ; +}
Signature · 1 line
2.49.0
PATCH 6/10 qapi: make Xen event commands unconditionally available
In reply to Daniel P. BerrangéThis removes the TARGET_I386 condition from the Xen event channel commands, moving them to the recently introduced misc-i386.json QAPI file, given they are inherantly i386 specific commands.
--- hw/i386/kvm/xen-stubs.c | 13 ----- hw/i386/kvm/xen_evtchn.c | 2 +- qapi/misc-i386.json | 107 +++++++++++++++++++++++++++++++++++++ qapi/misc-target.json | 110 --------------------------------------- stubs/meson.build | 1 + stubs/monitor-i386-xen.c | 16 ++++++ 6 files changed, 125 insertions(+), 124 deletions(-) create mode 100644 stubs/monitor-i386-xen.c
hw/i386/kvm/xen-stubs.c +0 -13
@@ -12,7 +12,6 @@#include "qemu/osdep.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc-target.h" #include "xen_evtchn.h" #include "xen_primary_console.h"
@@ -38,15 +37,3 @@ void xen_primary_console_create(void)void xen_primary_console_set_be_port (uint16_t port) { } -#ifdef TARGET_I386 -EvtchnInfoList *qmp_xen_event_list (Error **errp) -{ -error_setg (errp,"Xen event channel emulation not enabled" ); -return NULL ; -} - -void qmp_xen_event_inject (uint32_t port,Error **errp) -{ -error_setg (errp,"Xen event channel emulation not enabled" ); -} -#endif
hw/i386/kvm/xen_evtchn.c +1 -1
@@ -19,7 +19,7 @@#include "monitor/monitor.h" #include "monitor/hmp.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qapi-commands-misc-i386.h" #include "qobject/qdict.h" #include "qom/object.h" #include "exec/target_page.h"
qapi/misc-i386.json +107 -0
110 lines not on this page · raw message
qapi/misc-target.json +0 -110
113 lines not on this page · raw message
stubs/meson.build +1 -0
@@ -81,6 +81,7 @@ if have_system stub_ss.add(files('monitor-i386-rtc.c')) stub_ss.add(files('monitor-i386-sev.c')) stub_ss.add(files('monitor-i386-sgx.c')) + stub_ss.add(files('monitor-i386-xen.c')) endif if have_system or have_user
stubs/monitor-i386-xen.c new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-i386.h" + +EvtchnInfoList *qmp_xen_event_list (Error **errp) +{ +error_setg (errp,"Xen event channel emulation not enabled" ); +return NULL ; +} + +void qmp_xen_event_inject (uint32_t port,Error **errp) +{ +error_setg (errp,"Xen event channel emulation not enabled" ); +}
Signature · 1 line
2.49.0
Re: [PATCH 06/10] qapi: make Xen event commands unconditionally available
Cc'ing Zhao
Quoted 191 lines · Daniel P. Berrangé
This removes the
TARGET_I386condition from the Xen event channel commands, moving them to the recently introduced misc-i386.json QAPI file, given they are inherantly i386 specific commands.Signed-off-by Daniel P. Berrangé <[email protected]>--- hw/i386/kvm/xen-stubs.c | 13 ----- hw/i386/kvm/xen_evtchn.c | 2 +- qapi/misc-i386.json | 107 +++++++++++++++++++++++++++++++++++++ qapi/misc-target.json | 110 --------------------------------------- stubs/meson.build | 1 + stubs/monitor-i386-xen.c | 16 ++++++ 6 files changed, 125 insertions(+), 124 deletions(-)create mode 100644
stubs/monitor-i386-xen.chw/i386/kvm/xen-stubs.c +0
-13@@ -12,7 +12,6 @@#include "qemu/osdep.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc-target.h" #include "xen_evtchn.h" #include "xen_primary_console.h" @@ -38,15 +37,3 @@ void xen_primary_console_create(void)void xen_primary_console_set_be_port (uint16_t port) { } -#ifdef TARGET_I386 -EvtchnInfoList *qmp_xen_event_list (Error **errp) -{ -error_setg (errp,"Xen event channel emulation not enabled" ); -return NULL ; -} - -void qmp_xen_event_inject (uint32_t port,Error **errp) -{ -error_setg (errp,"Xen event channel emulation not enabled" ); -} -#endif hw/i386/kvm/xen_evtchn.c +1
-1@@ -19,7 +19,7 @@#include "monitor/monitor.h" #include "monitor/hmp.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qapi-commands-misc-i386.h" #include "qobject/qdict.h" #include "qom/object.h" #include "exec/target_page.h" qapi/misc-i386.json +107
-0@@ -370,3 +370,110 @@ # {"node": 1, "size": 29360128}]} } ## { 'command': 'query-sgx-capabilities', 'returns': 'SGXInfo' } + +## +# @EvtchnPortType: +# +# An enumeration of Xen event channel port types. +# +# @closed: The port is unused. +# +# @unbound: The port is allocated and ready to be bound. +# +# @interdomain: The port is connected as an interdomain interrupt. +# +# @pirq: The port is bound to a physical IRQ (PIRQ). +# +# @virq: The port is bound to a virtual IRQ (VIRQ). +# +# @ipi: The post is an inter-processor interrupt (IPI). +# +# Since: 8.0 +## +{ 'enum': 'EvtchnPortType', + 'data': ['closed', 'unbound', 'interdomain', 'pirq', 'virq', 'ipi'] } + +## +# @EvtchnInfo: +# +# Information about a Xen event channel port +# +# @port: the port number +# +# @vcpu: target vCPU for this port +# +# @type: the port type +# +# @remote-domain: remote domain for interdomain ports +# +# @target: remote port ID, or virq/pirq number +# +# @pending: port is currently active pending delivery +# +# @masked: port is masked +# +# Since: 8.0 +## +{ 'struct': 'EvtchnInfo', + 'data': {'port': 'uint16', + 'vcpu': 'uint32', + 'type': 'EvtchnPortType', + 'remote-domain': 'str', + 'target': 'uint16', + 'pending': 'bool', + 'masked': 'bool'} } + + +## +# @xen-event-list: +# +# Query the Xen event channels opened by the guest. +# +# Returns: list of open event channel ports. +# +# Since: 8.0 +# +# .. qmp-example:: +# +# -> { "execute": "xen-event-list" } +# <- { "return": [ +# { +# "pending": false, +# "port": 1, +# "vcpu": 1, +# "remote-domain": "qemu", +# "masked": false, +# "type": "interdomain", +# "target": 1 +# }, +# { +# "pending": false, +# "port": 2, +# "vcpu": 0, +# "remote-domain": "", +# "masked": false, +# "type": "virq", +# "target": 0 +# } +# ] +# } +## +{ 'command': 'xen-event-list', + 'returns': ['EvtchnInfo'] } + +## +# @xen-event-inject: +# +# Inject a Xen event channel port (interrupt) to the guest. +# +# @port: The port number +# +# Since: 8.0 +# +# .. qmp-example:: +# +# -> { "execute": "xen-event-inject", "arguments": { "port": 1 } } +# <- { "return": { } } +## +{ 'command': 'xen-event-inject', + 'data': { 'port': 'uint32' } }qapi/misc-target.json +0
-12@@ -3,113 +3,3 @@ # -## -# @EvtchnPortType: -# -# An enumeration of Xen event channel port types. -# -# @closed: The port is unused. -# -# @unbound: The port is allocated and ready to be bound. -# -# @interdomain: The port is connected as an interdomain interrupt. -# -# @pirq: The port is bound to a physical IRQ (PIRQ).
qapi/misc-target.json line 27
Quoted 10 lines
qapi/misc-target.json +0
-10-# -# @virq: The port is bound to a virtual IRQ (VIRQ). -# -# @ipi: The post is an inter-processor interrupt (IPI). -# -# Since: 8.0 -## -{ 'enum': 'EvtchnPortType', - 'data': ['closed', 'unbound', 'interdomain', 'pirq', 'virq', 'ipi'], - 'if': 'TARGET_I386' }
Interesting, this ought to be "all {TARGET_I386, CONFIG_KVM}".
Quoted 122 lines
qapi/misc-target.json +0
-88- -## -# @EvtchnInfo: -# -# Information about a Xen event channel port -# -# @port: the port number -# -# @vcpu: target vCPU for this port -# -# @type: the port type -# -# @remote-domain: remote domain for interdomain ports -# -# @target: remote port ID, or virq/pirq number -# -# @pending: port is currently active pending delivery -# -# @masked: port is masked -# -# Since: 8.0 -## -{ 'struct': 'EvtchnInfo', - 'data': {'port': 'uint16', - 'vcpu': 'uint32', - 'type': 'EvtchnPortType', - 'remote-domain': 'str', - 'target': 'uint16', - 'pending': 'bool', - 'masked': 'bool'}, - 'if': 'TARGET_I386' } - - -## -# @xen-event-list: -# -# Query the Xen event channels opened by the guest. -# -# Returns: list of open event channel ports. -# -# Since: 8.0 -# -# .. qmp-example:: -# -# -> { "execute": "xen-event-list" } -# <- { "return": [ -# { -# "pending": false, -# "port": 1, -# "vcpu": 1, -# "remote-domain": "qemu", -# "masked": false, -# "type": "interdomain", -# "target": 1 -# }, -# { -# "pending": false, -# "port": 2, -# "vcpu": 0, -# "remote-domain": "", -# "masked": false, -# "type": "virq", -# "target": 0 -# } -# ] -# } -## -{ 'command': 'xen-event-list', - 'returns': ['EvtchnInfo'], - 'if': 'TARGET_I386' } - -## -# @xen-event-inject: -# -# Inject a Xen event channel port (interrupt) to the guest. -# -# @port: The port number -# -# Since: 8.0 -# -# .. qmp-example:: -# -# -> { "execute": "xen-event-inject", "arguments": { "port": 1 } } -# <- { "return": { } } -## -{ 'command': 'xen-event-inject', - 'data': { 'port': 'uint32' }, - 'if': 'TARGET_I386' }stubs/meson.build +1
-0@@ -81,6 +81,7 @@ if have_system stub_ss.add(files('monitor-i386-rtc.c')) stub_ss.add(files('monitor-i386-sev.c')) stub_ss.add(files('monitor-i386-sgx.c')) + stub_ss.add(files('monitor-i386-xen.c')) endif if have_system or have_userstubs/monitor-i386-xen.c new file +16
-0@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-i386.h" + +EvtchnInfoList *qmp_xen_event_list (Error **errp) +{ +error_setg (errp,"Xen event channel emulation not enabled" ); +return NULL ; +} + +void qmp_xen_event_inject (uint32_t port,Error **errp) +{ +error_setg (errp,"Xen event channel emulation not enabled" ); +}
Re: [PATCH 06/10] qapi: make Xen event commands unconditionally available
Quoted 3 lines · Philippe Mathieu-Daudé
Cc'ing Zhao
On 8/5/25 15:58, Daniel P. Berrangé wrote:
Hm, what mailer does that? Does it mean August 5th or May 8th? Even in the original definition of RFC821 they knew not to use dates in those forms :)
Quoted 3 lines
Quoted 3 lines
This removes the
TARGET_I386condition from the Xen event channel commands, moving them to the recently introduced misc-i386.json QAPI file, given they are inherantly i386 specific commands.
'inherently'
Quoted 18 lines
Quoted 18 lines
---
qapi/misc-target.json +0
-16-## -# @EvtchnPortType: -# -# An enumeration of Xen event channel port types. -# -# @closed: The port is unused. -# -# @unbound: The port is allocated and ready to be bound. -# -# @interdomain: The port is connected as an interdomain interrupt. -# -# @pirq: The port is bound to a physical IRQ (PIRQ). -# -# @virq: The port is bound to a virtual IRQ (VIRQ). -# -# @ipi: The post is an inter-processor interrupt (IPI).
Quoted 8 lines
qapi/misc-target.json line 27
Quoted 6 lines
qapi/misc-target.json +0
-6-# -# Since: 8.0 -## -{ 'enum': 'EvtchnPortType', - 'data': ['closed', 'unbound', 'interdomain', 'pirq', 'virq', 'ipi'], - 'if': 'TARGET_I386' }Interesting, this ought to be "all {
TARGET_I386,CONFIG_KVM}".
Isn't it CONFIG_XEN_EMU? But ISTR it wasn't possible to depend on those target-specific options in generic code? I forget the precise details.
So we ended up just ensuring the stubs were provided in the right cases.
This patch moves those stubs from hw/i386/kvm/xen-stubs.c which was built if !CONFIG_XEN_EMU, and moves them elsewhere if !CONFIG_KVM? So at first glance I think it might fail for KVM && !XEN_EMU builds... ?
Re: [PATCH 06/10] qapi: make Xen event commands unconditionally available
Quoted 45 lines · David Woodhouse
Quoted 3 lines · Philippe Mathieu-Daudé
Cc'ing Zhao
On 8/5/25 15:58, Daniel P. Berrangé wrote:
Hm, what mailer does that? Does it mean August 5th or May 8th? Even in the original definition of RFC821 they knew not to use dates in those forms :)
Quoted 3 lines
Quoted 3 lines
This removes the
TARGET_I386condition from the Xen event channel commands, moving them to the recently introduced misc-i386.json QAPI file, given they are inherantly i386 specific commands.'inherently'
Quoted 18 lines
Quoted 18 lines
---
qapi/misc-target.json +0
-16-## -# @EvtchnPortType: -# -# An enumeration of Xen event channel port types. -# -# @closed: The port is unused. -# -# @unbound: The port is allocated and ready to be bound. -# -# @interdomain: The port is connected as an interdomain interrupt. -# -# @pirq: The port is bound to a physical IRQ (PIRQ). -# -# @virq: The port is bound to a virtual IRQ (VIRQ). -# -# @ipi: The post is an inter-processor interrupt (IPI).Quoted 8 lines
qapi/misc-target.json line 27
Quoted 6 lines
qapi/misc-target.json +0
-6-# -# Since: 8.0 -## -{ 'enum': 'EvtchnPortType', - 'data': ['closed', 'unbound', 'interdomain', 'pirq', 'virq', 'ipi'], - 'if': 'TARGET_I386' }Interesting, this ought to be "all {
TARGET_I386,CONFIG_KVM}".Isn't it
CONFIG_XEN_EMU? But ISTR it wasn't possible to depend on those target-specific options in generic code? I forget the precise details.
Quoted 6 lines
So we ended up just ensuring the stubs were provided in the right cases.
This patch moves those stubs from
hw/i386/kvm/xen-stubs.cwhich was built if !CONFIG_XEN_EMU, and moves them elsewhere if !CONFIG_KVM? So at first glance I think it might fail for KVM && !XEN_EMU builds... ?
The files in the top level 'stubs/' directory get built into libqemuutil.a, and thus those stubs are available to every system binary, in every configuration scenario.
If the real impl of these methods is present in any binary, the stubs file impl should get discarded by the linker automatically, avoiding a duplicate symbols problem.
With regards,
Daniel
Signature · 3 lines
|: 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 :|
David Woodhouse
Acked-byRe: [PATCH 06/10] qapi: make Xen event commands unconditionally available
Quoted 5 lines · Daniel P. Berrangé
Quoted 3 lines
This patch moves those stubs from
hw/i386/kvm/xen-stubs.cwhich was built if !CONFIG_XEN_EMU, and moves them elsewhere if !CONFIG_KVM? So at first glance I think it might fail for KVM && !XEN_EMU builds... ?
Quoted 7 lines
The files in the top level 'stubs/' directory get built into libqemuutil.a, and thus those stubs are available to every system binary, in every configuration scenario.
If the real impl of these methods is present in any binary, the stubs file impl should get discarded by the linker automatically, avoiding a duplicate symbols problem.
Thanks.
In that case,
PATCH 7/10 qapi: remove the misc-target.json file
In reply to Daniel P. BerrangéThis file is now empty and can thus be removed.
Observe the pre-existing bug with s390-skeys.c and target/i386/monitor.c both including qapi-commands-misc-target.h despite not requiring it.
--- hw/s390x/s390-skeys.c | 1 - qapi/meson.build | 1 - qapi/qapi-schema.json | 1 - target/i386/monitor.c | 1 - 4 files changed, 4 deletions(-)
hw/s390x/s390-skeys.c +0 -1
@@ -17,7 +17,6 @@#include "hw/s390x/storage-keys.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" -#include "qapi/qapi-commands-misc-target.h" #include "qobject/qdict.h" #include "qemu/error-report.h" #include "system/memory_mapping.h"
qapi/meson.build +0 -1
@@ -42,7 +42,6 @@ qapi_all_modules = [ 'machine-target', 'migration', 'misc', - 'misc-target', 'net', 'pragma', 'qom',
qapi/qapi-schema.json +0 -1
@@ -63,7 +63,6 @@ { 'include': 'misc.json' } { 'include': 'misc-arm.json' } { 'include': 'misc-i386.json' } -{ 'include': 'misc-target.json' } { 'include': 'audio.json' } { 'include': 'acpi.json' } { 'include': 'pci.json' }
target/i386/monitor.c +0 -1
@@ -29,7 +29,6 @@#include "monitor/hmp.h" #include "qobject/qdict.h" #include "qapi/error.h" -#include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" /* Perform linear address sign extension */
Signature · 1 line
2.49.0
PATCH 8/10 qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic
In reply to Daniel P. BerrangéFrom: Philippe Mathieu-Daudé <[email protected]>
We'd like to have some unified QAPI schema. Having a structure field conditional to a target being built in is not very practical.
While @deprecated-props is only used by s390x target, it is generic enough and could be used by other targets (assuming we expand CpuModelExpansionType enum values).
Let's always include this field, regardless of the target, but make it optional.
--- qapi/machine-target.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
qapi/machine-target.json +3 -4
@@ -244,19 +244,18 @@ # # @model: the expanded CpuModelInfo. # -# @deprecated-props: a list of properties that are flagged as +# @deprecated-props: an optional list of properties that are flagged as # deprecated by the CPU vendor. The list depends on the # CpuModelExpansionType: "static" properties are a subset of the # enabled-properties for the expanded model; "full" properties are # a set of properties that are deprecated across all models for -# the architecture. (since: 9.1). +# the architecture. (since: 10.1 -- since 9.1 on s390x --). # # Since: 2.8 ## { 'struct': 'CpuModelExpansionInfo', 'data': { 'model': 'CpuModelInfo', - 'deprecated-props' : { 'type': ['str'], - 'if': 'TARGET_S390X' } }, + '*deprecated-props' : { 'type': ['str'] } }, 'if': { 'any': [ 'TARGET_S390X', 'TARGET_I386', 'TARGET_ARM',
Signature · 1 line
2.49.0
Re: [PATCH 08/10] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic
Copying my review from the initial posting:
Quoted 31 lines · Daniel P. Berrangé
From: Philippe Mathieu-Daudé <[email protected]>
We'd like to have some unified QAPI schema. Having a structure field conditional to a target being built in is not very practical.
While @deprecated-props is only used by s390x target, it is generic enough and could be used by other targets (assuming we expand CpuModelExpansionType enum values).
Let's always include this field, regardless of the target, but make it optional.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- qapi/machine-target.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)qapi/machine-target.json +1
-1@@ -244,19 +244,18 @@ # # @model: the expanded CpuModelInfo. # -# @deprecated-props: a list of properties that are flagged as +# @deprecated-props: an optional list of properties that are flagged as # deprecated by the CPU vendor. The list depends on the # CpuModelExpansionType: "static" properties are a subset of the # enabled-properties for the expanded model; "full" properties are # a set of properties that are deprecated across all models for
qapi/machine-target.json line 258
Quoted 10 lines
qapi/machine-target.json +2
-3-# the architecture. (since: 9.1). +# the architecture. (since: 10.1 -- since 9.1 on s390x --). # # Since: 2.8 ## { 'struct': 'CpuModelExpansionInfo', 'data': { 'model': 'CpuModelInfo', - 'deprecated-props' : { 'type': ['str'], - 'if': 'TARGET_S390X' } }, + '*deprecated-props' : { 'type': ['str'] } },
Make this
'*deprecated-props' : ['str'] },
please.
When I see "optional array", I wonder about the difference between "absent" and "present and empty". The doc comment doesn't quite explain it. I figure "present and empty" means empty, while "absent" means we don't know / not implemented.
Is the difference useful?
Philippe is happy to implement either variant.
Quoted 3 lines
qapi/machine-target.json +0
-0'if': { 'any': [ 'TARGET_S390X', 'TARGET_I386', 'TARGET_ARM',
Re: [PATCH 08/10] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic
Quoted 50 lines · Markus Armbruster
Copying my review from the initial posting:
Quoted 31 lines · Daniel P. Berrangé
From: Philippe Mathieu-Daudé <[email protected]>
We'd like to have some unified QAPI schema. Having a structure field conditional to a target being built in is not very practical.
While @deprecated-props is only used by s390x target, it is generic enough and could be used by other targets (assuming we expand CpuModelExpansionType enum values).
Let's always include this field, regardless of the target, but make it optional.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- qapi/machine-target.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)qapi/machine-target.json +1
-1@@ -244,19 +244,18 @@ # # @model: the expanded CpuModelInfo. # -# @deprecated-props: a list of properties that are flagged as +# @deprecated-props: an optional list of properties that are flagged as # deprecated by the CPU vendor. The list depends on the # CpuModelExpansionType: "static" properties are a subset of the # enabled-properties for the expanded model; "full" properties are # a set of properties that are deprecated across all models forqapi/machine-target.json line 258
Quoted 10 lines
qapi/machine-target.json +2
-3-# the architecture. (since: 9.1). +# the architecture. (since: 10.1 -- since 9.1 on s390x --). # # Since: 2.8 ## { 'struct': 'CpuModelExpansionInfo', 'data': { 'model': 'CpuModelInfo', - 'deprecated-props' : { 'type': ['str'], - 'if': 'TARGET_S390X' } }, + '*deprecated-props' : { 'type': ['str'] } },Make this
'*deprecated-props' : ['str'] },
Quoted 8 lines
please.
When I see "optional array", I wonder about the difference between "absent" and "present and empty". The doc comment doesn't quite explain it. I figure "present and empty" means empty, while "absent" means we don't know / not implemented.
Is the difference useful?
I'm doubtful that the difference is useful.
With regards,
Daniel
Signature · 3 lines
|: 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 :|
PATCH 9/10 qapi: make most CPU commands unconditionally available
In reply to Daniel P. BerrangéThis removes the TARGET_* conditions from all the CPU commands that are conceptually target independent. Top level stubs are provided to cope with targets which do not currently implement all of the commands.
--- qapi/machine-target.json | 397 -------------------------- qapi/machine.json | 363 +++++++++++++++++++++++ stubs/meson.build | 2 + stubs/monitor-cpu-s390x.c | 23 ++ stubs/monitor-cpu.c | 21 ++ target/arm/arm-qmp-cmds.c | 2 +- target/i386/cpu-system.c | 2 +- target/i386/cpu.c | 2 +- target/loongarch/loongarch-qmp-cmds.c | 2 +- target/mips/system/mips-qmp-cmds.c | 12 +- target/ppc/ppc-qmp-cmds.c | 12 +- target/riscv/riscv-qmp-cmds.c | 2 +- target/s390x/cpu_models_system.c | 2 +- 13 files changed, 437 insertions(+), 405 deletions(-) create mode 100644 stubs/monitor-cpu-s390x.c create mode 100644 stubs/monitor-cpu.c
qapi/machine-target.json +0 -397
@@ -6,403 +6,6 @@ { 'include': 'machine-common.json' } -## -# @CpuModelInfo: -# -# Virtual CPU model. -# -# A CPU model consists of the name of a CPU definition, to which delta -# changes are applied (e.g. features added/removed). Most magic -# values that an architecture might require should be hidden behind -# the name. However, if required, architectures can expose relevant -# properties. -# -# @name: the name of the CPU definition the model is based on -# -# @props: a dictionary of QOM properties to be applied -# -# Since: 2.8 -## -{ 'struct': 'CpuModelInfo', - 'data': { 'name': 'str', - '*props': 'any' } } - -## -# @CpuModelExpansionType: -# -# An enumeration of CPU model expansion types. -# -# @static: Expand to a static CPU model, a combination of a static -# base model name and property delta changes. As the static base -# model will never change, the expanded CPU model will be the -# same, independent of QEMU version, machine type, machine -# options, and accelerator options. Therefore, the resulting -# model can be used by tooling without having to specify a -# compatibility machine - e.g. when displaying the "host" model. -# The @static CPU models are migration-safe. -# -# @full: Expand all properties. The produced model is not guaranteed -# to be migration-safe, but allows tooling to get an insight and -# work with model details. -# -# .. note:: When a non-migration-safe CPU model is expanded in static -# mode, some features enabled by the CPU model may be omitted, -# because they can't be implemented by a static CPU model -# definition (e.g. cache info passthrough and PMU passthrough in -# x86). If you need an accurate representation of the features -# enabled by a non-migration-safe CPU model, use @full. If you -# need a static representation that will keep ABI compatibility -# even when changing QEMU version or machine-type, use @static (but -# keep in mind that some features may be omitted). -# -# Since: 2.8 -## -{ 'enum': 'CpuModelExpansionType', - 'data': [ 'static', 'full' ] } - -## -# @CpuModelCompareResult: -# -# An enumeration of CPU model comparison results. The result is -# usually calculated using e.g. CPU features or CPU generations. -# -# @incompatible: If model A is incompatible to model B, model A is not -# guaranteed to run where model B runs and the other way around. -# -# @identical: If model A is identical to model B, model A is -# guaranteed to run where model B runs and the other way around. -# -# @superset: If model A is a superset of model B, model B is -# guaranteed to run where model A runs. There are no guarantees -# about the other way. -# -# @subset: If model A is a subset of model B, model A is guaranteed to -# run where model B runs. There are no guarantees about the other -# way. -# -# Since: 2.8 -## -{ 'enum': 'CpuModelCompareResult', - 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] } - -## -# @CpuModelBaselineInfo: -# -# The result of a CPU model baseline. -# -# @model: the baselined CpuModelInfo. -# -# Since: 2.8 -## -{ 'struct': 'CpuModelBaselineInfo', - 'data': { 'model': 'CpuModelInfo' }, - 'if': 'TARGET_S390X' } - -## -# @CpuModelCompareInfo: -# -# The result of a CPU model comparison. -# -# @result: The result of the compare operation. -# -# @responsible-properties: List of properties that led to the -# comparison result not being identical. -# -# @responsible-properties is a list of QOM property names that led to -# both CPUs not being detected as identical. For identical models, -# this list is empty. If a QOM property is read-only, that means -# there's no known way to make the CPU models identical. If the -# special property name "type" is included, the models are by -# definition not identical and cannot be made identical. -# -# Since: 2.8 -## -{ 'struct': 'CpuModelCompareInfo', - 'data': { 'result': 'CpuModelCompareResult', - 'responsible-properties': ['str'] }, - 'if': 'TARGET_S390X' } - -## -# @query-cpu-model-comparison: -# -# Compares two CPU models, @modela and @modelb, returning how they -# compare in a specific configuration. The results indicates how -# both models compare regarding runnability. This result can be -# used by tooling to make decisions if a certain CPU model will -# run in a certain configuration or if a compatible CPU model has -# to be created by baselining. -# -# Usually, a CPU model is compared against the maximum possible CPU -# model of a certain configuration (e.g. the "host" model for KVM). -# If that CPU model is identical or a subset, it will run in that -# configuration. -# -# The result returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU -# version. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the -# machine-type. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, -# CPU models may look different depending on machine and accelerator -# options. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu -# option and global properties may affect expansion of CPU models. -# Using query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support comparing CPU models. s390x -# supports comparing CPU models. -# -# @modela: description of the first CPU model to compare, referred to -# as "model A" in CpuModelCompareResult -# -# @modelb: description of the second CPU model to compare, referred to -# as "model B" in CpuModelCompareResult -# -# Returns: a CpuModelCompareInfo describing how both CPU models -# compare -# -# Errors: -# - if comparing CPU models is not supported -# - if a model cannot be used -# - if a model contains an unknown cpu definition name, unknown -# properties or properties with wrong types. -# -# .. note:: This command isn't specific to s390x, but is only -# implemented on this architecture currently. -# -# Since: 2.8 -## -{ 'command': 'query-cpu-model-comparison', - 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' }, - 'returns': 'CpuModelCompareInfo', - 'if': 'TARGET_S390X' } - -## -# @query-cpu-model-baseline: -# -# Baseline two CPU models, @modela and @modelb, creating a compatible -# third model. The created model will always be a static, -# migration-safe CPU model (see "static" CPU model expansion for -# details). -# -# This interface can be used by tooling to create a compatible CPU -# model out two CPU models. The created CPU model will be identical -# to or a subset of both CPU models when comparing them. Therefore, -# the created CPU model is guaranteed to run where the given CPU -# models run. -# -# The result returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU -# version. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the -# machine-type. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, -# CPU models may look different depending on machine and accelerator -# options. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu -# option and global properties may affect expansion of CPU models. -# Using query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support baselining CPU models. s390x -# supports baselining CPU models. -# -# @modela: description of the first CPU model to baseline -# -# @modelb: description of the second CPU model to baseline -# -# Returns: a CpuModelBaselineInfo describing the baselined CPU model -# -# Errors: -# - if baselining CPU models is not supported -# - if a model cannot be used -# - if a model contains an unknown cpu definition name, unknown -# properties or properties with wrong types. -# -# .. note:: This command isn't specific to s390x, but is only -# implemented on this architecture currently. -# -# Since: 2.8 -## -{ 'command': 'query-cpu-model-baseline', - 'data': { 'modela': 'CpuModelInfo', - 'modelb': 'CpuModelInfo' }, - 'returns': 'CpuModelBaselineInfo', - 'if': 'TARGET_S390X' } - -## -# @CpuModelExpansionInfo: -# -# The result of a cpu model expansion. -# -# @model: the expanded CpuModelInfo. -# -# @deprecated-props: an optional list of properties that are flagged as -# deprecated by the CPU vendor. The list depends on the -# CpuModelExpansionType: "static" properties are a subset of the -# enabled-properties for the expanded model; "full" properties are -# a set of properties that are deprecated across all models for -# the architecture. (since: 10.1 -- since 9.1 on s390x --). -# -# Since: 2.8 -## -{ 'struct': 'CpuModelExpansionInfo', - 'data': { 'model': 'CpuModelInfo', - '*deprecated-props' : { 'type': ['str'] } }, - 'if': { 'any': [ 'TARGET_S390X', - 'TARGET_I386', - 'TARGET_ARM', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - -## -# @query-cpu-model-expansion: -# -# Expands a given CPU model, @model, (or a combination of CPU model + -# additional options) to different granularities, specified by @type, -# allowing tooling to get an understanding what a specific CPU model -# looks like in QEMU under a certain configuration. -# -# This interface can be used to query the "host" CPU model. -# -# The data returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU -# version. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the -# machine-type. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, -# CPU models may look different depending on machine and accelerator -# options. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu -# option and global properties may affect expansion of CPU models. -# Using query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support all expansion types. s390x -# supports "full" and "static". Arm only supports "full". -# -# @model: description of the CPU model to expand -# -# @type: expansion type, specifying how to expand the CPU model -# -# Returns: a CpuModelExpansionInfo describing the expanded CPU model -# -# Errors: -# - if expanding CPU models is not supported -# - if the model cannot be expanded -# - if the model contains an unknown CPU definition name, unknown -# properties or properties with a wrong type -# - if an expansion type is not supported -# -# Since: 2.8 -## -{ 'command': 'query-cpu-model-expansion', - 'data': { 'type': 'CpuModelExpansionType', - 'model': 'CpuModelInfo' }, - 'returns': 'CpuModelExpansionInfo', - 'if': { 'any': [ 'TARGET_S390X', - 'TARGET_I386', - 'TARGET_ARM', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - -## -# @CpuDefinitionInfo: -# -# Virtual CPU definition. -# -# @name: the name of the CPU definition -# -# @migration-safe: whether a CPU definition can be safely used for -# migration in combination with a QEMU compatibility machine when -# migrating between different QEMU versions and between hosts with -# different sets of (hardware or software) capabilities. If not -# provided, information is not available and callers should not -# assume the CPU definition to be migration-safe. (since 2.8) -# -# @static: whether a CPU definition is static and will not change -# depending on QEMU version, machine type, machine options and -# accelerator options. A static model is always migration-safe. -# (since 2.8) -# -# @unavailable-features: List of properties that prevent the CPU model -# from running in the current host. (since 2.8) -# -# @typename: Type name that can be used as argument to -# @device-list-properties, to introspect properties configurable -# using -cpu or -global. (since 2.9) -# -# @alias-of: Name of CPU model this model is an alias for. The target -# of the CPU model alias may change depending on the machine type. -# Management software is supposed to translate CPU model aliases -# in the VM configuration, because aliases may stop being -# migration-safe in the future (since 4.1) -# -# @deprecated: If true, this CPU model is deprecated and may be -# removed in in some future version of QEMU according to the QEMU -# deprecation policy. (since 5.2) -# -# @unavailable-features is a list of QOM property names that represent -# CPU model attributes that prevent the CPU from running. If the QOM -# property is read-only, that means there's no known way to make the -# CPU model run in the current host. Implementations that choose not -# to provide specific information return the property name "type". If -# the property is read-write, it means that it MAY be possible to run -# the CPU model in the current host if that property is changed. -# Management software can use it as hints to suggest or choose an -# alternative for the user, or just to generate meaningful error -# messages explaining why the CPU model can't be used. If -# @unavailable-features is an empty list, the CPU model is runnable -# using the current host and machine-type. If @unavailable-features -# is not present, runnability information for the CPU is not -# available. -# -# Since: 1.2 -## -{ 'struct': 'CpuDefinitionInfo', - 'data': { 'name': 'str', - '*migration-safe': 'bool', - 'static': 'bool', - '*unavailable-features': [ 'str' ], - 'typename': 'str', - '*alias-of' : 'str', - 'deprecated' : 'bool' }, - 'if': { 'any': [ 'TARGET_PPC', - 'TARGET_ARM', - 'TARGET_I386', - 'TARGET_S390X', - 'TARGET_MIPS', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - -## -# @query-cpu-definitions: -# -# Return a list of supported virtual CPU definitions -# -# Returns: a list of CpuDefinitionInfo -# -# Since: 1.2 -## -{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'], - 'if': { 'any': [ 'TARGET_PPC', - 'TARGET_ARM', - 'TARGET_I386', - 'TARGET_S390X', - 'TARGET_MIPS', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - ## # @S390CpuPolarization: #
qapi/machine.json +363 -0
366 lines not on this page · raw message
stubs/meson.build +2 -0
@@ -82,6 +82,8 @@ if have_system stub_ss.add(files('monitor-i386-sev.c')) stub_ss.add(files('monitor-i386-sgx.c')) stub_ss.add(files('monitor-i386-xen.c')) + stub_ss.add(files('monitor-cpu.c')) + stub_ss.add(files('monitor-cpu-s390x.c')) endif if have_system or have_user
stubs/monitor-cpu-s390x.c new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" + +CpuModelCompareInfo * +qmp_query_cpu_model_comparison (CpuModelInfo *infoa, +CpuModelInfo *infob, +Error **errp) +{ +error_setg (errp,"CPU model comparison is not supported on this target" ); +return NULL ; +} + +CpuModelBaselineInfo * +qmp_query_cpu_model_baseline (CpuModelInfo *infoa, +CpuModelInfo *infob, +Error **errp) +{ +error_setg (errp,"CPU model baseline is not supported on this target" ); +return NULL ; +}
stubs/monitor-cpu.c new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" + +CpuModelExpansionInfo * +qmp_query_cpu_model_expansion (CpuModelExpansionType type, +CpuModelInfo *model, +Error **errp) +{ +error_setg (errp,"CPU model expansion is not supported on this target" ); +return NULL ; +} + +CpuDefinitionInfoList * +qmp_query_cpu_definitions (Error **errp) +{ +error_setg (errp,"CPU model definitions are not supported on this target" ); +return NULL ; +}
target/arm/arm-qmp-cmds.c +1 -1
@@ -26,7 +26,7 @@#include "qapi/error.h" #include "qapi/visitor.h" #include "qapi/qobject-input-visitor.h" -#include "qapi/qapi-commands-machine-target.h" +#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-misc-arm.h" #include "qobject/qdict.h" #include "qom/qom-qobject.h"
target/i386/cpu-system.c +1 -1
@@ -24,7 +24,7 @@#include "qobject/qdict.h" #include "qapi/qobject-input-visitor.h" #include "qom/qom-qobject.h" -#include "qapi/qapi-commands-machine-target.h" +#include "qapi/qapi-commands-machine.h" #include "cpu-internal.h"
target/i386/cpu.c +1 -1
@@ -38,7 +38,7 @@#include "exec/watchpoint.h" #ifndef CONFIG_USER_ONLY #include "system/reset.h" -#include "qapi/qapi-commands-machine-target.h" +#include "qapi/qapi-commands-machine.h" #include "system/address-spaces.h" #include "hw/boards.h" #include "hw/i386/sgx-epc.h"
target/loongarch/loongarch-qmp-cmds.c +1 -1
@@ -8,7 +8,7 @@#include "qemu/osdep.h" #include "qapi/error.h" -#include "qapi/qapi-commands-machine-target.h" +#include "qapi/qapi-commands-machine.h" #include "cpu.h" #include "qobject/qdict.h" #include "qapi/qobject-input-visitor.h"
target/mips/system/mips-qmp-cmds.c +11 -1
@@ -7,9 +7,19 @@*/ #include "qemu/osdep.h" -#include "qapi/qapi-commands-machine-target.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" #include "cpu.h" +CpuModelExpansionInfo * +qmp_query_cpu_model_expansion (CpuModelExpansionType type, +CpuModelInfo *model, +Error **errp) +{ +error_setg (errp,"CPU model expansion is not supported on this target" ); +return NULL ; +} +static void mips_cpu_add_definition (gpointer data,gpointer user_data) {ObjectClass *oc = data;
target/ppc/ppc-qmp-cmds.c +11 -1
@@ -28,7 +28,8 @@#include "qemu/ctype.h" #include "monitor/hmp-target.h" #include "monitor/hmp.h" -#include "qapi/qapi-commands-machine-target.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" #include "cpu-models.h" #include "cpu-qom.h"
@@ -175,6 +176,15 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval)return -EINVAL ; } +CpuModelExpansionInfo * +qmp_query_cpu_model_expansion (CpuModelExpansionType type, +CpuModelInfo *model, +Error **errp) +{ +error_setg (errp,"CPU model expansion is not supported on this target" ); +return NULL ; +} +static void ppc_cpu_defs_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data;
target/riscv/riscv-qmp-cmds.c +1 -1
@@ -25,7 +25,7 @@#include "qemu/osdep.h" #include "qapi/error.h" -#include "qapi/qapi-commands-machine-target.h" +#include "qapi/qapi-commands-machine.h" #include "qobject/qbool.h" #include "qobject/qdict.h" #include "qapi/qobject-input-visitor.h"
target/s390x/cpu_models_system.c +1 -1
@@ -19,7 +19,7 @@#include "qapi/visitor.h" #include "qapi/qobject-input-visitor.h" #include "qobject/qdict.h" -#include "qapi/qapi-commands-machine-target.h" +#include "qapi/qapi-commands-machine.h" static void list_add_feat (const char *name,void *opaque);
Signature · 1 line
2.49.0
Re: [PATCH 09/10] qapi: make most CPU commands unconditionally available
Quoted 21 lines · Daniel P. Berrangé
This removes the TARGET_* conditions from all the CPU commands that are conceptually target independent. Top level stubs are provided to cope with targets which do not currently implement all of the commands.
Signed-off-by Daniel P. Berrangé <[email protected]>--- qapi/machine-target.json | 397 -------------------------- qapi/machine.json | 363 +++++++++++++++++++++++ stubs/meson.build | 2 + stubs/monitor-cpu-s390x.c | 23 ++ stubs/monitor-cpu.c | 21 ++ target/arm/arm-qmp-cmds.c | 2 +- target/i386/cpu-system.c | 2 +- target/i386/cpu.c | 2 +- target/loongarch/loongarch-qmp-cmds.c | 2 +- target/mips/system/mips-qmp-cmds.c | 12 +- target/ppc/ppc-qmp-cmds.c | 12 +- target/riscv/riscv-qmp-cmds.c | 2 +- target/s390x/cpu_models_system.c | 2 +- 13 files changed, 437 insertions(+), 405 deletions(-)
Quoted 3 lines
create mode 100644
stubs/monitor-cpu-s390x.c
create mode 100644stubs/monitor-cpu.c
This sounds good to me, as long we are ok with having commands returning a "this command is not supported here" paradigm.
I thought it was the complex case we were trying to deal with, precisely because we didn't want to introduce the "command here, but it returns an error" shell.
Re: [PATCH 09/10] qapi: make most CPU commands unconditionally available
In reply to Daniel P. BerrangéQuoted 590 lines · Daniel P. Berrangé
This removes the TARGET_* conditions from all the CPU commands that are conceptually target independent. Top level stubs are provided to cope with targets which do not currently implement all of the commands.
Signed-off-by Daniel P. Berrangé <[email protected]>--- qapi/machine-target.json | 397 -------------------------- qapi/machine.json | 363 +++++++++++++++++++++++ stubs/meson.build | 2 + stubs/monitor-cpu-s390x.c | 23 ++ stubs/monitor-cpu.c | 21 ++ target/arm/arm-qmp-cmds.c | 2 +- target/i386/cpu-system.c | 2 +- target/i386/cpu.c | 2 +- target/loongarch/loongarch-qmp-cmds.c | 2 +- target/mips/system/mips-qmp-cmds.c | 12 +- target/ppc/ppc-qmp-cmds.c | 12 +- target/riscv/riscv-qmp-cmds.c | 2 +- target/s390x/cpu_models_system.c | 2 +- 13 files changed, 437 insertions(+), 405 deletions(-) create mode 100644 stubs/monitor-cpu-s390x.c create mode 100644 stubs/monitor-cpu.cqapi/machine-target.json +0
-397@@ -6,403 +6,6 @@ { 'include': 'machine-common.json' } -## -# @CpuModelInfo: -# -# Virtual CPU model. -# -# A CPU model consists of the name of a CPU definition, to which delta -# changes are applied (e.g. features added/removed). Most magic -# values that an architecture might require should be hidden behind -# the name. However, if required, architectures can expose relevant -# properties. -# -# @name: the name of the CPU definition the model is based on -# -# @props: a dictionary of QOM properties to be applied -# -# Since: 2.8 -## -{ 'struct': 'CpuModelInfo', - 'data': { 'name': 'str', - '*props': 'any' } } - -## -# @CpuModelExpansionType: -# -# An enumeration of CPU model expansion types. -# -# @static: Expand to a static CPU model, a combination of a static -# base model name and property delta changes. As the static base -# model will never change, the expanded CPU model will be the -# same, independent of QEMU version, machine type, machine -# options, and accelerator options. Therefore, the resulting -# model can be used by tooling without having to specify a -# compatibility machine - e.g. when displaying the "host" model. -# The @static CPU models are migration-safe. -# -# @full: Expand all properties. The produced model is not guaranteed -# to be migration-safe, but allows tooling to get an insight and -# work with model details. -# -# .. note:: When a non-migration-safe CPU model is expanded in static -# mode, some features enabled by the CPU model may be omitted, -# because they can't be implemented by a static CPU model -# definition (e.g. cache info passthrough and PMU passthrough in -# x86). If you need an accurate representation of the features -# enabled by a non-migration-safe CPU model, use @full. If you -# need a static representation that will keep ABI compatibility -# even when changing QEMU version or machine-type, use @static (but -# keep in mind that some features may be omitted). -# -# Since: 2.8 -## -{ 'enum': 'CpuModelExpansionType', - 'data': [ 'static', 'full' ] } - -## -# @CpuModelCompareResult: -# -# An enumeration of CPU model comparison results. The result is -# usually calculated using e.g. CPU features or CPU generations. -# -# @incompatible: If model A is incompatible to model B, model A is not -# guaranteed to run where model B runs and the other way around. -# -# @identical: If model A is identical to model B, model A is -# guaranteed to run where model B runs and the other way around. -# -# @superset: If model A is a superset of model B, model B is -# guaranteed to run where model A runs. There are no guarantees -# about the other way. -# -# @subset: If model A is a subset of model B, model A is guaranteed to -# run where model B runs. There are no guarantees about the other -# way. -# -# Since: 2.8 -## -{ 'enum': 'CpuModelCompareResult', - 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] } - -## -# @CpuModelBaselineInfo: -# -# The result of a CPU model baseline. -# -# @model: the baselined CpuModelInfo. -# -# Since: 2.8 -## -{ 'struct': 'CpuModelBaselineInfo', - 'data': { 'model': 'CpuModelInfo' }, - 'if': 'TARGET_S390X' } - -## -# @CpuModelCompareInfo: -# -# The result of a CPU model comparison. -# -# @result: The result of the compare operation. -# -# @responsible-properties: List of properties that led to the -# comparison result not being identical. -# -# @responsible-properties is a list of QOM property names that led to -# both CPUs not being detected as identical. For identical models, -# this list is empty. If a QOM property is read-only, that means -# there's no known way to make the CPU models identical. If the -# special property name "type" is included, the models are by -# definition not identical and cannot be made identical. -# -# Since: 2.8 -## -{ 'struct': 'CpuModelCompareInfo', - 'data': { 'result': 'CpuModelCompareResult', - 'responsible-properties': ['str'] }, - 'if': 'TARGET_S390X' } - -## -# @query-cpu-model-comparison: -# -# Compares two CPU models, @modela and @modelb, returning how they -# compare in a specific configuration. The results indicates how -# both models compare regarding runnability. This result can be -# used by tooling to make decisions if a certain CPU model will -# run in a certain configuration or if a compatible CPU model has -# to be created by baselining. -# -# Usually, a CPU model is compared against the maximum possible CPU -# model of a certain configuration (e.g. the "host" model for KVM). -# If that CPU model is identical or a subset, it will run in that -# configuration. -# -# The result returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU -# version. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the -# machine-type. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, -# CPU models may look different depending on machine and accelerator -# options. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu -# option and global properties may affect expansion of CPU models. -# Using query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support comparing CPU models. s390x -# supports comparing CPU models. -# -# @modela: description of the first CPU model to compare, referred to -# as "model A" in CpuModelCompareResult -# -# @modelb: description of the second CPU model to compare, referred to -# as "model B" in CpuModelCompareResult -# -# Returns: a CpuModelCompareInfo describing how both CPU models -# compare -# -# Errors: -# - if comparing CPU models is not supported -# - if a model cannot be used -# - if a model contains an unknown cpu definition name, unknown -# properties or properties with wrong types. -# -# .. note:: This command isn't specific to s390x, but is only -# implemented on this architecture currently. -# -# Since: 2.8 -## -{ 'command': 'query-cpu-model-comparison', - 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' }, - 'returns': 'CpuModelCompareInfo', - 'if': 'TARGET_S390X' } - -## -# @query-cpu-model-baseline: -# -# Baseline two CPU models, @modela and @modelb, creating a compatible -# third model. The created model will always be a static, -# migration-safe CPU model (see "static" CPU model expansion for -# details). -# -# This interface can be used by tooling to create a compatible CPU -# model out two CPU models. The created CPU model will be identical -# to or a subset of both CPU models when comparing them. Therefore, -# the created CPU model is guaranteed to run where the given CPU -# models run. -# -# The result returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU -# version. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the -# machine-type. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, -# CPU models may look different depending on machine and accelerator -# options. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu -# option and global properties may affect expansion of CPU models. -# Using query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support baselining CPU models. s390x -# supports baselining CPU models. -# -# @modela: description of the first CPU model to baseline -# -# @modelb: description of the second CPU model to baseline -# -# Returns: a CpuModelBaselineInfo describing the baselined CPU model -# -# Errors: -# - if baselining CPU models is not supported -# - if a model cannot be used -# - if a model contains an unknown cpu definition name, unknown -# properties or properties with wrong types. -# -# .. note:: This command isn't specific to s390x, but is only -# implemented on this architecture currently. -# -# Since: 2.8 -## -{ 'command': 'query-cpu-model-baseline', - 'data': { 'modela': 'CpuModelInfo', - 'modelb': 'CpuModelInfo' }, - 'returns': 'CpuModelBaselineInfo', - 'if': 'TARGET_S390X' } - -## -# @CpuModelExpansionInfo: -# -# The result of a cpu model expansion. -# -# @model: the expanded CpuModelInfo. -# -# @deprecated-props: an optional list of properties that are flagged as -# deprecated by the CPU vendor. The list depends on the -# CpuModelExpansionType: "static" properties are a subset of the -# enabled-properties for the expanded model; "full" properties are -# a set of properties that are deprecated across all models for -# the architecture. (since: 10.1 -- since 9.1 on s390x --). -# -# Since: 2.8 -## -{ 'struct': 'CpuModelExpansionInfo', - 'data': { 'model': 'CpuModelInfo', - '*deprecated-props' : { 'type': ['str'] } }, - 'if': { 'any': [ 'TARGET_S390X', - 'TARGET_I386', - 'TARGET_ARM', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - -## -# @query-cpu-model-expansion: -# -# Expands a given CPU model, @model, (or a combination of CPU model + -# additional options) to different granularities, specified by @type, -# allowing tooling to get an understanding what a specific CPU model -# looks like in QEMU under a certain configuration. -# -# This interface can be used to query the "host" CPU model. -# -# The data returned by this command may be affected by: -# -# * QEMU version: CPU models may look different depending on the QEMU -# version. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine-type: CPU model may look different depending on the -# machine-type. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * machine options (including accelerator): in some architectures, -# CPU models may look different depending on machine and accelerator -# options. (Except for CPU models reported as "static" in -# query-cpu-definitions.) -# * "-cpu" arguments and global properties: arguments to the -cpu -# option and global properties may affect expansion of CPU models. -# Using query-cpu-model-expansion while using these is not advised. -# -# Some architectures may not support all expansion types. s390x -# supports "full" and "static". Arm only supports "full". -# -# @model: description of the CPU model to expand -# -# @type: expansion type, specifying how to expand the CPU model -# -# Returns: a CpuModelExpansionInfo describing the expanded CPU model -# -# Errors: -# - if expanding CPU models is not supported -# - if the model cannot be expanded -# - if the model contains an unknown CPU definition name, unknown -# properties or properties with a wrong type -# - if an expansion type is not supported -# -# Since: 2.8 -## -{ 'command': 'query-cpu-model-expansion', - 'data': { 'type': 'CpuModelExpansionType', - 'model': 'CpuModelInfo' }, - 'returns': 'CpuModelExpansionInfo', - 'if': { 'any': [ 'TARGET_S390X', - 'TARGET_I386', - 'TARGET_ARM', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - -## -# @CpuDefinitionInfo: -# -# Virtual CPU definition. -# -# @name: the name of the CPU definition -# -# @migration-safe: whether a CPU definition can be safely used for -# migration in combination with a QEMU compatibility machine when -# migrating between different QEMU versions and between hosts with -# different sets of (hardware or software) capabilities. If not -# provided, information is not available and callers should not -# assume the CPU definition to be migration-safe. (since 2.8) -# -# @static: whether a CPU definition is static and will not change -# depending on QEMU version, machine type, machine options and -# accelerator options. A static model is always migration-safe. -# (since 2.8) -# -# @unavailable-features: List of properties that prevent the CPU model -# from running in the current host. (since 2.8) -# -# @typename: Type name that can be used as argument to -# @device-list-properties, to introspect properties configurable -# using -cpu or -global. (since 2.9) -# -# @alias-of: Name of CPU model this model is an alias for. The target -# of the CPU model alias may change depending on the machine type. -# Management software is supposed to translate CPU model aliases -# in the VM configuration, because aliases may stop being -# migration-safe in the future (since 4.1) -# -# @deprecated: If true, this CPU model is deprecated and may be -# removed in in some future version of QEMU according to the QEMU -# deprecation policy. (since 5.2) -# -# @unavailable-features is a list of QOM property names that represent -# CPU model attributes that prevent the CPU from running. If the QOM -# property is read-only, that means there's no known way to make the -# CPU model run in the current host. Implementations that choose not -# to provide specific information return the property name "type". If -# the property is read-write, it means that it MAY be possible to run -# the CPU model in the current host if that property is changed. -# Management software can use it as hints to suggest or choose an -# alternative for the user, or just to generate meaningful error -# messages explaining why the CPU model can't be used. If -# @unavailable-features is an empty list, the CPU model is runnable -# using the current host and machine-type. If @unavailable-features -# is not present, runnability information for the CPU is not -# available. -# -# Since: 1.2 -## -{ 'struct': 'CpuDefinitionInfo', - 'data': { 'name': 'str', - '*migration-safe': 'bool', - 'static': 'bool', - '*unavailable-features': [ 'str' ], - 'typename': 'str', - '*alias-of' : 'str', - 'deprecated' : 'bool' }, - 'if': { 'any': [ 'TARGET_PPC', - 'TARGET_ARM', - 'TARGET_I386', - 'TARGET_S390X', - 'TARGET_MIPS', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - -## -# @query-cpu-definitions: -# -# Return a list of supported virtual CPU definitions -# -# Returns: a list of CpuDefinitionInfo -# -# Since: 1.2 -## -{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'], - 'if': { 'any': [ 'TARGET_PPC', - 'TARGET_ARM', - 'TARGET_I386', - 'TARGET_S390X', - 'TARGET_MIPS', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - ## # @S390CpuPolarization: #qapi/machine.json +150
-0@@ -1916,3 +1916,366 @@ ## { 'command': 'dump-skeys', 'data': { 'filename': 'str' } } + +## +# @CpuModelInfo: +# +# Virtual CPU model. +# +# A CPU model consists of the name of a CPU definition, to which delta +# changes are applied (e.g. features added/removed). Most magic +# values that an architecture might require should be hidden behind +# the name. However, if required, architectures can expose relevant +# properties. +# +# @name: the name of the CPU definition the model is based on +# +# @props: a dictionary of QOM properties to be applied +# +# Since: 2.8 +## +{ 'struct': 'CpuModelInfo', + 'data': { 'name': 'str', + '*props': 'any' } } + +## +# @CpuModelExpansionType: +# +# An enumeration of CPU model expansion types. +# +# @static: Expand to a static CPU model, a combination of a static +# base model name and property delta changes. As the static base +# model will never change, the expanded CPU model will be the +# same, independent of QEMU version, machine type, machine +# options, and accelerator options. Therefore, the resulting +# model can be used by tooling without having to specify a +# compatibility machine - e.g. when displaying the "host" model. +# The @static CPU models are migration-safe. +# +# @full: Expand all properties. The produced model is not guaranteed +# to be migration-safe, but allows tooling to get an insight and +# work with model details. +# +# .. note:: When a non-migration-safe CPU model is expanded in static +# mode, some features enabled by the CPU model may be omitted, +# because they can't be implemented by a static CPU model +# definition (e.g. cache info passthrough and PMU passthrough in +# x86). If you need an accurate representation of the features +# enabled by a non-migration-safe CPU model, use @full. If you +# need a static representation that will keep ABI compatibility +# even when changing QEMU version or machine-type, use @static (but +# keep in mind that some features may be omitted). +# +# Since: 2.8 +## +{ 'enum': 'CpuModelExpansionType', + 'data': [ 'static', 'full' ] } + +## +# @CpuModelCompareResult: +# +# An enumeration of CPU model comparison results. The result is +# usually calculated using e.g. CPU features or CPU generations. +# +# @incompatible: If model A is incompatible to model B, model A is not +# guaranteed to run where model B runs and the other way around. +# +# @identical: If model A is identical to model B, model A is +# guaranteed to run where model B runs and the other way around. +# +# @superset: If model A is a superset of model B, model B is +# guaranteed to run where model A runs. There are no guarantees +# about the other way. +# +# @subset: If model A is a subset of model B, model A is guaranteed to +# run where model B runs. There are no guarantees about the other +# way. +# +# Since: 2.8 +## +{ 'enum': 'CpuModelCompareResult', + 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] } + +## +# @CpuModelBaselineInfo: +# +# The result of a CPU model baseline. +# +# @model: the baselined CpuModelInfo. +# +# Since: 2.8 +## +{ 'struct': 'CpuModelBaselineInfo', + 'data': { 'model': 'CpuModelInfo' } } + +## +# @CpuModelCompareInfo: +# +# The result of a CPU model comparison. +# +# @result: The result of the compare operation. +# +# @responsible-properties: List of properties that led to the +# comparison result not being identical. +# +# @responsible-properties is a list of QOM property names that led to +# both CPUs not being detected as identical. For identical models, +# this list is empty. If a QOM property is read-only, that means +# there's no known way to make the CPU models identical. If the +# special property name "type" is included, the models are by +# definition not identical and cannot be made identical. +# +# Since: 2.8 +## +{ 'struct': 'CpuModelCompareInfo', + 'data': { 'result': 'CpuModelCompareResult', + 'responsible-properties': ['str'] } } + +## +# @query-cpu-model-comparison: +# +# Compares two CPU models, @modela and @modelb, returning how they +# compare in a specific configuration. The results indicates how +# both models compare regarding runnability. This result can be +# used by tooling to make decisions if a certain CPU model will +# run in a certain configuration or if a compatible CPU model has +# to be created by baselining. +# +# Usually, a CPU model is compared against the maximum possible CPU +# model of a certain configuration (e.g. the "host" model for KVM). +# If that CPU model is identical or a subset, it will run in that +# configuration. +# +# The result returned by this command may be affected by: +# +# * QEMU version: CPU models may look different depending on the QEMU +# version. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * machine-type: CPU model may look different depending on the +# machine-type. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * machine options (including accelerator): in some architectures, +# CPU models may look different depending on machine and accelerator +# options. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * "-cpu" arguments and global properties: arguments to the -cpu +# option and global properties may affect expansion of CPU models. +# Using query-cpu-model-expansion while using these is not advised. +# +# Some architectures may not support comparing CPU models. s390x +# supports comparing CPU models. +# +# @modela: description of the first CPU model to compare, referred to
qapi/machine.json line 2078
Quoted 10 lines
qapi/machine.json +10
-0+# as "model A" in CpuModelCompareResult +# +# @modelb: description of the second CPU model to compare, referred to +# as "model B" in CpuModelCompareResult +# +# Returns: a CpuModelCompareInfo describing how both CPU models +# compare +# +# Errors: +# - if comparing CPU models is not supported by the target
You add "by the target", and ...
qapi/machine.json line 2081
Quoted 3 lines
qapi/machine.json +3
-0+# - if a model cannot be used +# - if a model contains an unknown cpu definition name, unknown +# properties or properties with wrong types.
delete this note:
# .. note:: This command isn't specific to s390x, but is only # implemented on this architecture currently.
Lost: command currently works just for s390x targets. Intentional?
Same for query-cpu-model-baseline below.
Quoted 202 lines
qapi/machine.json +200
-0+# +# Since: 2.8 +## +{ 'command': 'query-cpu-model-comparison', + 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' }, + 'returns': 'CpuModelCompareInfo' } + +## +# @query-cpu-model-baseline: +# +# Baseline two CPU models, @modela and @modelb, creating a compatible +# third model. The created model will always be a static, +# migration-safe CPU model (see "static" CPU model expansion for +# details). +# +# This interface can be used by tooling to create a compatible CPU +# model out two CPU models. The created CPU model will be identical +# to or a subset of both CPU models when comparing them. Therefore, +# the created CPU model is guaranteed to run where the given CPU +# models run. +# +# The result returned by this command may be affected by: +# +# * QEMU version: CPU models may look different depending on the QEMU +# version. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * machine-type: CPU model may look different depending on the +# machine-type. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * machine options (including accelerator): in some architectures, +# CPU models may look different depending on machine and accelerator +# options. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * "-cpu" arguments and global properties: arguments to the -cpu +# option and global properties may affect expansion of CPU models. +# Using query-cpu-model-expansion while using these is not advised. +# +# Some architectures may not support baselining CPU models. s390x +# supports baselining CPU models. +# +# @modela: description of the first CPU model to baseline +# +# @modelb: description of the second CPU model to baseline +# +# Returns: a CpuModelBaselineInfo describing the baselined CPU model +# +# Errors: +# - if baselining CPU models is not supported by the target +# - if a model cannot be used +# - if a model contains an unknown cpu definition name, unknown +# properties or properties with wrong types. +# +# Since: 2.8 +## +{ 'command': 'query-cpu-model-baseline', + 'data': { 'modela': 'CpuModelInfo', + 'modelb': 'CpuModelInfo' }, + 'returns': 'CpuModelBaselineInfo' } + +## +# @CpuModelExpansionInfo: +# +# The result of a cpu model expansion. +# +# @model: the expanded CpuModelInfo. +# +# @deprecated-props: an optional list of properties that are flagged as +# deprecated by the CPU vendor. The list depends on the +# CpuModelExpansionType: "static" properties are a subset of the +# enabled-properties for the expanded model; "full" properties are +# a set of properties that are deprecated across all models for +# the architecture. (since: 10.1 -- since 9.1 on s390x --). +# +# Since: 2.8 +## +{ 'struct': 'CpuModelExpansionInfo', + 'data': { 'model': 'CpuModelInfo', + '*deprecated-props' : { 'type': ['str'] } } } + +## +# @query-cpu-model-expansion: +# +# Expands a given CPU model, @model, (or a combination of CPU model + +# additional options) to different granularities, specified by @type, +# allowing tooling to get an understanding what a specific CPU model +# looks like in QEMU under a certain configuration. +# +# This interface can be used to query the "host" CPU model. +# +# The data returned by this command may be affected by: +# +# * QEMU version: CPU models may look different depending on the QEMU +# version. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * machine-type: CPU model may look different depending on the +# machine-type. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * machine options (including accelerator): in some architectures, +# CPU models may look different depending on machine and accelerator +# options. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * "-cpu" arguments and global properties: arguments to the -cpu +# option and global properties may affect expansion of CPU models. +# Using query-cpu-model-expansion while using these is not advised. +# +# Some architectures may not support all expansion types. s390x +# supports "full" and "static". Arm only supports "full". +# +# @model: description of the CPU model to expand +# +# @type: expansion type, specifying how to expand the CPU model +# +# Returns: a CpuModelExpansionInfo describing the expanded CPU model +# +# Errors: +# - if expanding CPU models is not supported +# - if the model cannot be expanded +# - if the model contains an unknown CPU definition name, unknown +# properties or properties with a wrong type +# - if an expansion type is not supported +# +# Since: 2.8 +## +{ 'command': 'query-cpu-model-expansion', + 'data': { 'type': 'CpuModelExpansionType', + 'model': 'CpuModelInfo' }, + 'returns': 'CpuModelExpansionInfo' } + +## +# @CpuDefinitionInfo: +# +# Virtual CPU definition. +# +# @name: the name of the CPU definition +# +# @migration-safe: whether a CPU definition can be safely used for +# migration in combination with a QEMU compatibility machine when +# migrating between different QEMU versions and between hosts with +# different sets of (hardware or software) capabilities. If not +# provided, information is not available and callers should not +# assume the CPU definition to be migration-safe. (since 2.8) +# +# @static: whether a CPU definition is static and will not change +# depending on QEMU version, machine type, machine options and +# accelerator options. A static model is always migration-safe. +# (since 2.8) +# +# @unavailable-features: List of properties that prevent the CPU model +# from running in the current host. (since 2.8) +# +# @typename: Type name that can be used as argument to +# @device-list-properties, to introspect properties configurable +# using -cpu or -global. (since 2.9) +# +# @alias-of: Name of CPU model this model is an alias for. The target +# of the CPU model alias may change depending on the machine type. +# Management software is supposed to translate CPU model aliases +# in the VM configuration, because aliases may stop being +# migration-safe in the future (since 4.1) +# +# @deprecated: If true, this CPU model is deprecated and may be +# removed in in some future version of QEMU according to the QEMU +# deprecation policy. (since 5.2) +# +# @unavailable-features is a list of QOM property names that represent +# CPU model attributes that prevent the CPU from running. If the QOM +# property is read-only, that means there's no known way to make the +# CPU model run in the current host. Implementations that choose not +# to provide specific information return the property name "type". If +# the property is read-write, it means that it MAY be possible to run +# the CPU model in the current host if that property is changed. +# Management software can use it as hints to suggest or choose an +# alternative for the user, or just to generate meaningful error +# messages explaining why the CPU model can't be used. If +# @unavailable-features is an empty list, the CPU model is runnable +# using the current host and machine-type. If @unavailable-features +# is not present, runnability information for the CPU is not +# available. +# +# Since: 1.2 +## +{ 'struct': 'CpuDefinitionInfo', + 'data': { 'name': 'str', + '*migration-safe': 'bool', + 'static': 'bool', + '*unavailable-features': [ 'str' ], + 'typename': 'str', + '*alias-of' : 'str', + 'deprecated' : 'bool' } } + +## +# @query-cpu-definitions: +# +# Return a list of supported virtual CPU definitions +# +# Returns: a list of CpuDefinitionInfo +# +# Since: 1.2 +## +{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }stubs/meson.build +0
-0
[...]
Re: [PATCH 09/10] qapi: make most CPU commands unconditionally available
Quoted 25 lines · Markus Armbruster
Quoted 23 lines · Daniel P. Berrangé
This removes the TARGET_* conditions from all the CPU commands that are conceptually target independent. Top level stubs are provided to cope with targets which do not currently implement all of the commands.
Signed-off-by Daniel P. Berrangé <[email protected]>--- qapi/machine-target.json | 397 -------------------------- qapi/machine.json | 363 +++++++++++++++++++++++ stubs/meson.build | 2 + stubs/monitor-cpu-s390x.c | 23 ++ stubs/monitor-cpu.c | 21 ++ target/arm/arm-qmp-cmds.c | 2 +- target/i386/cpu-system.c | 2 +- target/i386/cpu.c | 2 +- target/loongarch/loongarch-qmp-cmds.c | 2 +- target/mips/system/mips-qmp-cmds.c | 12 +- target/ppc/ppc-qmp-cmds.c | 12 +- target/riscv/riscv-qmp-cmds.c | 2 +- target/s390x/cpu_models_system.c | 2 +- 13 files changed, 437 insertions(+), 405 deletions(-) create mode 100644 stubs/monitor-cpu-s390x.c create mode 100644 stubs/monitor-cpu.c
snip
Quoted 54 lines
Quoted 35 lines
qapi/machine.json +35
-0+## +# @query-cpu-model-comparison: +# +# Compares two CPU models, @modela and @modelb, returning how they +# compare in a specific configuration. The results indicates how +# both models compare regarding runnability. This result can be +# used by tooling to make decisions if a certain CPU model will +# run in a certain configuration or if a compatible CPU model has +# to be created by baselining. +# +# Usually, a CPU model is compared against the maximum possible CPU +# model of a certain configuration (e.g. the "host" model for KVM). +# If that CPU model is identical or a subset, it will run in that +# configuration. +# +# The result returned by this command may be affected by: +# +# * QEMU version: CPU models may look different depending on the QEMU +# version. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * machine-type: CPU model may look different depending on the +# machine-type. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * machine options (including accelerator): in some architectures, +# CPU models may look different depending on machine and accelerator +# options. (Except for CPU models reported as "static" in +# query-cpu-definitions.) +# * "-cpu" arguments and global properties: arguments to the -cpu +# option and global properties may affect expansion of CPU models. +# Using query-cpu-model-expansion while using these is not advised. +# +# Some architectures may not support comparing CPU models. s390x +# supports comparing CPU models. +# +# @modela: description of the first CPU model to compare, referred toqapi/machine.json line 2078
Quoted 10 lines
qapi/machine.json +10
-0+# as "model A" in CpuModelCompareResult +# +# @modelb: description of the second CPU model to compare, referred to +# as "model B" in CpuModelCompareResult +# +# Returns: a CpuModelCompareInfo describing how both CPU models +# compare +# +# Errors: +# - if comparing CPU models is not supported by the targetYou add "by the target", and ...
qapi/machine.json line 2081
Quoted 3 lines
qapi/machine.json +3
-0+# - if a model cannot be used +# - if a model contains an unknown cpu definition name, unknown +# properties or properties with wrong types.delete this note:
Quoted 4 lines
# .. note:: This command isn't specific to s390x, but is only # implemented on this architecture currently.Lost: command currently works just for s390x targets. Intentional?
Kind of.
Previously, the whole command would be tagged for TARGET_S390X so the command was not available at all.
Now its always available, but may return an error at runtime for some targets.
Since we're not providing any mechanism for apps to detect which targets will work and which won't, the implication is that apps are expected to try it if they need it, and cope with any error.
From that POV I thought it might be better not to call out a point-in-time limitation of the impl. I'm not too fussed either way though, so we could re-instate the note.
Quoted 1 line
Same for query-cpu-model-baseline below.
Likewise
With regards,
Daniel
Signature · 3 lines
|: 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 :|
PATCH 10/10 qapi: make s390x specific CPU commands unconditionally available
In reply to Daniel P. BerrangéThis removes the TARGET_S390X and CONFIG_KVM conditions from the CPU commands that are conceptually specific to s390x. Top level stubs are provided to cope with non-s390x targets, or builds without KVM.
The removal of CONFIG_KVM is justified by the fact there is no conceptual difference between running 'qemu-system-s390x -accel tcg' on a build with and without KVM built-in, so apps only using TCG can't rely on the CONFIG_KVM in the schema.
---
hw/s390x/cpu-topology.c | 4 ++--
include/hw/s390x/cpu-topology.h | 2 +-
...machine-target.json => machine-s390x.json} | 15 +++++--------
qapi/meson.build | 2 +-
qapi/qapi-schema.json | 2 +-
stubs/meson.build | 1 +
stubs/monitor-cpu-s390x-kvm.c | 22 +++++++++++++++++++
tests/qtest/qmp-cmd-test.c | 1 +
8 files changed, 34 insertions(+), 15 deletions(-)
rename qapi/{machine-target.json => machine-s390x.json} (85%)
create mode 100644 stubs/monitor-cpu-s390x-kvm.chw/s390x/cpu-topology.c +2 -2
@@ -23,8 +23,8 @@#include "target/s390x/cpu.h" #include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/cpu-topology.h" -#include "qapi/qapi-commands-machine-target.h" -#include "qapi/qapi-events-machine-target.h" +#include "qapi/qapi-commands-machine-s390x.h" +#include "qapi/qapi-events-machine-s390x.h" /* * s390_topology is used to keep the topology information.
include/hw/s390x/cpu-topology.h +1 -1
@@ -13,7 +13,7 @@#include "qemu/queue.h" #include "hw/boards.h" -#include "qapi/qapi-types-machine-target.h" +#include "qapi/qapi-types-machine-s390x.h" #define S390_TOPOLOGY_CPU_IFL 0x03
qapi/machine-s390x.json renamed from qapi/machine-target.json +5 -10
@@ -15,8 +15,7 @@ # Since: 8.2 ## { 'enum': 'S390CpuPolarization', - 'data': [ 'horizontal', 'vertical' ], - 'if': 'TARGET_S390X' + 'data': [ 'horizontal', 'vertical' ] } ##
@@ -54,8 +53,7 @@ '*entitlement': 'S390CpuEntitlement', '*dedicated': 'bool' }, - 'features': [ 'unstable' ], - 'if': { 'all': [ 'TARGET_S390X' , 'CONFIG_KVM' ] } + 'features': [ 'unstable' ] } ##
@@ -90,8 +88,7 @@ ## { 'event': 'CPU_POLARIZATION_CHANGE', 'data': { 'polarization': 'S390CpuPolarization' }, - 'features': [ 'unstable' ], - 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] } + 'features': [ 'unstable' ] } ##
@@ -104,8 +101,7 @@ # Since: 8.2 ## { 'struct': 'CpuPolarizationInfo', - 'data': { 'polarization': 'S390CpuPolarization' }, - 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] } + 'data': { 'polarization': 'S390CpuPolarization' } } ##
@@ -120,6 +116,5 @@ # Since: 8.2 ## { 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo', - 'features': [ 'unstable' ], - 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] } + 'features': [ 'unstable' ] }
qapi/meson.build +1 -1
@@ -39,7 +39,7 @@ qapi_all_modules = [ 'job', 'machine-common', 'machine', - 'machine-target', + 'machine-s390x', 'migration', 'misc', 'net',
qapi/qapi-schema.json +1 -1
@@ -57,7 +57,7 @@ { 'include': 'qdev.json' } { 'include': 'machine-common.json' } { 'include': 'machine.json' } -{ 'include': 'machine-target.json' } +{ 'include': 'machine-s390x.json' } { 'include': 'replay.json' } { 'include': 'yank.json' } { 'include': 'misc.json' }
stubs/meson.build +1 -0
@@ -84,6 +84,7 @@ if have_system stub_ss.add(files('monitor-i386-xen.c')) stub_ss.add(files('monitor-cpu.c')) stub_ss.add(files('monitor-cpu-s390x.c')) + stub_ss.add(files('monitor-cpu-s390x-kvm.c')) endif if have_system or have_user
stubs/monitor-cpu-s390x-kvm.c new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-machine-s390x.h" + +void qmp_set_cpu_topology (uint16_t core, +bool has_socket,uint16_t socket, +bool has_book,uint16_t book, +bool has_drawer,uint16_t drawer, +bool has_entitlement,S390CpuEntitlement entitlement, +bool has_dedicated,bool dedicated, +Error **errp) +{ +error_setg (errp,"CPU topology change is not supported on this target" ); +} + +CpuPolarizationInfo *qmp_query_s390x_cpu_polarization (Error **errp) +{ +error_setg (errp,"CPU polarization is not supported on this target" ); +return NULL ; +}
tests/qtest/qmp-cmd-test.c +1 -0
@@ -100,6 +100,7 @@ static bool query_is_ignored(const char *cmd)/* Success depends on target arch: */ "query-cpu-definitions" ,/* arm, i386, ppc, s390x */ "query-gic-capabilities" ,/* arm */ +"query-s390x-cpu-polarization" ,/* s390x */ /* Success depends on target-specific build configuration: */ "query-pci" ,/* CONFIG_PCI */ "x-query-virtio", /* CONFIG_VIRTIO */
Signature · 1 line
2.49.0
Quoted 25 lines · Daniel P. Berrangé
Pierrick has proposed a series that introduces a concept of runtime conditionals to the QAPI schema, in order to adapt the TARGET_* conditionals currently used at build time:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01699.htmlFor the sake of comparison & evaluation, this series illustrates the alternative approach that we've discussed of entirely removing any concept of TARGET_* conditionals.
With this the QAPI schema varies solely based on CONFIG_* conditionals, and is thus invariant across different target emulators.
In this PoC I've taken the minimal effort approach to the problem.
The QAPI schema has removed the TARGET_* conditionals and in order to make all the emulators then compile, the stubs/ directory is populated with a bunch of files to provide dummy impls of the target specific QMP commands.
This is sufficient to make the current QEMU binaries build successfully.
To make the "single binary" concept work, however, would require additional followup work to eliminate the stubs.
Quoted 7 lines
Instead of having stubs we would need to de-couple the QMP command impl from the machine internals. This would likely require greater use of interfaces and/or virtual method dispatchers on the machine class. This would enable the '
qmp_XXXXX' command impls to exist once. Then they call out to virtual methods on the machine to provide the real impl, and/or generate an error if the virtual method is not implemented for the machine.
Note, I don't see commands "per machine", but per device (including CPU). When not specified, we iterate over device implementations / CPUs.
Quoted 45 lines
Daniel P. Berrangé (9):
qapi: expose rtc-reset-reinjection command unconditionally
qapi: expand docs for SEV commands
qapi: make SEV commands unconditionally available
qapi: expose query-gic-capability command unconditionally
qapi: make SGX commands unconditionally available
qapi: make Xen event commands unconditionally available
qapi: remove the misc-target.json file
qapi: make most CPU commands unconditionally available
qapi: make s390x specific CPU commands unconditionally availablePhilippe Mathieu-Daudé (1):
qapi: Make CpuModelExpansionInfo::deprecated-props optional and
generichw/i386/kvm/xen-stubs.c | 13 - hw/i386/kvm/xen_evtchn.c | 2 +- hw/i386/monitor.c | 2 +- hw/i386/sgx-stub.c | 13 - hw/i386/sgx.c | 2 +- hw/s390x/cpu-topology.c | 4 +- hw/s390x/s390-skeys.c | 1 - include/hw/s390x/cpu-topology.h | 2 +- qapi/machine-s390x.json | 120 ++++++ qapi/machine-target.json | 523 -------------------------- qapi/machine.json | 363 ++++++++++++++++++ qapi/meson.build | 5 +- qapi/misc-arm.json | 49 +++ qapi/misc-i386.json | 479 +++++++++++++++++++++++ qapi/misc-target.json | 504 ------------------------- qapi/qapi-schema.json | 5 +- stubs/meson.build | 8 + stubs/monitor-arm-gic.c | 12 + stubs/monitor-cpu-s390x-kvm.c | 22 ++ stubs/monitor-cpu-s390x.c | 23 ++ stubs/monitor-cpu.c | 21 ++ stubs/monitor-i386-rtc.c | 10 + stubs/monitor-i386-sev.c | 36 ++ stubs/monitor-i386-sgx.c | 17 + stubs/monitor-i386-xen.c | 16 + target/arm/arm-qmp-cmds.c | 4 +- target/i386/cpu-system.c | 2 +- target/i386/cpu.c | 2 +- target/i386/monitor.c | 1 -
Quoted 8 lines
target/i386/sev-system-stub.c | 32 -- target/i386/sev.c | 2 +- target/loongarch/loongarch-qmp-cmds.c | 2 +- target/mips/system/mips-qmp-cmds.c | 12 +- target/ppc/ppc-qmp-cmds.c | 12 +- target/riscv/riscv-qmp-cmds.c | 2 +- target/s390x/cpu_models_system.c | 2 +- tests/qtest/qmp-cmd-test.c | 1 +
Eh I did a very similar series last month which didn't pass local review, I need to remember what was the issue...
$ git diff --stat eb3020b6ed2baca63..32235d621871df0ccc
MAINTAINERS | 3 ++
qapi/machine-arm-target.json | 47 +++++++++++++++++
qapi/machine-s390x-target.json | 301
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
qapi/machine-target.json | 295
--------------------------------------------------------------------------------------------------------
qapi/{misc-target.json => machine-x86-target.json} | 94
++++++++++++++++++----------------
qapi/machine.json | 44 ----------------
qapi/qapi-schema.json | 4 +-
include/hw/s390x/cpu-topology.h | 2 +-
hw/i386/kvm/xen-stubs.c | 2 +-
hw/i386/kvm/xen_evtchn.c | 2 +-
hw/i386/monitor.c | 2 +-
hw/i386/sgx-stub.c | 2 +-
hw/i386/sgx.c | 2 +-
hw/s390x/s390-skeys.c | 1 -
target/arm/arm-qmp-cmds.c | 3 +-
target/i386/cpu-system.c | 1 +
target/i386/cpu.c | 3 ++
target/i386/monitor.c | 2 +-
target/i386/sev-system-stub.c | 2 +-
target/i386/sev.c | 2 +-
target/s390x/cpu_models_system.c | 3 +-
qapi/meson.build | 4 +-
22 files changed, 423 insertions(+), 398 deletions(-)$ git log --oneline eb3020b6ed2baca63..32235d621871df0ccc | tac -r c92b1454ef1 qapi: Restrict ARM specific schemas to ARM 9c708185fe4 qapi: Restrict CpuModelCompareResult to s390x target c50cc3c438c qapi: Restrict s390x-specific schemas to s390x target 221ec7acf18 qapi: Restrict SGXEPCSection to x86 targets a3606c5b23c qapi: Restrict x86-specific schemas to x86 targets 32235d62187 qapi: Guard x86 specific schemas with conditional
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Daniel P. Berrangé
Pierrick has proposed a series that introduces a concept of runtime conditionals to the QAPI schema, in order to adapt the TARGET_* conditionals currently used at build time:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01699.htmlFor the sake of comparison & evaluation, this series illustrates the alternative approach that we've discussed of entirely removing any concept of TARGET_* conditionals.
With this the QAPI schema varies solely based on CONFIG_* conditionals, and is thus invariant across different target emulators.
In this PoC I've taken the minimal effort approach to the problem.
The QAPI schema has removed the TARGET_* conditionals and in order to make all the emulators then compile, the stubs/ directory is populated with a bunch of files to provide dummy impls of the target specific QMP commands.
This is sufficient to make the current QEMU binaries build successfully.
To make the "single binary" concept work, however, would require additional followup work to eliminate the stubs.
Quoted 7 lines
Instead of having stubs we would need to de-couple the QMP command impl from the machine internals. This would likely require greater use of interfaces and/or virtual method dispatchers on the machine class. This would enable the '
qmp_XXXXX' command impls to exist once. Then they call out to virtual methods on the machine to provide the real impl, and/or generate an error if the virtual method is not implemented for the machine.
Quoted 2 lines
Note, I don't see commands "per machine", but per device (including CPU). When not specified, we iterate over device implementations / CPUs.
Yep, that makes sense. If its not abstracted via machines, we'll need to abstract it in some other place in our object model. The right answer probably varies depending on each feature/command we're considering
With regards,
Daniel
Signature · 3 lines
|: 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 :|
Quoted 25 lines · Daniel P. Berrangé
Pierrick has proposed a series that introduces a concept of runtime conditionals to the QAPI schema, in order to adapt the TARGET_* conditionals currently used at build time:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01699.htmlFor the sake of comparison & evaluation, this series illustrates the alternative approach that we've discussed of entirely removing any concept of TARGET_* conditionals.
With this the QAPI schema varies solely based on CONFIG_* conditionals, and is thus invariant across different target emulators.
In this PoC I've taken the minimal effort approach to the problem.
The QAPI schema has removed the TARGET_* conditionals and in order to make all the emulators then compile, the stubs/ directory is populated with a bunch of files to provide dummy impls of the target specific QMP commands.
This is sufficient to make the current QEMU binaries build successfully.
To make the "single binary" concept work, however, would require additional followup work to eliminate the stubs.
Quoted 8 lines
Instead of having stubs we would need to de-couple the QMP command impl from the machine internals. This would likely require greater use of interfaces and/or virtual method dispatchers on the machine class. This would enable the '
qmp_XXXXX' command impls to exist once. Then they call out to virtual methods on the machine to provide the real impl, and/or generate an error if the virtual method is not implemented for the machine.
Thanks for posting it Daniel.
I think your approach is pretty neat, and yes, it's much simpler than having any compile time or runtime conditional to deal with that.
When we talked about that on previous thread, I thought the idea was to expose *all* the commands to *all* the targets, which I didn't really understand, considering we have target specific commands by design. I understand better where you wanted to go, by extracting concerned commands in dedicated files.
The only downside I can see is that some commands have to be there, but return an "error, not implemented" at runtime. Fine for me, but some people may argue against it.
A concern I might have as well is about how we'll deal if we want to hide some commands in the future, based on various criterias (is_heterogenenous()?). The mantra "define all, and let the build system hide things" mantra means you can only have a single definition existing in the binary, by design. But maybe it's not even a real concern, and I definitely prefer to see problems before fixing them, so it's definitely not blocking this approach.
Overall, if I had to choose, I think I would pick your approach instead of the "runtime conditional" route, it's just simpler and saner overall. I would be happy to see you take ownership on that, as long as we can deliver something in the next weeks. I can help on anything as well.
@Markus, @Michael, which approach would you prefer to be followed for QAPI?
Thanks,
Pierrick
Quoted 50 lines · Pierrick Bouvier
Quoted 25 lines · Daniel P. Berrangé
Pierrick has proposed a series that introduces a concept of runtime conditionals to the QAPI schema, in order to adapt the TARGET_* conditionals currently used at build time:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01699.htmlFor the sake of comparison & evaluation, this series illustrates the alternative approach that we've discussed of entirely removing any concept of TARGET_* conditionals.
With this the QAPI schema varies solely based on CONFIG_* conditionals, and is thus invariant across different target emulators.
In this PoC I've taken the minimal effort approach to the problem.
The QAPI schema has removed the TARGET_* conditionals and in order to make all the emulators then compile, the stubs/ directory is populated with a bunch of files to provide dummy impls of the target specific QMP commands.
This is sufficient to make the current QEMU binaries build successfully.
To make the "single binary" concept work, however, would require additional followup work to eliminate the stubs.
Quoted 8 lines
Instead of having stubs we would need to de-couple the QMP command impl from the machine internals. This would likely require greater use of interfaces and/or virtual method dispatchers on the machine class. This would enable the '
qmp_XXXXX' command impls to exist once. Then they call out to virtual methods on the machine to provide the real impl, and/or generate an error if the virtual method is not implemented for the machine.Thanks for posting it Daniel.
I think your approach is pretty neat, and yes, it's much simpler than having any compile time or runtime conditional to deal with that.
When we talked about that on previous thread, I thought the idea was to expose *all* the commands to *all* the targets, which I didn't really understand, considering we have target specific commands by design. I understand better where you wanted to go, by extracting concerned commands in dedicated files.
The only downside I can see is that some commands have to be there, but return an "error, not implemented" at runtime. Fine for me, but some people may argue against it.
Quoted 7 lines
A concern I might have as well is about how we'll deal if we want to hide some commands in the future, based on various criterias (
is_heterogenenous()?). The mantra "define all, and let the build system hide things" mantra means you can only have a single definition existing in the binary, by design. But maybe it's not even a real concern, and I definitely prefer to see problems before fixing them, so it's definitely not blocking this approach.
I think we have to distinguish between what made sense in the context of our original design, from what makes sense for our future design(s) and plans.
I can understand why we took the direction we did historically, but I think we have unwittingly created problems for ourselves that are looking increasingly worse than the problems we considered solved.
In the other thread I pointed out my dislike for QAPI schema not being fully self-describing when we have conditionals present, even today, but there are other aspects that trouble me more wrt conditionals.
Since the schema is currently target specific, a mgmt app has to probe for QEMU capabilities once for every target binary. QEMU has ~30 system binaries, and if querying capabilities takes 250 milliseconds, then querying all binaries is ~ 7 seconds of work. Libvirt mitigates this overhead by caching the results of capabilities probes. We periodically suffer delays when we must invalidate our cache though, typically on software upgrades, and this is unpleasant for users who think we've got stuck or just have bad slow code.
Even if we had a QAPI schema that didn't vary per target, this is repeated probing is tricky to avoid when we have completely independant binaries. We would need QEMU to have some internal "build id", so that we could detect that all binaries came from the same build, to let us avoid re-probing each binary.
With your work to have a single binary that can impersonate any of our target specific binaries, *if* we had a QAPI schema that didn't vary per target, we would stand a real chance of being able to eliminate the need to probe capabilities once for every target.
eg if we assume qemu-system-x86_64 is a symlink to "/usr/bin/qemu-system" (or whatever you call the common binary), then we only need to probe one binary - the target of the symlink - we can easily identify that all the legacy binary symlinks resolve to the same real binary with no special effort.
Conversely if we want the QAPI schema to be varying at runtime per target, it means we have to select a target before we can probe the schema in the binary. If we assume an install with only the new binary and none of the legacy target specific symlinks, we have a chicken & egg problem though.
How do we know what targets are supported ? We should be able to use QAPI to query the available targets, but before we can use QAPI we need to select a target ?
We could make QAPI only expose the pieces of schema that are *not* specific to a target initially, and then refine the schema once a target is selected. That would solve the immediate problem, but I think that kind of cleverness is just postponing the pain
Consider that we eventually want a QEMU binary that can run CPUs from multiple targets concurrently. That implies that a dynamic QAPI schema needs to turn on the target specific pieces of multiple targets at once. At that point a mgmt app fundamentally has to understand ahead of time that some features are target specific - the existance/absence of features in the QAPI schema can no longer express what is target specific, since we must expose the union of features all targets that are in use.
So as we look to the future of QEMU, IMHO, the concept of using the QAPI schema definitions to dynamically express what is available per-target is unhelpful and likely even to be harmful.
Assuming a schema that is fixed at build time ought to simplify QEMU maintainers' life, and while mgmt apps loose a little info, they will gain in other ways such as not having to query QEMU capabilities 30 times over.
Quoted 4 lines
Overall, if I had to choose, I think I would pick your approach instead of the "runtime conditional" route, it's just simpler and saner overall. I would be happy to see you take ownership on that, as long as we can deliver something in the next weeks. I can help on anything as well.
I'm fine with you driving this forward, not least because I can't commit to having any predictable amount of time to write code myself for this.
Quoted 1 line
@Markus, @Michael, which approach would you prefer to be followed for QAPI?
With regards,
Daniel
Signature · 3 lines
|: 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 :|
Quoted 59 lines · Daniel P. Berrangé
Quoted 50 lines · Pierrick Bouvier
Quoted 25 lines · Daniel P. Berrangé
Pierrick has proposed a series that introduces a concept of runtime conditionals to the QAPI schema, in order to adapt the TARGET_* conditionals currently used at build time:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01699.htmlFor the sake of comparison & evaluation, this series illustrates the alternative approach that we've discussed of entirely removing any concept of TARGET_* conditionals.
With this the QAPI schema varies solely based on CONFIG_* conditionals, and is thus invariant across different target emulators.
In this PoC I've taken the minimal effort approach to the problem.
The QAPI schema has removed the TARGET_* conditionals and in order to make all the emulators then compile, the stubs/ directory is populated with a bunch of files to provide dummy impls of the target specific QMP commands.
This is sufficient to make the current QEMU binaries build successfully.
To make the "single binary" concept work, however, would require additional followup work to eliminate the stubs.
Quoted 8 lines
Instead of having stubs we would need to de-couple the QMP command impl from the machine internals. This would likely require greater use of interfaces and/or virtual method dispatchers on the machine class. This would enable the '
qmp_XXXXX' command impls to exist once. Then they call out to virtual methods on the machine to provide the real impl, and/or generate an error if the virtual method is not implemented for the machine.Thanks for posting it Daniel.
I think your approach is pretty neat, and yes, it's much simpler than having any compile time or runtime conditional to deal with that.
When we talked about that on previous thread, I thought the idea was to expose *all* the commands to *all* the targets, which I didn't really understand, considering we have target specific commands by design. I understand better where you wanted to go, by extracting concerned commands in dedicated files.
The only downside I can see is that some commands have to be there, but return an "error, not implemented" at runtime. Fine for me, but some people may argue against it.
Quoted 7 lines
A concern I might have as well is about how we'll deal if we want to hide some commands in the future, based on various criterias (
is_heterogenenous()?). The mantra "define all, and let the build system hide things" mantra means you can only have a single definition existing in the binary, by design. But maybe it's not even a real concern, and I definitely prefer to see problems before fixing them, so it's definitely not blocking this approach.
Quoted 3 lines
I think we have to distinguish between what made sense in the context of our original design, from what makes sense for our future design(s) and plans.
No argument.
The original design idea is simple: #ifdef CONFIG_FOO for QAPI schema, to not generate dead code, and to not have silly stubs. Even if you don't care about wasting disk and address space, you probably care about wasting developer time on writing silly stubs and waiting for dead code to compile.
Initially, target-specific macros did not work in conditions. That was easy enough to fix, so we did.
However, target-specific conditions turned out less useful than anticipated. Adding a target-specific conditional anywhere in a definition makes the entire definition and its users target-specific. This can make handwritten code artificially target-specific, which is undesirable.
Target-specific conditions now also complicate the single binary work.
Quoted 8 lines
I can understand why we took the direction we did historically, but I think we have unwittingly created problems for ourselves that are looking increasingly worse than the problems we considered solved.
In the other thread I pointed out my dislike for QAPI schema not being fully self-describing when we have conditionals present, even today, but there are other aspects that trouble me more wrt conditionals.
I'm not sure I have all this present in my mind... Can you summarize what troubles you? Or point me to the message(s)?
Quoted 8 lines
Since the schema is currently target specific, a mgmt app has to probe for QEMU capabilities once for every target binary. QEMU has ~30 system binaries, and if querying capabilities takes 250 milliseconds, then querying all binaries is ~ 7 seconds of work. Libvirt mitigates this overhead by caching the results of capabilities probes. We periodically suffer delays when we must invalidate our cache though, typically on software upgrades, and this is unpleasant for users who think we've got stuck or just have bad slow code.
How does cache invalidation work? Timestamp of binary?
Quoted 5 lines
Even if we had a QAPI schema that didn't vary per target, this is repeated probing is tricky to avoid when we have completely independant binaries. We would need QEMU to have some internal "build id", so that we could detect that all binaries came from the same build, to let us avoid re-probing each binary.
Back when I created QAPI/QMP introspection, I floated the idea to put something into the QMP greeting to enable safe caching. Libvirt developers told me they didn't need that. I don't remember the details, but I guess the cache invalidation they already had was deemed good enough.
Quoted 4 lines
With your work to have a single binary that can impersonate any of our target specific binaries, *if* we had a QAPI schema that didn't vary per target, we would stand a real chance of being able to eliminate the need to probe capabilities once for every target.
This is actually independent of "single binary".
query-qmp-schema's value will be the same for all qemu-system-FOO built from same QAPI schema source and configuration.
If there are no target-dependent conditionals, schema configuration is the same regardless of target.
Of course, capability probing can go beyond query-qmp-schema, but you get the idea.
Quoted 5 lines
eg if we assume qemu-system-x86_64 is a symlink to "
/usr/bin/qemu-system" (or whatever you call the common binary), then we only need to probe one binary - the target of the symlink - we can easily identify that all the legacy binary symlinks resolve to the same real binary with no special effort.
Have a message digest of query-qmp-schema's value in the QMP greeting. Management application uses it as key to cache probe results.
Quoted 23 lines
Conversely if we want the QAPI schema to be varying at runtime per target, it means we have to select a target before we can probe the schema in the binary. If we assume an install with only the new binary and none of the legacy target specific symlinks, we have a chicken & egg problem though.
How do we know what targets are supported ? We should be able to use QAPI to query the available targets, but before we can use QAPI we need to select a target ?
We could make QAPI only expose the pieces of schema that are *not* specific to a target initially, and then refine the schema once a target is selected. That would solve the immediate problem, but I think that kind of cleverness is just postponing the pain
Consider that we eventually want a QEMU binary that can run CPUs from multiple targets concurrently. That implies that a dynamic QAPI schema needs to turn on the target specific pieces of multiple targets at once. At that point a mgmt app fundamentally has to understand ahead of time that some features are target specific - the existance/absence of features in the QAPI schema can no longer express what is target specific, since we must expose the union of features all targets that are in use.
Quoted 8 lines
So as we look to the future of QEMU, IMHO, the concept of using the QAPI schema definitions to dynamically express what is available per-target is unhelpful and likely even to be harmful.
Assuming a schema that is fixed at build time ought to simplify QEMU maintainers' life, and while mgmt apps loose a little info, they will gain in other ways such as not having to query QEMU capabilities 30 times over.
Schema fixed at build time is a fundamental design choice we made for QAPI.
It limits the questions schema introspection can answer. Can affect valid questions, but that doesn't mean we have to answer them via schema introspection. We've been tempted to answer them via schema introspection because schema introspection has been such a success.
We may need to think about replacements better than "add yet another ad hoc query command" and "QOM tree spelunking". Not a blocker.
Quoted 12 lines
Quoted 4 lines
Overall, if I had to choose, I think I would pick your approach instead of the "runtime conditional" route, it's just simpler and saner overall. I would be happy to see you take ownership on that, as long as we can deliver something in the next weeks. I can help on anything as well.
I'm fine with you driving this forward, not least because I can't commit to having any predictable amount of time to write code myself for this.
Quoted 1 line
@Markus, @Michael, which approach would you prefer to be followed for QAPI?
With regards,
Daniel
Quoted 67 lines · Markus Armbruster
Quoted 59 lines · Daniel P. Berrangé
Quoted 50 lines · Pierrick Bouvier
Quoted 25 lines · Daniel P. Berrangé
Pierrick has proposed a series that introduces a concept of runtime conditionals to the QAPI schema, in order to adapt the TARGET_* conditionals currently used at build time:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01699.htmlFor the sake of comparison & evaluation, this series illustrates the alternative approach that we've discussed of entirely removing any concept of TARGET_* conditionals.
With this the QAPI schema varies solely based on CONFIG_* conditionals, and is thus invariant across different target emulators.
In this PoC I've taken the minimal effort approach to the problem.
The QAPI schema has removed the TARGET_* conditionals and in order to make all the emulators then compile, the stubs/ directory is populated with a bunch of files to provide dummy impls of the target specific QMP commands.
This is sufficient to make the current QEMU binaries build successfully.
To make the "single binary" concept work, however, would require additional followup work to eliminate the stubs.
Quoted 8 lines
Instead of having stubs we would need to de-couple the QMP command impl from the machine internals. This would likely require greater use of interfaces and/or virtual method dispatchers on the machine class. This would enable the '
qmp_XXXXX' command impls to exist once. Then they call out to virtual methods on the machine to provide the real impl, and/or generate an error if the virtual method is not implemented for the machine.Thanks for posting it Daniel.
I think your approach is pretty neat, and yes, it's much simpler than having any compile time or runtime conditional to deal with that.
When we talked about that on previous thread, I thought the idea was to expose *all* the commands to *all* the targets, which I didn't really understand, considering we have target specific commands by design. I understand better where you wanted to go, by extracting concerned commands in dedicated files.
The only downside I can see is that some commands have to be there, but return an "error, not implemented" at runtime. Fine for me, but some people may argue against it.
Quoted 7 lines
A concern I might have as well is about how we'll deal if we want to hide some commands in the future, based on various criterias (
is_heterogenenous()?). The mantra "define all, and let the build system hide things" mantra means you can only have a single definition existing in the binary, by design. But maybe it's not even a real concern, and I definitely prefer to see problems before fixing them, so it's definitely not blocking this approach.Quoted 3 lines
I think we have to distinguish between what made sense in the context of our original design, from what makes sense for our future design(s) and plans.
No argument.
Quoted 8 lines
The original design idea is simple: #ifdef
CONFIG_FOOfor QAPI schema, to not generate dead code, and to not have silly stubs. Even if you don't care about wasting disk and address space, you probably care about wasting developer time on writing silly stubs and waiting for dead code to compile.Initially, target-specific macros did not work in conditions. That was easy enough to fix, so we did.
Ah, yes, forgot that bit of history.
Quoted 11 lines
Quoted 8 lines
I can understand why we took the direction we did historically, but I think we have unwittingly created problems for ourselves that are looking increasingly worse than the problems we considered solved.
In the other thread I pointed out my dislike for QAPI schema not being fully self-describing when we have conditionals present, even today, but there are other aspects that trouble me more wrt conditionals.
I'm not sure I have all this present in my mind... Can you summarize what troubles you? Or point me to the message(s)?
Oppps, sorry, should have cross-linked to:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01947.html
Quoted 10 lines
Quoted 8 lines
Since the schema is currently target specific, a mgmt app has to probe for QEMU capabilities once for every target binary. QEMU has ~30 system binaries, and if querying capabilities takes 250 milliseconds, then querying all binaries is ~ 7 seconds of work. Libvirt mitigates this overhead by caching the results of capabilities probes. We periodically suffer delays when we must invalidate our cache though, typically on software upgrades, and this is unpleasant for users who think we've got stuck or just have bad slow code.
How does cache invalidation work? Timestamp of binary?
ctime of libvirt itself and ctime of QEMU binary are the two primary factors.
We had to throw in other factors on top for various edge cases over time. So we also check the mtime of the directory containing QEMU loadable modules, as features reported can vary if the user installs new device/backend modules. Also check kernel version, microcode version, CPUID signature, because that can affect availability of some features.
NB, this is caching more than just the QMP schema - we issue many 'query-xxxx' commands when probing QEMU.
https://gitlab.com/libvirt/libvirt/-/blame/master/src/qemu/qemu_capabilities.c#L5406
Quoted 11 lines
Quoted 5 lines
Even if we had a QAPI schema that didn't vary per target, this is repeated probing is tricky to avoid when we have completely independant binaries. We would need QEMU to have some internal "build id", so that we could detect that all binaries came from the same build, to let us avoid re-probing each binary.
Back when I created QAPI/QMP introspection, I floated the idea to put something into the QMP greeting to enable safe caching. Libvirt developers told me they didn't need that. I don't remember the details, but I guess the cache invalidation they already had was deemed good enough.
I don't recall that discussion, but I would think the problem is that we probe much more than just QMP schema. Actually thinking about it, the fact that we probe more than just QMP schema means my idea of probing once and getting the answer for all targets may not be practical. Some of the query-xxx commands we run will likely need to know the target.
With regards,
Daniel
Signature · 3 lines
|: 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 :|
Quoted 28 lines · Daniel P. Berrangé
Quoted 7 lines · Markus Armbruster
Quoted 3 lines · Daniel P. Berrangé
I think we have to distinguish between what made sense in the context of our original design, from what makes sense for our future design(s) and plans.
No argument.
Quoted 8 lines
The original design idea is simple: #ifdef
CONFIG_FOOfor QAPI schema, to not generate dead code, and to not have silly stubs. Even if you don't care about wasting disk and address space, you probably care about wasting developer time on writing silly stubs and waiting for dead code to compile.Initially, target-specific macros did not work in conditions. That was easy enough to fix, so we did.
Ah, yes, forgot that bit of history.
Quoted 9 lines
Quoted 8 lines
I can understand why we took the direction we did historically, but I think we have unwittingly created problems for ourselves that are looking increasingly worse than the problems we considered solved.
In the other thread I pointed out my dislike for QAPI schema not being fully self-describing when we have conditionals present, even today, but there are other aspects that trouble me more wrt conditionals.
Quoted 6 lines
Quoted 2 lines
I'm not sure I have all this present in my mind... Can you summarize what troubles you? Or point me to the message(s)?
Oppps, sorry, should have cross-linked to:
https://lists.nongnu.org/archive/html/qemu-devel/2025-05/msg01947.html
Hadn't gotten to that thread... Thanks!
Quoted 38 lines
Quoted 10 lines
Quoted 8 lines
Since the schema is currently target specific, a mgmt app has to probe for QEMU capabilities once for every target binary. QEMU has ~30 system binaries, and if querying capabilities takes 250 milliseconds, then querying all binaries is ~ 7 seconds of work. Libvirt mitigates this overhead by caching the results of capabilities probes. We periodically suffer delays when we must invalidate our cache though, typically on software upgrades, and this is unpleasant for users who think we've got stuck or just have bad slow code.
How does cache invalidation work? Timestamp of binary?
ctime of libvirt itself and ctime of QEMU binary are the two primary factors.
We had to throw in other factors on top for various edge cases over time. So we also check the mtime of the directory containing QEMU loadable modules, as features reported can vary if the user installs new device/backend modules. Also check kernel version, microcode version, CPUID signature, because that can affect availability of some features.
NB, this is caching more than just the QMP schema - we issue many 'query-xxxx' commands when probing QEMU.
https://gitlab.com/libvirt/libvirt/-/blame/master/src/qemu/qemu_capabilities.c#L5406
Quoted 11 lines
Quoted 5 lines
Even if we had a QAPI schema that didn't vary per target, this is repeated probing is tricky to avoid when we have completely independant binaries. We would need QEMU to have some internal "build id", so that we could detect that all binaries came from the same build, to let us avoid re-probing each binary.
Back when I created QAPI/QMP introspection, I floated the idea to put something into the QMP greeting to enable safe caching. Libvirt developers told me they didn't need that. I don't remember the details, but I guess the cache invalidation they already had was deemed good enough.
Quoted 6 lines
I don't recall that discussion, but I would think the problem is that we probe much more than just QMP schema. Actually thinking about it, the fact that we probe more than just QMP schema means my idea of probing once and getting the answer for all targets may not be practical. Some of the query-xxx commands we run will likely need to know the target.
Yes.
We could split the cache along validity conditions. Possibly worth the extra complexity if expensive probes then live longer in their cache.
I'd love to have a list of probes libvirt runs and why.
Quoted 23 lines · Markus Armbruster
Quoted 14 lines · Daniel P. Berrangé
Quoted 7 lines · Markus Armbruster
Quoted 5 lines · Daniel P. Berrangé
Even if we had a QAPI schema that didn't vary per target, this is repeated probing is tricky to avoid when we have completely independant binaries. We would need QEMU to have some internal "build id", so that we could detect that all binaries came from the same build, to let us avoid re-probing each binary.
Quoted 5 lines
Back when I created QAPI/QMP introspection, I floated the idea to put something into the QMP greeting to enable safe caching. Libvirt developers told me they didn't need that. I don't remember the details, but I guess the cache invalidation they already had was deemed good enough.
Quoted 6 lines
I don't recall that discussion, but I would think the problem is that we probe much more than just QMP schema. Actually thinking about it, the fact that we probe more than just QMP schema means my idea of probing once and getting the answer for all targets may not be practical. Some of the query-xxx commands we run will likely need to know the target.
Quoted 6 lines
Yes.
We could split the cache along validity conditions. Possibly worth the extra complexity if expensive probes then live longer in their cache.
I'd love to have a list of probes libvirt runs and why.
We don't record the 'why' I'm afraid, so answer the 'why' is pretty much a case of having to read the code :-(
The list of probes is also somewhat metadata driven, starting from:
you would have to then work backwards for each virQMEUCapsProbeQMP method we call.
With regards,
Daniel
Signature · 3 lines
|: 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 :|
PATCH 10 empties out and deletes qapi/machine-target.json. PATCH 04 empties out qapi/misc-target.json without deleting it. Missing:
* Delete qapi/misc-target.json
* Delete entry F: qapi/machine-target.json in MAINTAINERS
* Delete dead logic around qapi_specific_outputs in qapi/meson.build
The latter deserves its own PATCH 11. Whether to delete the qapi/*-target.json in the patch that empties the file or in PATCH 11 is a matter of taste.
Quoted 5 lines · Markus Armbruster
PATCH 10 empties out and deletes
qapi/machine-target.json. PATCH 04 empties outqapi/misc-target.jsonwithout deleting it. Missing:* Delete
qapi/misc-target.json
Quoted 7 lines
* Delete entry F:
qapi/machine-target.jsoninMAINTAINERS* Delete dead logic around
qapi_specific_outputsin qapi/meson.buildThe latter deserves its own PATCH 11. Whether to delete the
qapi/*-target.jsonin the patch that empties the file or in PATCH 11 is a matter of taste.
FYI, after discussing with Pierrick, I'm going to let him take over work on this patch series to drive it forward to something viable to submit as a non-RFC.
With regards,
Daniel
Signature · 3 lines
|: 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 :|
Quoted 10 lines · Daniel P. Berrangé
Quoted 9 lines · Markus Armbruster
PATCH 10 empties out and deletes
qapi/machine-target.json. PATCH 04 empties outqapi/misc-target.jsonwithout deleting it. Missing:* Delete
qapi/misc-target.json* Delete entry F:
qapi/machine-target.jsoninMAINTAINERS* Delete dead logic around
qapi_specific_outputsin qapi/meson.build
Quoted 8 lines
Quoted 3 lines
The latter deserves its own PATCH 11. Whether to delete the
qapi/*-target.jsonin the patch that empties the file or in PATCH 11 is a matter of taste.FYI, after discussing with Pierrick, I'm going to let him take over work on this patch series to drive it forward to something viable to submit as a non-RFC.
Thanks for your work Daniel, I'll continue the effort based on your approach.
Just for information, I'll apply a Signed-off-by with my name to all patches posted (including the ones I won't touch) simply because I use git rebase --signoff by default, and don't want to have to do this manually and selectively, as I work with a single master, with stacked branches and update-refs.
Regards,
Pierrick
Quoted 2 lines
With regards,
Daniel
Quoted 11 lines · Pierrick Bouvier
Quoted 10 lines · Daniel P. Berrangé
Quoted 9 lines · Markus Armbruster
PATCH 10 empties out and deletes
qapi/machine-target.json. PATCH 04 empties outqapi/misc-target.jsonwithout deleting it. Missing:* Delete
qapi/misc-target.json* Delete entry F:
qapi/machine-target.jsoninMAINTAINERS* Delete dead logic around
qapi_specific_outputsin qapi/meson.build
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
The latter deserves its own PATCH 11. Whether to delete the
qapi/*-target.jsonin the patch that empties the file or in PATCH 11 is a matter of taste.FYI, after discussing with Pierrick, I'm going to let him take over work on this patch series to drive it forward to something viable to submit as a non-RFC.
No worries, you're passing them into capable hands.
Quoted 8 lines
Thanks for your work Daniel, I'll continue the effort based on your approach.
Just for information, I'll apply a Signed-off-by with my name to all patches posted (including the ones I won't touch) simply because I use git rebase --signoff by default, and don't want to have to do this manually and selectively, as I work with a single master, with stacked branches and update-refs.
We actually expect you to add your S-o-B to patches that go through your tree whether you changed them or not.
Quoted 9 lines · Markus Armbruster
Quoted 5 lines
Just for information, I'll apply a Signed-off-by with my name to all patches posted (including the ones I won't touch) simply because I use git rebase --signoff by default, and don't want to have to do this manually and selectively, as I work with a single master, with stacked branches and update-refs.
We actually expect you to add your S-o-B to patches that go through your tree whether you changed them or not.
Oh ok, it's good then!
I was thinking it was deserved to "I'm the author of this patch".
Thanks,
Pierrick
Quoted 7 lines · Pierrick Bouvier
Quoted 6 lines · Markus Armbruster
Quoted 5 lines
Just for information, I'll apply a Signed-off-by with my name to all patches posted (including the ones I won't touch) simply because I use git rebase --signoff by default, and don't want to have to do this manually and selectively, as I work with a single master, with stacked branches and update-refs.
Quoted 6 lines
Quoted 3 lines
We actually expect you to add your S-o-B to patches that go through your tree whether you changed them or not.
Oh ok, it's good then!
I was thinking it was deserved to "I'm the author of this patch".
The first one means that.
Essentially the S-o-B lines form a chain tracing the flow of patches. The first S-o-B will be the original author. Additional S-o-Bs will be anyone who queued or modified the patch on its way into qemu.git. Each additional one says that they trusted the person they got it from and thus they're asserting compliance with the DCO at each step
With regards,
Daniel
Signature · 3 lines
|: 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 :|