From: Laurent Vivier
This patch implements the HMP versions of the virtio QMP commands.
Signed-off-by: Jonah Palmer
---
hmp-commands-info.hx | 218 ++
include/monitor/hmp.h | 5 +
monitor/hmp-cmds.c| 358 ++
3 files changed, 581 insertions(+)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 407a1da..6bf7359 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -877,3 +877,221 @@ SRST
``info sgx``
Show intel SGX information.
ERST
+
+{
+.name = "virtio",
+.args_type = "",
+.params= "",
+.help = "List all available virtio devices",
+.cmd = hmp_virtio_query,
+.flags = "p",
+},
+
+SRST
+ ``info virtio``
+List all available virtio devices
+
+Example:
+
+List all available virtio devices in the machine::
+
+(qemu) info virtio
+/machine/peripheral/vsock0/virtio-backend [vhost-vsock]
+/machine/peripheral/crypto0/virtio-backend [virtio-crypto]
+/machine/peripheral-anon/device[2]/virtio-backend [virtio-scsi]
+/machine/peripheral-anon/device[1]/virtio-backend [virtio-net]
+/machine/peripheral-anon/device[0]/virtio-backend [virtio-serial]
+
+ERST
+
+{
+.name = "virtio-status",
+.args_type = "path:s",
+.params= "path",
+.help = "Display status of a given virtio device",
+.cmd = hmp_virtio_status,
+.flags = "p",
+},
+
+SRST
+ ``info virtio-status`` *path*
+Display status of a given virtio device
+
+Example:
+
+Dump the status of virtio-net (vhost on)::
+
+(qemu) info virtio-status /machine/peripheral-anon/device[1]/virtio-backend
+/machine/peripheral-anon/device[1]/virtio-backend:
+device_name: virtio-net (vhost)
+device_id: 1
+vhost_started: true
+bus_name:(null)
+broken: false
+disabled:false
+disable_legacy_check:false
+started: true
+use_started: true
+start_on_kick: false
+use_guest_notifier_mask: true
+vm_running: true
+num_vqs: 3
+queue_sel: 2
+isr: 1
+endianness: little
+status: acknowledge, driver, features-ok, driver-ok
+Guest features: event-idx, indirect-desc, version-1
+ ctrl-mac-addr, guest-announce, ctrl-vlan, ctrl-rx,
ctrl-vq, status, mrg-rxbuf,
+ host-ufo, host-ecn, host-tso6, host-tso4, guest-ufo,
guest-ecn, guest-tso6,
+ guest-tso4, mac, ctrl-guest-offloads, guest-csum,
csum
+Host features:protocol-features, event-idx, indirect-desc,
version-1, any-layout,
+ notify-on-empty, gso, ctrl-mac-addr, guest-announce,
ctrl-rx-extra, ctrl-vlan,
+ ctrl-rx, ctrl-vq, status, mrg-rxbuf, host-ufo,
host-ecn, host-tso6, host-tso4,
+ guest-ufo, guest-ecn, guest-tso6, guest-tso4, mac,
ctrl-guest-offloads,
+ guest-csum, csum
+Backend features: protocol-features, event-idx, indirect-desc,
version-1, any-layout,
+ notify-on-empty, gso, ctrl-mac-addr, guest-announce,
ctrl-rx-extra, ctrl-vlan,
+ ctrl-rx, ctrl-vq, status, mrg-rxbuf, host-ufo,
host-ecn, host-tso6, host-tso4,
+ guest-ufo, guest-ecn, guest-tso6, guest-tso4, mac,
ctrl-guest-offloads,
+ guest-csum, csum
+VHost:
+ nvqs: 2
+ vq_index: 0
+ max_queues: 1
+ n_mem_sections: 4
+ n_tmp_sections: 4
+ backend_cap:2
+ log_enabled:false
+ log_size: 0
+ Features: event-idx, indirect-desc, iommu-platform, version-1,
any-layout,
+ notify-on-empty, log-all, mrg-rxbuf
+Acked features: event-idx, indirect-desc, version-1, mrg-rxbuf
+Backend features:
+Protocol features:
+
+ERST
+
+{
+.name = "virtio-queue-status",
+.args_type = "path:s,queue:i",
+.params= "path queue",
+.help = "Display status of a given virtio queue",
+.cmd = hmp_virtio_queue_status,
+.flags = "p",
+},
+
+SRST
+ ``info virtio-queue-status`` *path* *queue*
+Display status of a given virtio queue
+
+Example:
+
+Dump the status of the 6th queue of virtio-scsi::
+
+(qemu) info virtio-queue-status
/machine/peripheral-anon/device[2]/virtio-backend 5
+/machine/peripheral-anon/device[2]/virtio-backend:
+device_name: virtio-scsi
+queue_index: