On 3/24/21 2:31 PM, Dr. David Alan Gilbert wrote: > * Jonah Palmer (jonah.palmer@oracle.com) wrote: >> From: Laurent Vivier >> > > >> --- /dev/null >> +++ b/qapi/virtio.json >> @@ -0,0 +1,68 @@ >> +## >> +# = Virtio devices >> +## >> + >> +## >> +# @VirtioType: >> +# >> +# An enumeration of Virtio device types. >> +# >> +# Since: 6.0 >> +## >> +{ 'enum': 'VirtioType', >> + 'data': [ 'unknown', 'virtio-9p', 'virtio-blk', 'virtio-serial', >> + 'virtio-gpu', 'virtio-input', 'virtio-net', 'virtio-scsi', >> + 'vhost-user-fs', 'vhost-vsock', 'virtio-balloon', 'virtio-crypto', >> + 'virtio-iommu', 'virtio-pmem', 'virtio-rng' ] > Can we make this be a complete list that's in the same order as include/standard-headers/linux/virtio_ids.h > then if we add a few asserts somewhere to make sure we don't screwup, we > don't need to do any translation. > > Dave Hi Dave. Just so I understand correctly, you would like me to add all of the entries in the given order? E.g. including 'virtio-rpmsg', ..., 'virtio-mac80211-wlan', etc.? Or just the supported virtio types in the order as it's shown in virtio_ids.h? Many of these devices may not be supported for introspection. Jonah > >> +} >> + >> +## >> +# @VirtioInfo: >> +# >> +# Information about a given VirtIODevice >> +# >> +# @path: VirtIO device canonical path. >> +# >> +# @type: VirtIO device type. >> +# >> +# Since: 6.0 >> +# >> +## >> +{ 'struct': 'VirtioInfo', >> + 'data': { >> + 'path': 'str', >> + 'type': 'VirtioType' >> + } >> +} >> + >> +## >> +# @x-debug-query-virtio: >> +# >> +# Return the list of all VirtIO devices >> +# >> +# Returns: list of @VirtioInfo >> +# >> +# Since: 6.0 >> +# >> +# Example: >> +# >> +# -> { "execute": "x-debug-query-virtio" } >> +# <- { "return": [ >> +# { >> +# "path": "/machine/peripheral-anon/device[3]/virtio-backend", >> +# "type": "virtio-net" >> +# }, >> +# { >> +# "path": "/machine/peripheral-anon/device[1]/virtio-backend", >> +# "type": "virtio-serial" >> +# }, >> +# { >> +# "path": "/machine/peripheral-anon/device[0]/virtio-backend", >> +# "type": "virtio-blk" >> +# } >> +# ] >> +# } >> +# >> +## >> + >> +{ 'command': 'x-debug-query-virtio', 'returns': ['VirtioInfo'] } >> diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c >> index 1c7186e..8f0ae20 100644 >> --- a/tests/qtest/qmp-cmd-test.c >> +++ b/tests/qtest/qmp-cmd-test.c >> @@ -95,6 +95,7 @@ static bool query_is_ignored(const char *cmd) >> "query-gic-capabilities", /* arm */ >> /* Success depends on target-specific build configuration: */ >> "query-pci", /* CONFIG_PCI */ >> + "x-debug-query-virtio", /* CONFIG_VIRTIO */ >> /* Success depends on launching SEV guest */ >> "query-sev-launch-measure", >> /* Success depends on Host or Hypervisor SEV support */ >> -- >> 1.8.3.1 >>