On 8/7/21 8:42 AM, Markus Armbruster wrote:
Jonah Palmer <jonah.palmer@oracle.com> writes:

From: Laurent Vivier <lvivier@redhat.com>

This new command shows the status of a VirtIODevice
(features, endianness and number of virtqueues)

Next patch will improve output by decoding feature bits.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
[...]

diff --git a/qapi/virtio.json b/qapi/virtio.json
index 804adbe..4bd09c9 100644
--- a/qapi/virtio.json
+++ b/qapi/virtio.json
@@ -70,3 +70,79 @@
 ##
 
 { 'command': 'x-debug-query-virtio', 'returns': ['VirtioInfo'] }
+
+##
+# @VirtioStatusEndianness:
+#
+# Enumeration of endianness for VirtioDevice
+#
+# Since: 6.1
6.2 now, here, below, and in the remainder of this series.

+##
+{ 'enum': 'VirtioStatusEndianness',
+  'data': [ 'unknown', 'little', 'big' ]
+}
+
+##
+# @VirtioStatus:
+#
+# @device-id: VirtIODevice status
"status"?  Really?
I'll change it to 'VirtIODevice ID' instead

+#
+# @device-endian: VirtIODevice device_endian
+#
+# @guest-features: VirtIODevice guest_features
+#
+# @host-features: VirtIODevice host_features
+#
+# @backend-features: VirtIODevice backend_features
+#
+# @num-vqs: number of VirtIODevice queues
+#
+# Since: 6.1
+#
+##
+
+{ 'struct': 'VirtioStatus',
+  'data': {
+    'device-id': 'int',
VirtIODevice member @device_id is uint64_t.  Should this be 'uint16'?
Ah, yes this should be uint16. I'll update this.

+    'device-endian': 'VirtioStatusEndianness',
+    'guest-features': 'uint64',
+    'host-features': 'uint64',
+    'backend-features': 'uint64',
+    'num-vqs': 'uint16'
virtio_get_num_queues() returns int.  Sure 'uint16' is the right type?
Yes, you're right, it should be an 'int' instead. I'll also update this.

+  }
+}
+
+##
+# @x-debug-virtio-status:
+#
+# Return the status of virtio device
"of a virtio device"
Oops! Forgot the article, thank you.

+#
+# @path: QOBject path of the VirtIODevice
"QOM path", please.

+#
+# Returns: status of the VirtIODevice
+#
+# Since: 6.1
+#
+# Example:
+#
+# -> { "execute": "x-debug-virtio-status",
+#      "arguments": {
+#          "path": "/machine/peripheral-anon/device[3]/virtio-backend"
+#      }
+#   }
+# <- { "return": {
+#          "backend-features": 0,
+#          "guest-features": 5111807911,
+#          "num-vqs": 3,
+#          "host-features": 6337593319,
+#          "device-endian": "little",
+#          "device-id": 1
+#      }
+#    }
+#
+##
+
+{ 'command': 'x-debug-virtio-status',
+  'data': { 'path': 'str' },
+  'returns': 'VirtioStatus'
+}