* [PATCH v4 01/15] qapi: expose rtc-reset-reinjection command unconditionally
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 02/15] qapi: expand docs for SEV commands Pierrick Bouvier
` (14 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
From: Daniel P. Berrangé <berrange@redhat.com>
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.
The stub impl for non-i386 targets retains this no-op behaviour.
However, it is now reporting an Error mentioning this command is not
available for current target.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-i386.json | 24 ++++++++++++++++++++++++
qapi/misc-target.json | 17 -----------------
qapi/qapi-schema.json | 1 +
hw/i386/monitor.c | 2 +-
stubs/monitor-i386-rtc.c | 12 ++++++++++++
qapi/meson.build | 1 +
stubs/meson.build | 1 +
7 files changed, 40 insertions(+), 18 deletions(-)
create mode 100644 qapi/misc-i386.json
create mode 100644 stubs/monitor-i386-rtc.c
diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
new file mode 100644
index 00000000000..d5bfd91405e
--- /dev/null
+++ b/qapi/misc-i386.json
@@ -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' }
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index f7ec695caad..c5f9f6be7e1 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -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:
#
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 7bc600bb768..96f6aa44133 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -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' }
diff --git a/hw/i386/monitor.c b/hw/i386/monitor.c
index 1921e4d52e9..79df96562f6 100644
--- a/hw/i386/monitor.c
+++ b/hw/i386/monitor.c
@@ -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"
diff --git a/stubs/monitor-i386-rtc.c b/stubs/monitor-i386-rtc.c
new file mode 100644
index 00000000000..8420d7c93c2
--- /dev/null
+++ b/stubs/monitor-i386-rtc.c
@@ -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-i386.h"
+
+void qmp_rtc_reset_reinjection(Error **errp)
+{
+ error_setg(errp,
+ "RTC interrupt reinjection backlog reset is not available for"
+ "this machine");
+}
diff --git a/qapi/meson.build b/qapi/meson.build
index eadde4db307..3a9bd061047 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -64,6 +64,7 @@ if have_system
'qdev',
'pci',
'rocker',
+ 'misc-i386',
'tpm',
'uefi',
]
diff --git a/stubs/meson.build b/stubs/meson.build
index 63392f5e785..9907b54c1e6 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -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
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH v4 02/15] qapi: expand docs for SEV commands
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 01/15] qapi: expose rtc-reset-reinjection command unconditionally Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-27 11:26 ` Markus Armbruster
2025-05-27 12:47 ` Markus Armbruster
2025-05-22 19:05 ` [PATCH v4 03/15] qapi: make SEV commands unconditionally available Pierrick Bouvier
` (13 subsequent siblings)
15 siblings, 2 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
From: Daniel P. Berrangé <berrange@redhat.com>
This gives some more context about the behaviour of the commands in
unsupported guest configuration or platform scenarios.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-target.json | 43 ++++++++++++++++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 7 deletions(-)
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index c5f9f6be7e1..6b857efc1cc 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -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)
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v4 02/15] qapi: expand docs for SEV commands
2025-05-22 19:05 ` [PATCH v4 02/15] qapi: expand docs for SEV commands Pierrick Bouvier
@ 2025-05-27 11:26 ` Markus Armbruster
2025-05-27 16:54 ` Pierrick Bouvier
2025-05-27 12:47 ` Markus Armbruster
1 sibling, 1 reply; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 11:26 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> From: Daniel P. Berrangé <berrange@redhat.com>
>
> This gives some more context about the behaviour of the commands in
> unsupported guest configuration or platform scenarios.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/misc-target.json | 43 ++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 36 insertions(+), 7 deletions(-)
>
> diff --git a/qapi/misc-target.json b/qapi/misc-target.json
> index c5f9f6be7e1..6b857efc1cc 100644
> --- a/qapi/misc-target.json
> +++ b/qapi/misc-target.json
> @@ -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
Humor me, please: separate sentences with two spaces for consistency.
> +# 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
Missing period at the end of sentence.
> +#
> +# 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.
Slightly long lines. docs/devel/qapi-code-gen.rst:
For legibility, wrap text paragraphs so every line is at most 70
characters long.
> #
> # @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)
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 02/15] qapi: expand docs for SEV commands
2025-05-27 11:26 ` Markus Armbruster
@ 2025-05-27 16:54 ` Pierrick Bouvier
2025-05-28 6:01 ` Markus Armbruster
0 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-27 16:54 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
On 5/27/25 4:26 AM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> From: Daniel P. Berrangé <berrange@redhat.com>
>>
>> This gives some more context about the behaviour of the commands in
>> unsupported guest configuration or platform scenarios.
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> qapi/misc-target.json | 43 ++++++++++++++++++++++++++++++++++++-------
>> 1 file changed, 36 insertions(+), 7 deletions(-)
>>
>> diff --git a/qapi/misc-target.json b/qapi/misc-target.json
>> index c5f9f6be7e1..6b857efc1cc 100644
>> --- a/qapi/misc-target.json
>> +++ b/qapi/misc-target.json
>> @@ -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
>
> Humor me, please: separate sentences with two spaces for consistency.
>
>> +# 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
>
> Missing period at the end of sentence.
>
>> +#
>> +# 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.
>
> Slightly long lines. docs/devel/qapi-code-gen.rst:
>
> For legibility, wrap text paragraphs so every line is at most 70
> characters long.
>
>> #
>> # @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)
>
All good for me.
The only question that crossed my mind when you asked for those changes
previously was: "Why does QAPI has it's own style, and not simply
following the QEMU official style?"
In the end, you choose which rules apply to this subsystem, and I have
no strong opinion on whether it should be 70, 72 or 80 characters on the
line, or if we prefer tabs to spaces (to make some analogy). I just
think it's surprising to have a different coding style only here for
arbitrary reasons.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 02/15] qapi: expand docs for SEV commands
2025-05-27 16:54 ` Pierrick Bouvier
@ 2025-05-28 6:01 ` Markus Armbruster
2025-05-28 18:38 ` Pierrick Bouvier
0 siblings, 1 reply; 38+ messages in thread
From: Markus Armbruster @ 2025-05-28 6:01 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> On 5/27/25 4:26 AM, Markus Armbruster wrote:
[...]
> All good for me.
> The only question that crossed my mind when you asked for those changes previously was: "Why does QAPI has it's own style, and not simply following the QEMU official style?"
Fair question! It's down to the difference between code and
documentation text.
Humans tend to have trouble following long lines with their eyes (I sure
do). Typographic manuals suggest to limit columns to roughly 60
characters for exactly that reason[*].
For code, four levels of indentation plus 60 characters of actual text
yields 76. However, code lines can be awkward to break, and going over
80 can be less bad than an awkward line break. Use your judgement.
Documentation text, however, tends to be indented much less: 6-10
characters of indentation plus 60 of actual text yields 66-70. When I
reflowed the entire QAPI schema documentation to stay within that limit
(commit a937b6aa739), not a single line break was awkward.
> In the end, you choose which rules apply to this subsystem, and I have no strong opinion on whether it should be 70, 72 or 80 characters on the line, or if we prefer tabs to spaces (to make some analogy). I just think it's surprising to have a different coding style only here for arbitrary reasons.
I hope you understand my reasons better now :)
[*] https://en.wikipedia.org/wiki/Column_(typography)#Typographic_style
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 02/15] qapi: expand docs for SEV commands
2025-05-28 6:01 ` Markus Armbruster
@ 2025-05-28 18:38 ` Pierrick Bouvier
0 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-28 18:38 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
On 5/27/25 11:01 PM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> On 5/27/25 4:26 AM, Markus Armbruster wrote:
>
> [...]
>
>> All good for me.
>> The only question that crossed my mind when you asked for those changes previously was: "Why does QAPI has it's own style, and not simply following the QEMU official style?"
>
> Fair question! It's down to the difference between code and
> documentation text.
>
> Humans tend to have trouble following long lines with their eyes (I sure
> do). Typographic manuals suggest to limit columns to roughly 60
> characters for exactly that reason[*].
>
> For code, four levels of indentation plus 60 characters of actual text
> yields 76. However, code lines can be awkward to break, and going over
> 80 can be less bad than an awkward line break. Use your judgement.
>
> Documentation text, however, tends to be indented much less: 6-10
> characters of indentation plus 60 of actual text yields 66-70. When I
> reflowed the entire QAPI schema documentation to stay within that limit
> (commit a937b6aa739), not a single line break was awkward.
>
>> In the end, you choose which rules apply to this subsystem, and I have no strong opinion on whether it should be 70, 72 or 80 characters on the line, or if we prefer tabs to spaces (to make some analogy). I just think it's surprising to have a different coding style only here for arbitrary reasons.
>
> I hope you understand my reasons better now :)
>
>
> [*] https://en.wikipedia.org/wiki/Column_(typography)#Typographic_style
>
Thanks for giving the insight on this.
I think the (arbitrary) 80 columns for code is coming from punch cards
era. Overall, whether it's 60, 72 or 80, it looks good for human eye.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 02/15] qapi: expand docs for SEV commands
2025-05-22 19:05 ` [PATCH v4 02/15] qapi: expand docs for SEV commands Pierrick Bouvier
2025-05-27 11:26 ` Markus Armbruster
@ 2025-05-27 12:47 ` Markus Armbruster
1 sibling, 0 replies; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 12:47 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> From: Daniel P. Berrangé <berrange@redhat.com>
>
> This gives some more context about the behaviour of the commands in
> unsupported guest configuration or platform scenarios.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/misc-target.json | 43 ++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 36 insertions(+), 7 deletions(-)
>
> diff --git a/qapi/misc-target.json b/qapi/misc-target.json
> index c5f9f6be7e1..6b857efc1cc 100644
> --- a/qapi/misc-target.json
> +++ b/qapi/misc-target.json
> @@ -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.
"Undefined" makes my old C scars hurt. What about "unspecified"?
> #
> # Returns: @SevInfo
> #
[...]
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v4 03/15] qapi: make SEV commands unconditionally available
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 01/15] qapi: expose rtc-reset-reinjection command unconditionally Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 02/15] qapi: expand docs for SEV commands Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 04/15] qapi: expose query-gic-capability command unconditionally Pierrick Bouvier
` (12 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
From: Daniel P. Berrangé <berrange@redhat.com>
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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-i386.json | 271 ++++++++++++++++++++++++++++++++
qapi/misc-target.json | 284 ----------------------------------
stubs/monitor-i386-sev.c | 36 +++++
target/i386/sev-system-stub.c | 32 ----
target/i386/sev.c | 2 +-
stubs/meson.build | 1 +
6 files changed, 309 insertions(+), 317 deletions(-)
create mode 100644 stubs/monitor-i386-sev.c
diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
index d5bfd91405e..de0e4ab67ff 100644
--- a/qapi/misc-i386.json
+++ b/qapi/misc-i386.json
@@ -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' }
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index 6b857efc1cc..c0d7b311f30 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -2,290 +2,6 @@
# vim: filetype=python
#
-##
-# @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' ],
- 'if': 'TARGET_I386' }
-
-##
-# @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' ],
- 'if': 'TARGET_I386' }
-
-##
-# @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' },
- 'if': 'TARGET_I386' }
-
-##
-# @SevSnpGuestInfo:
-#
-# Information specific to SEV-SNP guests.
-#
-# @snp-policy: SEV-SNP policy value
-#
-# Since: 9.1
-##
-{ 'struct': 'SevSnpGuestInfo',
- 'data': { 'snp-policy': 'uint64' },
- 'if': 'TARGET_I386' }
-
-##
-# @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' },
- 'if': 'TARGET_I386' }
-
-
-##
-# @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',
- 'if': 'TARGET_I386' }
-
-##
-# @SevLaunchMeasureInfo:
-#
-# SEV Guest Launch measurement information
-#
-# @data: the measurement value encoded in base64
-#
-# Since: 2.12
-##
-{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'},
- 'if': 'TARGET_I386' }
-
-##
-# @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',
- 'if': 'TARGET_I386' }
-
-##
-# @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'},
- 'if': 'TARGET_I386' }
-
-##
-# @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',
- 'if': 'TARGET_I386' }
-
-##
-# @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' },
- 'if': 'TARGET_I386' }
-
-##
-# @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'},
- 'if': 'TARGET_I386' }
-
-##
-# @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',
- 'if': 'TARGET_I386' }
-
##
# @GICCapability:
#
diff --git a/stubs/monitor-i386-sev.c b/stubs/monitor-i386-sev.c
new file mode 100644
index 00000000000..d4f024128ca
--- /dev/null
+++ b/stubs/monitor-i386-sev.c
@@ -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;
+}
diff --git a/target/i386/sev-system-stub.c b/target/i386/sev-system-stub.c
index d5bf886e799..7c5c02a5657 100644
--- a/target/i386/sev-system-stub.c
+++ b/target/i386/sev-system-stub.c
@@ -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");
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 7ee700d6a35..56dd64e659a 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -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"
diff --git a/stubs/meson.build b/stubs/meson.build
index 9907b54c1e6..9922ec7b88e 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -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
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH v4 04/15] qapi: expose query-gic-capability command unconditionally
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (2 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 03/15] qapi: make SEV commands unconditionally available Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 05/15] qapi: make SGX commands unconditionally available Pierrick Bouvier
` (11 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
From: Daniel P. Berrangé <berrange@redhat.com>
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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-arm.json | 49 +++++++++++++++++++++++++++++++++++++++
qapi/misc-target.json | 44 -----------------------------------
qapi/qapi-schema.json | 1 +
stubs/monitor-arm-gic.c | 12 ++++++++++
target/arm/arm-qmp-cmds.c | 2 +-
qapi/meson.build | 1 +
stubs/meson.build | 1 +
7 files changed, 65 insertions(+), 45 deletions(-)
create mode 100644 qapi/misc-arm.json
create mode 100644 stubs/monitor-arm-gic.c
diff --git a/qapi/misc-arm.json b/qapi/misc-arm.json
new file mode 100644
index 00000000000..f5341372f5a
--- /dev/null
+++ b/qapi/misc-arm.json
@@ -0,0 +1,49 @@
+# -*- Mode: Python -*-
+# vim: filetype=python
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+##
+# @GICCapability:
+#
+# The struct describes capability for a specific GIC (Generic
+# Interrupt Controller) version. These bits are not only decided by
+# QEMU/KVM software version, but also decided by the hardware that the
+# program is running upon.
+#
+# @version: version of GIC to be described. Currently, only 2 and 3
+# are supported.
+#
+# @emulated: whether current QEMU/hardware supports emulated GIC
+# device in user space.
+#
+# @kernel: whether current QEMU/hardware supports hardware accelerated
+# GIC device in kernel.
+#
+# Since: 2.6
+##
+{ 'struct': 'GICCapability',
+ 'data': { 'version': 'int',
+ 'emulated': 'bool',
+ 'kernel': 'bool' } }
+
+##
+# @query-gic-capabilities:
+#
+# It will return a list of GICCapability objects that describe its
+# capability bits.
+#
+# On non-ARM targets this command will report an error as the GIC
+# technology is not applicable.
+#
+# Returns: a list of GICCapability objects.
+#
+# Since: 2.6
+#
+# .. qmp-example::
+#
+# -> { "execute": "query-gic-capabilities" }
+# <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
+# { "version": 3, "emulated": false, "kernel": true } ] }
+##
+{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'] }
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index c0d7b311f30..cc472ce91cb 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -2,50 +2,6 @@
# vim: filetype=python
#
-##
-# @GICCapability:
-#
-# The struct describes capability for a specific GIC (Generic
-# Interrupt Controller) version. These bits are not only decided by
-# QEMU/KVM software version, but also decided by the hardware that the
-# program is running upon.
-#
-# @version: version of GIC to be described. Currently, only 2 and 3
-# are supported.
-#
-# @emulated: whether current QEMU/hardware supports emulated GIC
-# device in user space.
-#
-# @kernel: whether current QEMU/hardware supports hardware accelerated
-# GIC device in kernel.
-#
-# Since: 2.6
-##
-{ 'struct': 'GICCapability',
- 'data': { 'version': 'int',
- 'emulated': 'bool',
- 'kernel': 'bool' },
- 'if': 'TARGET_ARM' }
-
-##
-# @query-gic-capabilities:
-#
-# This command is ARM-only. It will return a list of GICCapability
-# objects that describe its capability bits.
-#
-# Returns: a list of GICCapability objects.
-#
-# Since: 2.6
-#
-# .. qmp-example::
-#
-# -> { "execute": "query-gic-capabilities" }
-# <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
-# { "version": 3, "emulated": false, "kernel": true } ] }
-##
-{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'],
- 'if': 'TARGET_ARM' }
-
##
# @SgxEpcSection:
#
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 96f6aa44133..e96bff8d38c 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -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' }
diff --git a/stubs/monitor-arm-gic.c b/stubs/monitor-arm-gic.c
new file mode 100644
index 00000000000..b3429243ef8
--- /dev/null
+++ b/stubs/monitor-arm-gic.c
@@ -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;
+}
diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c
index a1a944adb43..ef18c867ca4 100644
--- a/target/arm/arm-qmp-cmds.c
+++ b/target/arm/arm-qmp-cmds.c
@@ -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"
diff --git a/qapi/meson.build b/qapi/meson.build
index 3a9bd061047..5e93e6b8cfd 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -64,6 +64,7 @@ if have_system
'qdev',
'pci',
'rocker',
+ 'misc-arm',
'misc-i386',
'tpm',
'uefi',
diff --git a/stubs/meson.build b/stubs/meson.build
index 9922ec7b88e..07e9d3799a5 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -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
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH v4 05/15] qapi: make SGX commands unconditionally available
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (3 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 04/15] qapi: expose query-gic-capability command unconditionally Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 06/15] qapi: make Xen event " Pierrick Bouvier
` (10 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
From: Daniel P. Berrangé <berrange@redhat.com>
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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-i386.json | 77 +++++++++++++++++++++++++++++++++++++++
qapi/misc-target.json | 79 ----------------------------------------
hw/i386/sgx-stub.c | 2 +-
hw/i386/sgx.c | 2 +-
stubs/monitor-i386-sgx.c | 17 +++++++++
stubs/meson.build | 1 +
6 files changed, 97 insertions(+), 81 deletions(-)
create mode 100644 stubs/monitor-i386-sgx.c
diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
index de0e4ab67ff..92751d5e180 100644
--- a/qapi/misc-i386.json
+++ b/qapi/misc-i386.json
@@ -293,3 +293,80 @@
{ 'command': 'query-sev-attestation-report',
'data': { 'mnonce': 'str' },
'returns': 'SevAttestationReport' }
+
+##
+# @SgxEpcSection:
+#
+# Information about intel SGX EPC section
+#
+# @node: the numa node
+#
+# @size: the size of EPC section
+#
+# Since: 7.0
+##
+{ 'struct': 'SgxEpcSection',
+ 'data': { 'node': 'int',
+ 'size': 'uint64'}}
+
+##
+# @SgxInfo:
+#
+# Information about intel Safe Guard eXtension (SGX) support
+#
+# @sgx: true if SGX is supported
+#
+# @sgx1: true if SGX1 is supported
+#
+# @sgx2: true if SGX2 is supported
+#
+# @flc: true if FLC is supported
+#
+# @sections: The EPC sections information (Since: 7.0)
+#
+# Since: 6.2
+##
+{ 'struct': 'SgxInfo',
+ 'data': { 'sgx': 'bool',
+ 'sgx1': 'bool',
+ 'sgx2': 'bool',
+ 'flc': 'bool',
+ 'sections': ['SgxEpcSection']} }
+
+##
+# @query-sgx:
+#
+# Returns information about configured SGX capabilities of guest
+#
+# Returns: @SgxInfo
+#
+# Since: 6.2
+#
+# .. qmp-example::
+#
+# -> { "execute": "query-sgx" }
+# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
+# "flc": true,
+# "sections": [{"node": 0, "size": 67108864},
+# {"node": 1, "size": 29360128}]} }
+##
+{ 'command': 'query-sgx', 'returns': 'SgxInfo' }
+
+##
+# @query-sgx-capabilities:
+#
+# Returns information about SGX capabilities of host
+#
+# Returns: @SgxInfo
+#
+# Since: 6.2
+#
+# .. qmp-example::
+#
+# -> { "execute": "query-sgx-capabilities" }
+# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
+# "flc": true,
+# "section" : [{"node": 0, "size": 67108864},
+# {"node": 1, "size": 29360128}]} }
+##
+{ 'command': 'query-sgx-capabilities', 'returns': 'SgxInfo' }
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index cc472ce91cb..d62db37d7cf 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -2,85 +2,6 @@
# vim: filetype=python
#
-##
-# @SgxEpcSection:
-#
-# Information about intel SGX EPC section
-#
-# @node: the numa node
-#
-# @size: the size of EPC section
-#
-# Since: 7.0
-##
-{ 'struct': 'SgxEpcSection',
- 'data': { 'node': 'int',
- 'size': 'uint64'}}
-
-##
-# @SgxInfo:
-#
-# Information about intel Safe Guard eXtension (SGX) support
-#
-# @sgx: true if SGX is supported
-#
-# @sgx1: true if SGX1 is supported
-#
-# @sgx2: true if SGX2 is supported
-#
-# @flc: true if FLC is supported
-#
-# @sections: The EPC sections information (Since: 7.0)
-#
-# Since: 6.2
-##
-{ 'struct': 'SgxInfo',
- 'data': { 'sgx': 'bool',
- 'sgx1': 'bool',
- 'sgx2': 'bool',
- 'flc': 'bool',
- 'sections': ['SgxEpcSection']},
- 'if': 'TARGET_I386' }
-
-##
-# @query-sgx:
-#
-# Returns information about configured SGX capabilities of guest
-#
-# Returns: @SgxInfo
-#
-# Since: 6.2
-#
-# .. qmp-example::
-#
-# -> { "execute": "query-sgx" }
-# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
-# "flc": true,
-# "sections": [{"node": 0, "size": 67108864},
-# {"node": 1, "size": 29360128}]} }
-##
-{ 'command': 'query-sgx', 'returns': 'SgxInfo', 'if': 'TARGET_I386' }
-
-##
-# @query-sgx-capabilities:
-#
-# Returns information about SGX capabilities of host
-#
-# Returns: @SgxInfo
-#
-# Since: 6.2
-#
-# .. qmp-example::
-#
-# -> { "execute": "query-sgx-capabilities" }
-# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
-# "flc": true,
-# "section" : [{"node": 0, "size": 67108864},
-# {"node": 1, "size": 29360128}]} }
-##
-{ 'command': 'query-sgx-capabilities', 'returns': 'SgxInfo', 'if': 'TARGET_I386' }
-
-
##
# @EvtchnPortType:
#
diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c
index ccb21a975d7..d295e54d239 100644
--- a/hw/i386/sgx-stub.c
+++ b/hw/i386/sgx-stub.c
@@ -3,8 +3,8 @@
#include "monitor/hmp-target.h"
#include "hw/i386/pc.h"
#include "hw/i386/sgx-epc.h"
+#include "qapi/qapi-commands-misc-i386.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-misc-target.h"
void sgx_epc_build_srat(GArray *table_data)
{
diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c
index c80203b438e..e2801546ad6 100644
--- a/hw/i386/sgx.c
+++ b/hw/i386/sgx.c
@@ -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"
diff --git a/stubs/monitor-i386-sgx.c b/stubs/monitor-i386-sgx.c
new file mode 100644
index 00000000000..00e081d52dd
--- /dev/null
+++ b/stubs/monitor-i386-sgx.c
@@ -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;
+}
diff --git a/stubs/meson.build b/stubs/meson.build
index 07e9d3799a5..f2eb4880181 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -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
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH v4 06/15] qapi: make Xen event commands unconditionally available
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (4 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 05/15] qapi: make SGX commands unconditionally available Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 07/15] qapi: remove the misc-target.json file Pierrick Bouvier
` (9 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd,
David Woodhouse
From: Daniel P. Berrangé <berrange@redhat.com>
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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-i386.json | 107 +++++++++++++++++++++++++++++++++++++
qapi/misc-target.json | 111 ---------------------------------------
hw/i386/kvm/xen-stubs.c | 13 -----
hw/i386/kvm/xen_evtchn.c | 2 +-
stubs/monitor-i386-xen.c | 16 ++++++
stubs/meson.build | 1 +
6 files changed, 125 insertions(+), 125 deletions(-)
create mode 100644 stubs/monitor-i386-xen.c
diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
index 92751d5e180..cbf85233eba 100644
--- a/qapi/misc-i386.json
+++ b/qapi/misc-i386.json
@@ -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' } }
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index d62db37d7cf..c9ea1ab23e7 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -1,114 +1,3 @@
# -*- Mode: Python -*-
# vim: filetype=python
#
-
-##
-# @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'],
- 'if': 'TARGET_I386' }
-
-##
-# @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' }
diff --git a/hw/i386/kvm/xen-stubs.c b/hw/i386/kvm/xen-stubs.c
index d03131e6864..ce73119ee7a 100644
--- a/hw/i386/kvm/xen-stubs.c
+++ b/hw/i386/kvm/xen-stubs.c
@@ -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
diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c
index b5190549a81..dd566c49679 100644
--- a/hw/i386/kvm/xen_evtchn.c
+++ b/hw/i386/kvm/xen_evtchn.c
@@ -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"
diff --git a/stubs/monitor-i386-xen.c b/stubs/monitor-i386-xen.c
new file mode 100644
index 00000000000..95b826f9795
--- /dev/null
+++ b/stubs/monitor-i386-xen.c
@@ -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");
+}
diff --git a/stubs/meson.build b/stubs/meson.build
index f2eb4880181..0ef11976a2f 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -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
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH v4 07/15] qapi: remove the misc-target.json file
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (5 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 06/15] qapi: make Xen event " Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 08/15] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic Pierrick Bouvier
` (8 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
From: Daniel P. Berrangé <berrange@redhat.com>
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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-target.json | 3 ---
qapi/qapi-schema.json | 1 -
hw/s390x/s390-skeys.c | 1 -
target/i386/monitor.c | 1 -
qapi/meson.build | 1 -
5 files changed, 7 deletions(-)
delete mode 100644 qapi/misc-target.json
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
deleted file mode 100644
index c9ea1ab23e7..00000000000
--- a/qapi/misc-target.json
+++ /dev/null
@@ -1,3 +0,0 @@
-# -*- Mode: Python -*-
-# vim: filetype=python
-#
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index e96bff8d38c..d8eb79cfda6 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -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' }
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index aedb62b2d31..8eeecfd58fc 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -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"
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 3ea92b066e1..3c9b6ca62f2 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -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 */
diff --git a/qapi/meson.build b/qapi/meson.build
index 5e93e6b8cfd..ffe44f9e0b8 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -42,7 +42,6 @@ qapi_all_modules = [
'machine-target',
'migration',
'misc',
- 'misc-target',
'net',
'pragma',
'qom',
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH v4 08/15] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (6 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 07/15] qapi: remove the misc-target.json file Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-27 11:32 ` Markus Armbruster
2025-05-22 19:05 ` [PATCH v4 09/15] qapi: make most CPU commands unconditionally available Pierrick Bouvier
` (7 subsequent siblings)
15 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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. This is not a compatibility break only because the field
remains present always on S390x.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/machine-target.json | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/qapi/machine-target.json b/qapi/machine-target.json
index 426ce4ee82d..d8dbda4b508 100644
--- a/qapi/machine-target.json
+++ b/qapi/machine-target.json
@@ -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' : ['str'] },
'if': { 'any': [ 'TARGET_S390X',
'TARGET_I386',
'TARGET_ARM',
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v4 08/15] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic
2025-05-22 19:05 ` [PATCH v4 08/15] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic Pierrick Bouvier
@ 2025-05-27 11:32 ` Markus Armbruster
2025-05-27 17:04 ` Pierrick Bouvier
0 siblings, 1 reply; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 11:32 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> 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. This is not a compatibility break only because the field
> remains present always on S390x.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/machine-target.json | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
> index 426ce4ee82d..d8dbda4b508 100644
> --- a/qapi/machine-target.json
> +++ b/qapi/machine-target.json
> @@ -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' : ['str'] },
> 'if': { 'any': [ 'TARGET_S390X',
> 'TARGET_I386',
> 'TARGET_ARM',
[Copied from review of prior posts]
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?
Daniel doubts it is.
[end of copy]
Let's take with this patch as is. If we prefer to remove the
difference, we can do so on top.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 08/15] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic
2025-05-27 11:32 ` Markus Armbruster
@ 2025-05-27 17:04 ` Pierrick Bouvier
0 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-27 17:04 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
On 5/27/25 4:32 AM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>>
>> 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. This is not a compatibility break only because the field
>> remains present always on S390x.
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> qapi/machine-target.json | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
>> index 426ce4ee82d..d8dbda4b508 100644
>> --- a/qapi/machine-target.json
>> +++ b/qapi/machine-target.json
>> @@ -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' : ['str'] },
>> 'if': { 'any': [ 'TARGET_S390X',
>> 'TARGET_I386',
>> 'TARGET_ARM',
>
> [Copied from review of prior posts]
>
> 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?
>
> Daniel doubts it is.
>
> [end of copy]
>
> Let's take with this patch as is. If we prefer to remove the
> difference, we can do so on top.
>
I didn't answer to this question because I have no opinion on it.
If I have to pick an answer, following Daniel, I doubt the difference is
useful also, as it's not changing anything for s390, which is the only
producer for this entry.
Thanks,
Pierrick
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v4 09/15] qapi: make most CPU commands unconditionally available
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (7 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 08/15] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-27 11:38 ` Markus Armbruster
2025-05-22 19:05 ` [PATCH v4 10/15] qapi: make s390x specific " Pierrick Bouvier
` (6 subsequent siblings)
15 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
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. Adjust the doc comments accordingly.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
MAINTAINERS | 1 -
qapi/machine-target.json | 397 --------------------------
qapi/machine.json | 363 +++++++++++++++++++++++
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 +-
stubs/meson.build | 2 +
14 files changed, 437 insertions(+), 406 deletions(-)
create mode 100644 stubs/monitor-cpu-s390x.c
create mode 100644 stubs/monitor-cpu.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 01684c5a3ff..9df6c818b28 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1938,7 +1938,6 @@ F: hw/core/numa.c
F: hw/cpu/cluster.c
F: qapi/machine.json
F: qapi/machine-common.json
-F: qapi/machine-target.json
F: include/hw/boards.h
F: include/hw/core/cpu.h
F: include/hw/cpu/cluster.h
diff --git a/qapi/machine-target.json b/qapi/machine-target.json
index d8dbda4b508..f19e34adaf9 100644
--- a/qapi/machine-target.json
+++ b/qapi/machine-target.json
@@ -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' : ['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 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:
#
diff --git a/qapi/machine.json b/qapi/machine.json
index c8feb9fe17b..e6b4b2dfef8 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -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
+# 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
+# - 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-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' : ['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 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'] }
diff --git a/stubs/monitor-cpu-s390x.c b/stubs/monitor-cpu-s390x.c
new file mode 100644
index 00000000000..71e794482b5
--- /dev/null
+++ b/stubs/monitor-cpu-s390x.c
@@ -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;
+}
diff --git a/stubs/monitor-cpu.c b/stubs/monitor-cpu.c
new file mode 100644
index 00000000000..a8c7ee89b9d
--- /dev/null
+++ b/stubs/monitor-cpu.c
@@ -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;
+}
diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c
index ef18c867ca4..cca6b9722b2 100644
--- a/target/arm/arm-qmp-cmds.c
+++ b/target/arm/arm-qmp-cmds.c
@@ -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"
diff --git a/target/i386/cpu-system.c b/target/i386/cpu-system.c
index 55f192e8193..b1494aa6740 100644
--- a/target/i386/cpu-system.c
+++ b/target/i386/cpu-system.c
@@ -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"
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 9689f6374e6..33afc3ec60e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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"
diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c
index 6f732d80f3f..f5f1cd0009d 100644
--- a/target/loongarch/loongarch-qmp-cmds.c
+++ b/target/loongarch/loongarch-qmp-cmds.c
@@ -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"
diff --git a/target/mips/system/mips-qmp-cmds.c b/target/mips/system/mips-qmp-cmds.c
index 7340ac70ba0..d98d6623f2f 100644
--- a/target/mips/system/mips-qmp-cmds.c
+++ b/target/mips/system/mips-qmp-cmds.c
@@ -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;
diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c
index a25d86a8d19..7022564604f 100644
--- a/target/ppc/ppc-qmp-cmds.c
+++ b/target/ppc/ppc-qmp-cmds.c
@@ -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;
diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c
index d0a324364dd..8ba8aa0d5f8 100644
--- a/target/riscv/riscv-qmp-cmds.c
+++ b/target/riscv/riscv-qmp-cmds.c
@@ -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"
diff --git a/target/s390x/cpu_models_system.c b/target/s390x/cpu_models_system.c
index 4351182f720..9d84faa3c9e 100644
--- a/target/s390x/cpu_models_system.c
+++ b/target/s390x/cpu_models_system.c
@@ -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);
diff --git a/stubs/meson.build b/stubs/meson.build
index 0ef11976a2f..3b2fad0824f 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -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
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v4 09/15] qapi: make most CPU commands unconditionally available
2025-05-22 19:05 ` [PATCH v4 09/15] qapi: make most CPU commands unconditionally available Pierrick Bouvier
@ 2025-05-27 11:38 ` Markus Armbruster
2025-05-27 16:56 ` Pierrick Bouvier
0 siblings, 1 reply; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 11:38 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
You took authorship from Daniel. Intentional?
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> 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. Adjust the doc comments accordingly.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 09/15] qapi: make most CPU commands unconditionally available
2025-05-27 11:38 ` Markus Armbruster
@ 2025-05-27 16:56 ` Pierrick Bouvier
2025-05-28 4:56 ` Markus Armbruster
0 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-27 16:56 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
On 5/27/25 4:38 AM, Markus Armbruster wrote:
> You took authorship from Daniel. Intentional?
>
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> 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. Adjust the doc comments accordingly.
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>
Not intentional. As said in v3, I did a mistake and squashed this
commit, so I re-extracted it during an interactive rebase, "stealing"
the authorship along the way. You're welcome to change that back under
Daniel's name.
Thanks,
Pierrick
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 09/15] qapi: make most CPU commands unconditionally available
2025-05-27 16:56 ` Pierrick Bouvier
@ 2025-05-28 4:56 ` Markus Armbruster
0 siblings, 0 replies; 38+ messages in thread
From: Markus Armbruster @ 2025-05-28 4:56 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> On 5/27/25 4:38 AM, Markus Armbruster wrote:
>> You took authorship from Daniel. Intentional?
>> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>>
>>> 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. Adjust the doc comments accordingly.
>>>
>>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>
>
> Not intentional. As said in v3, I did a mistake and squashed this commit, so I re-extracted it during an interactive rebase, "stealing" the authorship along the way. You're welcome to change that back under Daniel's name.
Will do, thanks!
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v4 10/15] qapi: make s390x specific CPU commands unconditionally available
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (8 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 09/15] qapi: make most CPU commands unconditionally available Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-26 6:07 ` Thomas Huth
2025-05-22 19:05 ` [PATCH v4 11/15] qapi: remove qapi_specific_outputs from meson.build Pierrick Bouvier
` (5 subsequent siblings)
15 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
From: Daniel P. Berrangé <berrange@redhat.com>
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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
...machine-target.json => machine-s390x.json} | 16 +++++---------
qapi/qapi-schema.json | 2 +-
include/hw/s390x/cpu-topology.h | 2 +-
hw/s390x/cpu-topology.c | 4 ++--
stubs/monitor-cpu-s390x-kvm.c | 22 +++++++++++++++++++
tests/qtest/qmp-cmd-test.c | 1 +
qapi/meson.build | 2 +-
stubs/meson.build | 1 +
8 files changed, 35 insertions(+), 15 deletions(-)
rename qapi/{machine-target.json => machine-s390x.json} (85%)
create mode 100644 stubs/monitor-cpu-s390x-kvm.c
diff --git a/qapi/machine-target.json b/qapi/machine-s390x.json
similarity index 85%
rename from qapi/machine-target.json
rename to qapi/machine-s390x.json
index f19e34adaf9..966dbd61d2e 100644
--- a/qapi/machine-target.json
+++ b/qapi/machine-s390x.json
@@ -1,6 +1,7 @@
# -*- Mode: Python -*-
# vim: filetype=python
#
+# SPDX-License-Identifier: GPL-2.0-or-later
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
@@ -15,8 +16,7 @@
# Since: 8.2
##
{ 'enum': 'S390CpuPolarization',
- 'data': [ 'horizontal', 'vertical' ],
- 'if': 'TARGET_S390X'
+ 'data': [ 'horizontal', 'vertical' ]
}
##
@@ -54,8 +54,7 @@
'*entitlement': 'S390CpuEntitlement',
'*dedicated': 'bool'
},
- 'features': [ 'unstable' ],
- 'if': { 'all': [ 'TARGET_S390X' , 'CONFIG_KVM' ] }
+ 'features': [ 'unstable' ]
}
##
@@ -90,8 +89,7 @@
##
{ 'event': 'CPU_POLARIZATION_CHANGE',
'data': { 'polarization': 'S390CpuPolarization' },
- 'features': [ 'unstable' ],
- 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+ 'features': [ 'unstable' ]
}
##
@@ -104,8 +102,7 @@
# Since: 8.2
##
{ 'struct': 'CpuPolarizationInfo',
- 'data': { 'polarization': 'S390CpuPolarization' },
- 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+ 'data': { 'polarization': 'S390CpuPolarization' }
}
##
@@ -120,6 +117,5 @@
# Since: 8.2
##
{ 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo',
- 'features': [ 'unstable' ],
- 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+ 'features': [ 'unstable' ]
}
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index d8eb79cfda6..a8f66163cb7 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -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' }
diff --git a/include/hw/s390x/cpu-topology.h b/include/hw/s390x/cpu-topology.h
index 9283c948e3a..d5e9aa43f8f 100644
--- a/include/hw/s390x/cpu-topology.h
+++ b/include/hw/s390x/cpu-topology.h
@@ -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
diff --git a/hw/s390x/cpu-topology.c b/hw/s390x/cpu-topology.c
index 7d4e1f54727..b513f8936e4 100644
--- a/hw/s390x/cpu-topology.c
+++ b/hw/s390x/cpu-topology.c
@@ -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.
diff --git a/stubs/monitor-cpu-s390x-kvm.c b/stubs/monitor-cpu-s390x-kvm.c
new file mode 100644
index 00000000000..8683dd2d4c6
--- /dev/null
+++ b/stubs/monitor-cpu-s390x-kvm.c
@@ -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;
+}
diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
index 15c88248b79..040d042810b 100644
--- a/tests/qtest/qmp-cmd-test.c
+++ b/tests/qtest/qmp-cmd-test.c
@@ -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 */
diff --git a/qapi/meson.build b/qapi/meson.build
index ffe44f9e0b8..e038b636c9d 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -39,7 +39,7 @@ qapi_all_modules = [
'job',
'machine-common',
'machine',
- 'machine-target',
+ 'machine-s390x',
'migration',
'misc',
'net',
diff --git a/stubs/meson.build b/stubs/meson.build
index 3b2fad0824f..cef046e6854 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -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
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v4 10/15] qapi: make s390x specific CPU commands unconditionally available
2025-05-22 19:05 ` [PATCH v4 10/15] qapi: make s390x specific " Pierrick Bouvier
@ 2025-05-26 6:07 ` Thomas Huth
0 siblings, 0 replies; 38+ messages in thread
From: Thomas Huth @ 2025-05-26 6:07 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: michael.roth, pbonzini, richard.henderson, armbru, peter.maydell,
berrange, philmd
On 22/05/2025 21.05, Pierrick Bouvier wrote:
> From: Daniel P. Berrangé <berrange@redhat.com>
>
> 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.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> ...machine-target.json => machine-s390x.json} | 16 +++++---------
> qapi/qapi-schema.json | 2 +-
> include/hw/s390x/cpu-topology.h | 2 +-
> hw/s390x/cpu-topology.c | 4 ++--
> stubs/monitor-cpu-s390x-kvm.c | 22 +++++++++++++++++++
> tests/qtest/qmp-cmd-test.c | 1 +
> qapi/meson.build | 2 +-
> stubs/meson.build | 1 +
> 8 files changed, 35 insertions(+), 15 deletions(-)
> rename qapi/{machine-target.json => machine-s390x.json} (85%)
> create mode 100644 stubs/monitor-cpu-s390x-kvm.c
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v4 11/15] qapi: remove qapi_specific_outputs from meson.build
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (9 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 10/15] qapi: make s390x specific " Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 12/15] qapi: make all generated files common Pierrick Bouvier
` (4 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
There is no more QAPI files that need to be compiled per target, so we
can remove this. qapi_specific_outputs is now empty, so we can remove
the associated logic in meson.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/meson.build | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/qapi/meson.build b/qapi/meson.build
index e038b636c9d..7582c2b5bcf 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -92,7 +92,6 @@ qapi_util_outputs = [
]
qapi_inputs = []
-qapi_specific_outputs = []
foreach module : qapi_all_modules
qapi_inputs += [ files(module + '.json') ]
qapi_module_outputs = [
@@ -110,15 +109,11 @@ foreach module : qapi_all_modules
'qapi-commands-@0@.trace-events'.format(module),
]
endif
- if module.endswith('-target')
- qapi_specific_outputs += qapi_module_outputs
- else
- qapi_util_outputs += qapi_module_outputs
- endif
+ qapi_util_outputs += qapi_module_outputs
endforeach
qapi_files = custom_target('shared QAPI source files',
- output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs,
+ output: qapi_util_outputs + qapi_nonmodule_outputs,
input: [ files('qapi-schema.json') ],
command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
depend_files: [ qapi_inputs, qapi_gen_depends ])
@@ -138,7 +133,7 @@ foreach output : qapi_util_outputs
i = i + 1
endforeach
-foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
+foreach output : qapi_nonmodule_outputs
if output.endswith('.h')
genh += qapi_files[i]
endif
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH v4 12/15] qapi: make all generated files common
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (10 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 11/15] qapi: remove qapi_specific_outputs from meson.build Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-22 19:05 ` [PATCH v4 13/15] qapi: use imperative style in documentation Pierrick Bouvier
` (3 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
Monolithic files (qapi_nonmodule_outputs) can now be compiled just
once, so we can remove qapi_util_outputs logic.
This removes the need for any specific_ss file.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/meson.build | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/qapi/meson.build b/qapi/meson.build
index 7582c2b5bcf..3b035aea339 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -85,8 +85,7 @@ qapi_nonmodule_outputs = [
'qapi-emit-events.c', 'qapi-emit-events.h',
]
-# First build all sources
-qapi_util_outputs = [
+qapi_outputs = qapi_nonmodule_outputs + [
'qapi-builtin-types.c', 'qapi-builtin-visit.c',
'qapi-builtin-types.h', 'qapi-builtin-visit.h',
]
@@ -109,20 +108,17 @@ foreach module : qapi_all_modules
'qapi-commands-@0@.trace-events'.format(module),
]
endif
- qapi_util_outputs += qapi_module_outputs
+ qapi_outputs += qapi_module_outputs
endforeach
qapi_files = custom_target('shared QAPI source files',
- output: qapi_util_outputs + qapi_nonmodule_outputs,
+ output: qapi_outputs,
input: [ files('qapi-schema.json') ],
command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
depend_files: [ qapi_inputs, qapi_gen_depends ])
-# Now go through all the outputs and add them to the right sourceset.
-# These loops must be synchronized with the output of the above custom target.
-
i = 0
-foreach output : qapi_util_outputs
+foreach output : qapi_outputs
if output.endswith('.h')
genh += qapi_files[i]
endif
@@ -132,14 +128,3 @@ foreach output : qapi_util_outputs
util_ss.add(qapi_files[i])
i = i + 1
endforeach
-
-foreach output : qapi_nonmodule_outputs
- if output.endswith('.h')
- genh += qapi_files[i]
- endif
- if output.endswith('.trace-events')
- qapi_trace_events += qapi_files[i]
- endif
- specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: qapi_files[i])
- i = i + 1
-endforeach
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH v4 13/15] qapi: use imperative style in documentation
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (11 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 12/15] qapi: make all generated files common Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-27 11:12 ` Markus Armbruster
2025-05-22 19:05 ` [PATCH v4 14/15] qapi/misc-i386: s/field will be set/field is set/ Pierrick Bouvier
` (2 subsequent siblings)
15 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
As requested by Markus:
> We prefer imperative mood "Return" over "Returns".
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/audio.json | 2 +-
qapi/char.json | 4 ++--
qapi/cryptodev.json | 2 +-
qapi/machine.json | 4 ++--
qapi/migration.json | 8 ++++----
qapi/misc-i386.json | 6 +++---
qapi/ui.json | 8 ++++----
7 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/qapi/audio.json b/qapi/audio.json
index dd5a58d13e6..826477c3072 100644
--- a/qapi/audio.json
+++ b/qapi/audio.json
@@ -533,7 +533,7 @@
##
# @query-audiodevs:
#
-# Returns information about audiodev configuration
+# Return information about audiodev configuration
#
# Returns: array of @Audiodev
#
diff --git a/qapi/char.json b/qapi/char.json
index dde2f9538f8..447c10b91a5 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -34,7 +34,7 @@
##
# @query-chardev:
#
-# Returns information about current character devices.
+# Return information about current character devices.
#
# Returns: a list of @ChardevInfo
#
@@ -80,7 +80,7 @@
##
# @query-chardev-backends:
#
-# Returns information about character device backends.
+# Return information about character device backends.
#
# Returns: a list of @ChardevBackendInfo
#
diff --git a/qapi/cryptodev.json b/qapi/cryptodev.json
index 04d0e21d209..28b97eb3da6 100644
--- a/qapi/cryptodev.json
+++ b/qapi/cryptodev.json
@@ -94,7 +94,7 @@
##
# @query-cryptodev:
#
-# Returns information about current crypto devices.
+# Return information about current crypto devices.
#
# Returns: a list of @QCryptodevInfo
#
diff --git a/qapi/machine.json b/qapi/machine.json
index e6b4b2dfef8..7f3af355b36 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -99,7 +99,7 @@
##
# @query-cpus-fast:
#
-# Returns information about all virtual CPUs.
+# Return information about all virtual CPUs.
#
# Returns: list of @CpuInfoFast
#
@@ -467,7 +467,7 @@
##
# @query-kvm:
#
-# Returns information about KVM acceleration
+# Return information about KVM acceleration
#
# Returns: @KvmInfo
#
diff --git a/qapi/migration.json b/qapi/migration.json
index 8b9c53595c4..1278450e09d 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -282,7 +282,7 @@
##
# @query-migrate:
#
-# Returns information about current migration process. If migration
+# Return information about current migration process. If migration
# is active there will be another json-object with RAM migration
# status.
#
@@ -535,7 +535,7 @@
##
# @query-migrate-capabilities:
#
-# Returns information about the current migration capabilities status
+# Return information about the current migration capabilities status
#
# Returns: @MigrationCapabilityStatus
#
@@ -1320,7 +1320,7 @@
##
# @query-migrate-parameters:
#
-# Returns information about the current migration parameters
+# Return information about the current migration parameters
#
# Returns: @MigrationParameters
#
@@ -2294,7 +2294,7 @@
##
# @query-vcpu-dirty-limit:
#
-# Returns information about virtual CPU dirty page rate limits, if
+# Return information about virtual CPU dirty page rate limits, if
# any.
#
# Since: 7.1
diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
index cbf85233eba..3fda7a20bdd 100644
--- a/qapi/misc-i386.json
+++ b/qapi/misc-i386.json
@@ -126,7 +126,7 @@
##
# @query-sev:
#
-# Returns information about SEV/SEV-ES/SEV-SNP.
+# Return 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
@@ -336,7 +336,7 @@
##
# @query-sgx:
#
-# Returns information about configured SGX capabilities of guest
+# Return information about configured SGX capabilities of guest
#
# Returns: @SgxInfo
#
@@ -355,7 +355,7 @@
##
# @query-sgx-capabilities:
#
-# Returns information about SGX capabilities of host
+# Return information about SGX capabilities of host
#
# Returns: @SgxInfo
#
diff --git a/qapi/ui.json b/qapi/ui.json
index c536d4e5241..59897fcb9f0 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -323,7 +323,7 @@
##
# @query-spice:
#
-# Returns information about the current SPICE server
+# Return information about the current SPICE server
#
# Returns: @SpiceInfo
#
@@ -654,7 +654,7 @@
##
# @query-vnc:
#
-# Returns information about the current VNC server
+# Return information about the current VNC server
#
# Returns: @VncInfo
#
@@ -820,7 +820,7 @@
##
# @query-mice:
#
-# Returns information about each active mouse device
+# Return information about each active mouse device
#
# Returns: a list of @MouseInfo for each device
#
@@ -1562,7 +1562,7 @@
##
# @query-display-options:
#
-# Returns information about display configuration
+# Return information about display configuration
#
# Returns: @DisplayOptions
#
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v4 13/15] qapi: use imperative style in documentation
2025-05-22 19:05 ` [PATCH v4 13/15] qapi: use imperative style in documentation Pierrick Bouvier
@ 2025-05-27 11:12 ` Markus Armbruster
2025-05-27 16:57 ` Pierrick Bouvier
0 siblings, 1 reply; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 11:12 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> As requested by Markus:
>> We prefer imperative mood "Return" over "Returns".
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
There are a few more:
/home/armbru/work/qemu/qapi/block.json:86:# Returns a list of information about each persistent reservation
/home/armbru/work/qemu/qapi/control.json:94:# Returns the current version of QEMU.
/home/armbru/work/qemu/qapi/dump.json:198:# Returns the available formats for dump-guest-memory
/home/armbru/work/qemu/qapi/machine.json:933:# Returns information for all memory backends.
/home/armbru/work/qemu/qapi/machine.json:1238:# Returns the hv-balloon driver data contained in the last received
/home/armbru/work/qemu/qapi/migration.json:2330:# Returns information of migration threads
/home/armbru/work/qemu/qapi/misc.json:104:# Returns a list of information about each iothread.
/home/armbru/work/qemu/qapi/ui.json:688:# Returns a list of vnc servers. The list can be empty.
/home/armbru/work/qemu/qapi/virtio.json:27:# Returns a list of all realized VirtIODevices
If you need to respin for some other reason, then it would be nice to
change these, too.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 13/15] qapi: use imperative style in documentation
2025-05-27 11:12 ` Markus Armbruster
@ 2025-05-27 16:57 ` Pierrick Bouvier
0 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-27 16:57 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
On 5/27/25 4:12 AM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> As requested by Markus:
>>> We prefer imperative mood "Return" over "Returns".
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>
> There are a few more:
>
> /home/armbru/work/qemu/qapi/block.json:86:# Returns a list of information about each persistent reservation
> /home/armbru/work/qemu/qapi/control.json:94:# Returns the current version of QEMU.
> /home/armbru/work/qemu/qapi/dump.json:198:# Returns the available formats for dump-guest-memory
> /home/armbru/work/qemu/qapi/machine.json:933:# Returns information for all memory backends.
> /home/armbru/work/qemu/qapi/machine.json:1238:# Returns the hv-balloon driver data contained in the last received
> /home/armbru/work/qemu/qapi/migration.json:2330:# Returns information of migration threads
> /home/armbru/work/qemu/qapi/misc.json:104:# Returns a list of information about each iothread.
> /home/armbru/work/qemu/qapi/ui.json:688:# Returns a list of vnc servers. The list can be empty.
> /home/armbru/work/qemu/qapi/virtio.json:27:# Returns a list of all realized VirtIODevices
>
> If you need to respin for some other reason, then it would be nice to
> change these, too.
>
No idea how I could missed them, sorry.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v4 14/15] qapi/misc-i386: s/field will be set/field is set/
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (12 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 13/15] qapi: use imperative style in documentation Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-27 11:17 ` Markus Armbruster
2025-05-22 19:05 ` [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section Pierrick Bouvier
2025-05-27 13:00 ` [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Markus Armbruster
15 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
As requested by Markus:
> I'd prefer "field is set".
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-i386.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
index 3fda7a20bdd..6f79817e382 100644
--- a/qapi/misc-i386.json
+++ b/qapi/misc-i386.json
@@ -129,7 +129,7 @@
# Return 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
+# returned @enabled field is set to 'false' and the
# state of all other fields is undefined.
#
# Returns: @SevInfo
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v4 14/15] qapi/misc-i386: s/field will be set/field is set/
2025-05-22 19:05 ` [PATCH v4 14/15] qapi/misc-i386: s/field will be set/field is set/ Pierrick Bouvier
@ 2025-05-27 11:17 ` Markus Armbruster
0 siblings, 0 replies; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 11:17 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
armbru, peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> As requested by Markus:
>> I'd prefer "field is set".
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/misc-i386.json | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
> index 3fda7a20bdd..6f79817e382 100644
> --- a/qapi/misc-i386.json
> +++ b/qapi/misc-i386.json
> @@ -129,7 +129,7 @@
> # Return 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
> +# returned @enabled field is set to 'false' and the
> # state of all other fields is undefined.
> #
> # Returns: @SevInfo
I'd squash this into PATCH 02. I figure you didn't because PATCH 02 is
Daniel's. Here's how I would record provenance when squashing:
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
[Doc comment tweaked]
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
If you want to blame me for the tweak (kidding, it's fine), you could
use [Doc comment tweaked at Markus's request].
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (13 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 14/15] qapi/misc-i386: s/field will be set/field is set/ Pierrick Bouvier
@ 2025-05-22 19:05 ` Pierrick Bouvier
2025-05-27 11:20 ` Markus Armbruster
2025-05-27 12:57 ` Markus Armbruster
2025-05-27 13:00 ` [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Markus Armbruster
15 siblings, 2 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 19:05 UTC (permalink / raw)
To: qemu-devel
Cc: michael.roth, thuth, pbonzini, richard.henderson, armbru,
pierrick.bouvier, peter.maydell, berrange, philmd
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-i386.json | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
index 6f79817e382..796eaa5f406 100644
--- a/qapi/misc-i386.json
+++ b/qapi/misc-i386.json
@@ -166,12 +166,13 @@
# 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
#
+# Errors:
+# - If the launch measurement is unavailable, either due to an
+# invalid guest configuration or if the guest has not reached
+# the required SEV state, GenericError
+#
# Since: 2.12
#
# .. qmp-example::
@@ -210,12 +211,15 @@
##
# @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.
+# Get SEV capabilities.
+#
+# This is only supported on AMD X86 platforms with KVM enabled.
#
# Returns: SevCapability objects.
#
+# Errors:
+# - If # SEV is not available on the platform, GenericError
+#
# Since: 2.12
#
# .. qmp-example::
@@ -234,11 +238,7 @@
#
# 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.
+# do not support launch secret injection.
#
# @packet-header: the launch secret packet header encoded in base64
#
@@ -246,6 +246,11 @@
#
# @gpa: the guest physical address where secret will be injected.
#
+# Errors:
+# - 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, GenericError
+#
# Since: 6.0
##
{ 'command': 'sev-inject-launch-secret',
@@ -273,15 +278,17 @@
# '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.
#
+# Errors:
+# - 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,
+# GenericError
+#
# Since: 6.1
#
# .. qmp-example::
--
2.47.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section
2025-05-22 19:05 ` [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section Pierrick Bouvier
@ 2025-05-27 11:20 ` Markus Armbruster
2025-05-27 16:58 ` Pierrick Bouvier
2025-05-27 12:57 ` Markus Armbruster
1 sibling, 1 reply; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 11:20 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
My comment on the previous patch applies.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section
2025-05-27 11:20 ` Markus Armbruster
@ 2025-05-27 16:58 ` Pierrick Bouvier
2025-05-28 4:59 ` Markus Armbruster
0 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-27 16:58 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
On 5/27/25 4:20 AM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>
> My comment on the previous patch applies.
>
I'm not sure to which comment exactly you refer to.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section
2025-05-27 16:58 ` Pierrick Bouvier
@ 2025-05-28 4:59 ` Markus Armbruster
2025-05-28 19:00 ` Pierrick Bouvier
0 siblings, 1 reply; 38+ messages in thread
From: Markus Armbruster @ 2025-05-28 4:59 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: Markus Armbruster, qemu-devel, michael.roth, thuth, pbonzini,
richard.henderson, peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> On 5/27/25 4:20 AM, Markus Armbruster wrote:
>> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>>
>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>
>> My comment on the previous patch applies.
>>
>
> I'm not sure to which comment exactly you refer to.
Should've been explicit :)
I'd squash this into PATCH 02. I figure you didn't because PATCH 02 is
Daniel's. Here's how I would record provenance when squashing:
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
[Error documentation tidied up]
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
If you want to record why, you could add "at Markus's request".
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section
2025-05-28 4:59 ` Markus Armbruster
@ 2025-05-28 19:00 ` Pierrick Bouvier
0 siblings, 0 replies; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-28 19:00 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
On 5/27/25 9:59 PM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> On 5/27/25 4:20 AM, Markus Armbruster wrote:
>>> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>>>
>>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>>
>>> My comment on the previous patch applies.
>>>
>>
>> I'm not sure to which comment exactly you refer to.
>
> Should've been explicit :)
>
> I'd squash this into PATCH 02. I figure you didn't because PATCH 02 is
> Daniel's. Here's how I would record provenance when squashing:
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> [Error documentation tidied up]
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>
> If you want to record why, you could add "at Markus's request".
>
I see better.
Feel free to squash it, I keep this splitted to avoid rebase self
conflicts, and to facilitate review.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section
2025-05-22 19:05 ` [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section Pierrick Bouvier
2025-05-27 11:20 ` Markus Armbruster
@ 2025-05-27 12:57 ` Markus Armbruster
1 sibling, 0 replies; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 12:57 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> qapi/misc-i386.json | 39 +++++++++++++++++++++++----------------
> 1 file changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/qapi/misc-i386.json b/qapi/misc-i386.json
> index 6f79817e382..796eaa5f406 100644
> --- a/qapi/misc-i386.json
> +++ b/qapi/misc-i386.json
> @@ -166,12 +166,13 @@
> # 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
> #
> +# Errors:
> +# - If the launch measurement is unavailable, either due to an
> +# invalid guest configuration or if the guest has not reached
> +# the required SEV state, GenericError
> +#
> # Since: 2.12
> #
> # .. qmp-example::
> @@ -210,12 +211,15 @@
> ##
> # @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.
> +# Get SEV capabilities.
> +#
> +# This is only supported on AMD X86 platforms with KVM enabled.
> #
> # Returns: SevCapability objects.
> #
> +# Errors:
> +# - If # SEV is not available on the platform, GenericError
Stray #
> +#
> # Since: 2.12
> #
> # .. qmp-example::
> @@ -234,11 +238,7 @@
> #
> # 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.
> +# do not support launch secret injection.
> #
> # @packet-header: the launch secret packet header encoded in base64
> #
> @@ -246,6 +246,11 @@
> #
> # @gpa: the guest physical address where secret will be injected.
> #
> +# Errors:
> +# - 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, GenericError
> +#
> # Since: 6.0
> ##
> { 'command': 'sev-inject-launch-secret',
> @@ -273,15 +278,17 @@
> # '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.
> #
> +# Errors:
> +# - This will return an error if the attestation report is
Scratch "This will return an error"
> +# unavailable, either due to an invalid guest configuration
> +# or if the guest has not reached the required SEV state,
> +# GenericError
> +#
> # Since: 6.1
> #
> # .. qmp-example::
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema
2025-05-22 19:05 [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Pierrick Bouvier
` (14 preceding siblings ...)
2025-05-22 19:05 ` [PATCH v4 15/15] qapi/misc-i386: move errors to their own documentation section Pierrick Bouvier
@ 2025-05-27 13:00 ` Markus Armbruster
2025-05-27 16:51 ` Pierrick Bouvier
15 siblings, 1 reply; 38+ messages in thread
From: Markus Armbruster @ 2025-05-27 13:00 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> This series exposes all qmp commands for any target unconditionally, allowing to
> compile QAPI generated code without any TARGET conditionals.
>
> Based on original RFC from Daniel P. Berrangé:
> https://lore.kernel.org/qemu-devel/20250508135816.673087-1-berrange@redhat.com/
I picked a few nits. I'm happy to address them in my tree without a
respin. If you object to any, please let me know.
Series:
Reviewed-by: Markus Armbruster <armbru@redhat.com>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema
2025-05-27 13:00 ` [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema Markus Armbruster
@ 2025-05-27 16:51 ` Pierrick Bouvier
2025-05-28 5:01 ` Markus Armbruster
0 siblings, 1 reply; 38+ messages in thread
From: Pierrick Bouvier @ 2025-05-27 16:51 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
On 5/27/25 6:00 AM, Markus Armbruster wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>
>> This series exposes all qmp commands for any target unconditionally, allowing to
>> compile QAPI generated code without any TARGET conditionals.
>>
>> Based on original RFC from Daniel P. Berrangé:
>> https://lore.kernel.org/qemu-devel/20250508135816.673087-1-berrange@redhat.com/
>
> I picked a few nits. I'm happy to address them in my tree without a
> respin. If you object to any, please let me know.
>
I'm ok if you want to take that in your tree, and address them directly.
All the comments change requested are ok for me.
I'll answer on individual commits for your questions.
If you expect a respin on my side, let me know (from what I understand,
it's not expected at this point).
Thanks,
Pierrick
> Series:
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v4 00/15] qapi: remove all TARGET_* conditionals from the schema
2025-05-27 16:51 ` Pierrick Bouvier
@ 2025-05-28 5:01 ` Markus Armbruster
0 siblings, 0 replies; 38+ messages in thread
From: Markus Armbruster @ 2025-05-28 5:01 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, michael.roth, thuth, pbonzini, richard.henderson,
peter.maydell, berrange, philmd
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> On 5/27/25 6:00 AM, Markus Armbruster wrote:
>> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
>>
>>> This series exposes all qmp commands for any target unconditionally, allowing to
>>> compile QAPI generated code without any TARGET conditionals.
>>>
>>> Based on original RFC from Daniel P. Berrangé:
>>> https://lore.kernel.org/qemu-devel/20250508135816.673087-1-berrange@redhat.com/
>> I picked a few nits. I'm happy to address them in my tree without a
>> respin. If you object to any, please let me know.
>>
>
> I'm ok if you want to take that in your tree, and address them directly.
> All the comments change requested are ok for me.
> I'll answer on individual commits for your questions.
>
> If you expect a respin on my side, let me know (from what I understand, it's not expected at this point).
Correct. Thanks!
[...]
^ permalink raw reply [flat|nested] 38+ messages in thread