Re: [PATCH v15 0/6] hmp,qmp: Add commands to introspect virtio devices

2022-09-27 Thread Jonah Palmer
Hey Michael, when you get the chance, could you review these patches for me? 
Specifically patch 3/6, as that has the majority of the changes made for this 
series. Thanks!

Jonah

From: Jonah Palmer
Sent: Thursday, August 11, 2022 8:26 AM
To: qemu-de...@nongnu.org 
Cc: m...@redhat.com ; qemu_...@crudebyte.com 
; kra...@redhat.com ; Si-Wei Liu 
; Joao Martins ; 
ebl...@redhat.com ; qemu-block@nongnu.org 
; da...@redhat.com ; arm...@redhat.com 
; arei.gong...@huawei.com ; 
marcandre.lur...@redhat.com ; lviv...@redhat.com 
; th...@redhat.com ; michael.r...@amd.com 
; gr...@kaod.org ; dgilb...@redhat.com 
; eric.au...@redhat.com ; 
stefa...@redhat.com ; Boris Ostrovsky 
; kw...@redhat.com ; 
mathieu.poir...@linaro.org ; 
raphael.norw...@nutanix.com ; pbonz...@redhat.com 

Subject: [PATCH v15 0/6] hmp,qmp: Add commands to introspect virtio devices

This series introduces new QMP/HMP commands to dump the status of a
virtio device at different levels.

[Jonah: Rebasing from previous patchset from Apr. 1 (v14). Original patches
 are by Laurent Vivier from May 2020.

 I sincerely apologize for the *massive* delay in getting this latest v15
 series out. It was a perferct storm of other more pressing issues, time off,
 and trying to understand why I was seeing this 30 feature bit in my PCI virtio
 devices. Please see patch 3/6 for more explanation on this issue.

 Rebase from v14 to v15 includes: adding the missing sign-off-by from the 
poster,
 renaming & moving all virtio device feature map definitions to 
hw/virtio/virtio.c,
 including brief descriptions for all status & feature bits, a new virtio device
 feature map defined for virtio-rng, and mappings for virtio/vhost-vsock,
 virtio-iommu, virtio-mem, and virtio transport features updated with their
 newest feature bits. Most of these changes can be found in patch 3/6.

 And again, sorry for the long wait on this.]


1. List available virtio devices in the machine

HMP Form:

info virtio

Example:

(qemu) info virtio
/machine/peripheral-anon/device[2]/virtio-backend [virtio-scsi]
/machine/peripheral/vsock0/virtio-backend [vhost-vsock]
/machine/peripheral/crypto0/virtio-backend [virtio-crypto]
/machine/peripheral-anon/device[1]/virtio-backend [virtio-net]
/machine/peripheral-anon/device[0]/virtio-backend [virtio-serial]

QMP Form:

{ 'command': 'x-query-virtio',
  'returns': ['VirtioInfo'],
  'features': [ 'unstable' ] }

Example:

-> { "execute": "x-query-virtio" }
<- { "return": [
 {
 "name": "virtio-scsi",
 "path": "/machine/peripheral-anon/device[2]/virtio-backend"
 },
 {
 "name": "vhost-vsock",
 "path": "/machine/peripheral/vsock0/virtio-backend"
 },
 {
 "name": "virtio-crypto",
 "path": "/machine/peripheral/crypto0/virtio-backend"
 },
 {
 "name": "virtio-net",
 "path": "/machine/peripheral-anon/device[1]/virtio-backend"
 },
 {
 "name": "virtio-serial",
 "path": "/machine/peripheral-anon/device[0]/virtio-backend"
 }
 ]
   }

2. Display status of a given virtio device

HMP Form:

info virtio-status 

Example:

(qemu) info virtio-status /machine/peripheral/vsock0/virtio-backend
/machine/peripheral/vsock0/virtio-backend:
  device_name: vhost-vsock (vhost)
  device_id:   19
  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: 0
  endianness:  little
  status:
 VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found,
VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device,
VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete,
VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready
  Guest features:
VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled,
VIRTIO_RING_F_INDIRECT_DESC: Ind

[PATCH v15 0/6] hmp,qmp: Add commands to introspect virtio devices

2022-08-11 Thread Jonah Palmer
This series introduces new QMP/HMP commands to dump the status of a
virtio device at different levels.

[Jonah: Rebasing from previous patchset from Apr. 1 (v14). Original patches
 are by Laurent Vivier from May 2020.

 I sincerely apologize for the *massive* delay in getting this latest v15
 series out. It was a perferct storm of other more pressing issues, time off,
 and trying to understand why I was seeing this 30 feature bit in my PCI virtio
 devices. Please see patch 3/6 for more explanation on this issue.

 Rebase from v14 to v15 includes: adding the missing sign-off-by from the 
poster,
 renaming & moving all virtio device feature map definitions to 
hw/virtio/virtio.c,
 including brief descriptions for all status & feature bits, a new virtio device
 feature map defined for virtio-rng, and mappings for virtio/vhost-vsock,
 virtio-iommu, virtio-mem, and virtio transport features updated with their
 newest feature bits. Most of these changes can be found in patch 3/6.

 And again, sorry for the long wait on this.]


1. List available virtio devices in the machine

HMP Form:

info virtio

Example:

(qemu) info virtio
/machine/peripheral-anon/device[2]/virtio-backend [virtio-scsi]
/machine/peripheral/vsock0/virtio-backend [vhost-vsock]
/machine/peripheral/crypto0/virtio-backend [virtio-crypto]
/machine/peripheral-anon/device[1]/virtio-backend [virtio-net]
/machine/peripheral-anon/device[0]/virtio-backend [virtio-serial]

QMP Form:

{ 'command': 'x-query-virtio',
  'returns': ['VirtioInfo'],
  'features': [ 'unstable' ] }

Example:

-> { "execute": "x-query-virtio" }
<- { "return": [
 {
 "name": "virtio-scsi",
 "path": "/machine/peripheral-anon/device[2]/virtio-backend"
 },
 {
 "name": "vhost-vsock",
 "path": "/machine/peripheral/vsock0/virtio-backend"
 },
 {
 "name": "virtio-crypto",
 "path": "/machine/peripheral/crypto0/virtio-backend"
 },
 {
 "name": "virtio-net",
 "path": "/machine/peripheral-anon/device[1]/virtio-backend"
 },
 {
 "name": "virtio-serial",
 "path": "/machine/peripheral-anon/device[0]/virtio-backend"
 }
 ]
   }

2. Display status of a given virtio device

HMP Form:

info virtio-status 

Example:

(qemu) info virtio-status /machine/peripheral/vsock0/virtio-backend
/machine/peripheral/vsock0/virtio-backend:
  device_name: vhost-vsock (vhost)
  device_id:   19
  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: 0
  endianness:  little
  status:
VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found,
VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device,
VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete,
VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready
  Guest features:
VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled,
VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported,
VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)
  Host features:
VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled,
VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported,
VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy),
VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts,
VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. 
descs. on VQ
VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features 
negotiation supported
  Backend features:

  VHost:
  nvqs:   2
  vq_index:   0
  max_queues: 0
  n_mem_sections: 4
  n_tmp_sections: 4
  backend_cap:0
  log_enabled:false
  log_size:   0
  Features:
  VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled,
  VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported,