Skip to contentSkip to conversation

QAPI patches for 2026-11-27

GIT PULL Applied Markus Armbruster 2 participants 6 messages Nov 27 – Nov 29

lore
Share & tools
lore
#1 lore raw

[PULL 4/4] qom: Really add 'confidential-guest-reset' feature

In reply to Markus Armbruster

Commit a9b328611143 added feature 'confidential-guest-reset' to SevCommonProperties and to TdxGuestProperties. The commit message states the intent as "control plane should be able to detect if the hypervisor supports x86 confidential guest resets."

Management applications ("control plane") would check whether the relevant argument type of QMP command object-add has the feature. The relevant types are SevGuestProperties, SevSnpGuestProperties, and TdxGuestProperties.

Only TdxGuestProperties has the feature. The other two have base type SevCommonProperties, but a type only inherits its base's members, and not its features or conditions.

Fix by moving the feature from SevCommonProperties to SevGuestProperties and SevSnpGuestProperties.

Fixes a9b328611143 ("qom: add 'confidential-guest-reset' property for x86 confidential vms")

Message-ID: <[email protected]>

---
 qapi/qom.json | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
qapi/qom.json +15 -9
index 32a59269361..b8237a94be0 100644
@@ -1004,11 +1004,6 @@
 #     only supported on SEV-ES and SEV-SNP guests
 #     (default: false) (since 11.1)
 #
-# Features:
-#
-# @confidential-guest-reset: If present, the hypervisor supports
-#     confidential guest resets (since 11.0).
-#
 # Since: 9.1
 ##
 { 'struct': 'SevCommonProperties',
@@ -1016,8 +1011,7 @@
             '*cbitpos': 'uint32',
             'reduced-phys-bits': 'uint32',
             '*kernel-hashes': 'bool',
-            '*debug-swap': 'bool' },
-  'features': ['confidential-guest-reset']}
+            '*debug-swap': 'bool' } }
 
 ##
 # @SevGuestProperties:
@@ -1042,6 +1036,11 @@
 #    that require it.  If set to 'off', QEMU will require
 #    KVM_SEV_INIT2 unconditionally.  (default: off) (since 9.1)
 #
+# Features:
+#
+# @confidential-guest-reset: If present, the hypervisor supports
+#     confidential guest resets (since 11.0).
+#
 # Since: 2.12
 ##
 { 'struct': 'SevGuestProperties',
@@ -1050,7 +1049,8 @@
             '*session-file': 'str',
             '*policy': 'uint32',
             '*handle': 'uint32',
-            '*legacy-vm-type': 'OnOffAuto' } }
+            '*legacy-vm-type': 'OnOffAuto' },
+  'features': [ 'confidential-guest-reset' ] }
 
 ##
 # @SevSnpGuestProperties:
@@ -1101,6 +1101,11 @@
 # @tsc-frequency: set secure TSC frequency.  Only valid if Secure TSC
 #     is enabled (default: zero) (since 11.1)
 #
+# Features:
+#
+# @confidential-guest-reset: If present, the hypervisor supports
+#     confidential guest resets (since 11.0).
+#
 # Since: 9.1
 ##
 { 'struct': 'SevSnpGuestProperties',
@@ -1114,7 +1119,8 @@
             '*host-data': 'str',
             '*vcek-disabled': 'bool',
             '*secure-tsc': 'bool',
-            '*tsc-frequency': 'uint32' } }
+            '*tsc-frequency': 'uint32' },
+  'features': [ 'confidential-guest-reset' ] }
 
 ##
 # @TdxGuestProperties:
Signature · 1 line
2.55.0
#2 lore raw

[PULL 2/4] python/qemu: Don't choke on unknown members in QMP replies

In reply to Markus Armbruster

The recent addition of @qapi-type to ObjectPropertyInfo and ObjectPropertyValue broke the corresponding classes in qemu/utils/qom_common. Reproducer:

    $ bld/run qom-list -s qmp-socket /chardevs
    Traceback (most recent call last):
      File "/work/armbru/qemu/bld/pyvenv/bin/qom-list", line 8, in <module>
        sys.exit(QOMList.entry_point())
                 ~~~~~~~~~~~~~~~~~~~^^
      File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 230, in entry_point
        return cls.command_runner(args)
               ~~~~~~~~~~~~~~~~~~^^^^^^
      File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 215, in command_runner
        return cmd.run()
               ~~~~~~~^^
      File "/work/armbru/qemu/python/qemu/utils/qom.py", line 179, in run
        rsp = self.qom_list(self.path)
      File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 192, in qom_list
        return [ObjectPropertyInfo.make(x) for x in rsp]
                ~~~~~~~~~~~~~~~~~~~~~~~^^^
      File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 52, in make
        assert value.keys() <= {'name', 'type', 'description', 'default-value'}
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError

This asserts "no members we don't know". There are two more like it.

Adding @qapi-type broke them.

docs/devel/qapi-code-gen.rst section "Compatibility considerations" stipulates that "clients are expected to ignore [members] they don't know."

Delete / relax these assertions.

Fixes 0eee31cf1085 ("qapi/qom: add qapi-type to qom-list, qom-list-properties, qom-list-get")
Fixes c750c02891a8 ("python/qmp: Add qom script rewrites")

Message-ID: <[email protected]>

---
 python/qemu/utils/qom_common.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
python/qemu/utils/qom_common.py +1 -3
index ab21a4d364a..e5bae1c7421 100644
@@ -49,7 +49,6 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyInfo':
         Build an ObjectPropertyInfo from a Dict with an unknown shape.
         """
         assert value.keys() >= {'name', 'type'}
-        assert value.keys() <= {'name', 'type', 'description', 'default-value'}
         return cls(value['name'], value['type'],
                    value.get('description'),
                    value.get('default-value'))
@@ -80,7 +79,6 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyValue':
         Build an ObjectPropertyValue from a Dict with an unknown shape.
         """
         assert value.keys() >= {'name', 'type'}
-        assert value.keys() <= {'name', 'type', 'value'}
         return cls(value['name'], value['type'], value.get('value'))
 
     @property
@@ -103,7 +101,7 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertiesValues':
         """
         Build an ObjectPropertiesValues from a Dict with an unknown shape.
         """
-        assert value.keys() == {'properties'}
+        assert value.keys() <= {'properties'}
         props = [ObjectPropertyValue(item['name'],
                                      item['type'],
                                      item.get('value'))
Signature · 1 line
2.55.0
#0 lore raw

The following changes since commit 9751c62358073580cbf330a4df22077a7c6a407c:

Update version for v11.2.0-rc2 release (2026-11-25 21:39:27 -0800)

are available in the Git repository at:

https://repo.or.cz/qemu/armbru.git tags/pull-qapi-2026-11-27

for you to fetch changes up to e71c246816ebb43a0994b472155d99e0bd472927:

qom: Really add 'confidential-guest-reset' feature (2026-11-27 09:03:00 +0100)

----------------------------------------------------------------
QAPI patches for 2026-11-27

----------------------------------------------------------------
Markus Armbruster (4):
tests/qmp-cmd-test: Simplify @qapi-type test python/qemu: Don't choke on unknown members in QMP replies
file-posix: Fix loss of QAPI feature 'dynamic-auto-read-only'
qom: Really add 'confidential-guest-reset' feature

 qapi/block-core.json            | 14 +++++++++++++-
 qapi/qom.json                   | 24 +++++++++++++++---------
 tests/qtest/qmp-cmd-test.c      |  3 +--
 python/qemu/utils/qom_common.py |  4 +---
 4 files changed, 30 insertions(+), 15 deletions(-)

Markus Armbruster (4):
tests/qmp-cmd-test: Simplify @qapi-type test python/qemu: Don't choke on unknown members in QMP replies
file-posix: Fix loss of QAPI feature 'dynamic-auto-read-only'
qom: Really add 'confidential-guest-reset' feature

 qapi/block-core.json            | 14 +++++++++++++-
 qapi/qom.json                   | 24 +++++++++++++++---------
 tests/qtest/qmp-cmd-test.c      |  3 +--
 python/qemu/utils/qom_common.py |  4 +---
 4 files changed, 30 insertions(+), 15 deletions(-)
Signature · 1 line
2.55.0
#3 lore raw

[PULL 1/4] tests/qmp-cmd-test: Simplify @qapi-type test

test_qapi_type() checks that if @qapi-type is present, it resolves in output of query-qmp-schema. Absent @qapi-type is reported with g_test_message except for child and link properties.

The exception became useless when we implemented @qapi-type for child and link properties. Drop it.

Fixes 6955264d5821 ("qom: Convert child and link properties to QAPI-aware registration")

Message-ID: <[email protected]>

---
 tests/qtest/qmp-cmd-test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/qtest/qmp-cmd-test.c +1 -2
index acb7b0dd6a9..5138582bb3f 100644
@@ -384,8 +384,7 @@ static void test_qapi_type(void)
 
             if (qapi_type) {
                 g_assert_nonnull(qmp_schema_lookup(&schema, qapi_type));
-            } else if (!g_str_has_prefix(ty, "child<") &&
-                       !g_str_has_prefix(ty, "link<")) {
+            } else {
                 g_test_message("%s.%s %s has no associated qapi-type",
                                name, propname, ty);
             }
Signature · 1 line
2.55.0
#4 lore raw

[PULL 3/4] file-posix: Fix loss of QAPI feature 'dynamic-auto-read-only'

In reply to Markus Armbruster

Recent commit 691094b7091b added a variant member to BlockdevOptions branch 'host-device' by changing the branch type to new struct type BlockdevOptionsHostDevice that has the old branch type BlockdevOptionsFile as base. This is a perfectly reasonable thing to do. However, since a type only inherits its base's members, and not its features or conditions, this lost BlockdevOptionsFile's feature 'dynamic-auto-read-only'.

Considering we are in deep freeze, fix the regression the stupidest and safest way possible: copy the feature from BlockdevOptionsFile to BlockdevOptionsHostDevice.

Fixes 691094b7091b ("file-posix: Add 'accept-read-only-device' option")

Message-ID: <[email protected]>

---
 qapi/block-core.json | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
qapi/block-core.json +13 -1
index 23c5787d99b..7aa4fa2df93 100644
@@ -3403,11 +3403,23 @@
 #     writable.  If it is true, this check is skipped.  (since: 11.2,
 #     default: false)
 #
+# Features:
+#
+# @dynamic-auto-read-only: If present, enabled auto-read-only means
+#     that the driver will open the image read-only at first,
+#     dynamically reopen the image file read-write when the first
+#     writer is attached to the node and reopen read-only when the
+#     last writer is detached.  This allows giving QEMU write
+#     permissions only on demand when an operation actually needs
+#     write access.
+#
 # Since: 11.2
 ##
 { 'struct': 'BlockdevOptionsHostDevice',
   'base': 'BlockdevOptionsFile',
-  'data': { '*accept-read-only-device': 'bool' } }
+  'data': { '*accept-read-only-device': 'bool' },
+  'features': [ { 'name': 'dynamic-auto-read-only',
+                  'if': 'CONFIG_POSIX' } ] }
 
 ##
 # @BlockdevOptionsNull:
Signature · 1 line
2.55.0
#5 lore raw
In reply to Markus Armbruster
Quoted 6 lines · Markus Armbruster

The following changes since commit 9751c62358073580cbf330a4df22077a7c6a407c:

   Update version for v11.2.0-rc2 release (2026-11-25 21:39:27 -0800)

are available in the Git repository at:

Quoted 8 lines
   https://repo.or.cz/qemu/armbru.git tags/pull-qapi-2026-11-27

for you to fetch changes up to e71c246816ebb43a0994b472155d99e0bd472927:

   qom: Really add 'confidential-guest-reset' feature (2026-11-27 09:03:00 +0100)

----------------------------------------------------------------
QAPI patches for 2026-11-27

Applied, thanks.

r~