Adjust the output of x-query-virtio-status
v2 cover Adjust the output of x-query-virtio-status
v2:
- Changing the hmp_virtio_dump_xxx function signatures to implement the bitmap decoding, suggested by Philippe.
Please review, thanks,
Yong
This patchset is derived from the series:
https://lore.kernel.org/qemu-devel/[email protected]/
Please go to the link to see more background information.
The following points are what we have done in the patchset:
1. Take the policy of adding human-readable output just in HMP.
2. For the HMP output, display the human-readable information and drop the unknown bits in practice.
3. For the QMP output, remove the descriptive strings and only display bits encoded as numbers.
Hyman Huang (2):
qapi/virtio: Keep feature and status bits in the QMP output
hmp: Drop unknown feature and status bits
hw/virtio/virtio-hmp-cmds.c | 42 ++++---- hw/virtio/virtio-qmp.c | 23 ++--- qapi/virtio.json | 192 ++++-------------------------------- 3 files changed, 48 insertions(+), 209 deletions(-)
Signature · 1 line
2.39.1
PATCH v2 1/2 qapi/virtio: Keep feature and status bits in the QMP output
Maintain the feature and status bits in the x-query-virtio-status output and, as usual, add human-readable output only in HMP.
Applications may find it useful to compare features and status information directly. An upper application, for example, could use the QMP command x-query-virtio-status to retrieve vhost-user net device features and the "ovs-vsctl list interface" command to retrieve interface features (in number format) in order to verify the correctness of the virtio negotiation between guest, QEMU, and OVS-DPDK. The application could then compare the two features directly, without the need for additional feature encoding.
--- hw/virtio/virtio-hmp-cmds.c | 29 ++++-- hw/virtio/virtio-qmp.c | 23 ++--- qapi/virtio.json | 192 ++++-------------------------------- 3 files changed, 48 insertions(+), 196 deletions(-)
hw/virtio/virtio-hmp-cmds.c +20 -9
@@ -6,6 +6,7 @@*/ #include "qemu/osdep.h" +#include "virtio-qmp.h" #include "monitor/hmp.h" #include "monitor/monitor.h" #include "qapi/qapi-commands-virtio.h"
@@ -13,8 +14,10 @@static void hmp_virtio_dump_protocols (Monitor *mon, -VhostDeviceProtocols *pcol) +uint64_t bitmap) { +VhostDeviceProtocols *pcol =qmp_decode_protocols (bitmap); +strList *pcol_list = pcol->protocols;while (pcol_list) {monitor_printf (mon,"\t%s" , pcol_list->value);
@@ -31,8 +34,10 @@ static void hmp_virtio_dump_protocols(Monitor *mon, }static void hmp_virtio_dump_status (Monitor *mon, -VirtioDeviceStatus *status) +uint64_t bitmap) { +VirtioDeviceStatus *status =qmp_decode_status (bitmap); +strList *status_list = status->statuses;while (status_list) {monitor_printf (mon,"\t%s" , status_list->value);
@@ -49,8 +54,12 @@ static void hmp_virtio_dump_status(Monitor *mon, }static void hmp_virtio_dump_features (Monitor *mon, -VirtioDeviceFeatures *features) +uint16_t device_id, +uint64_t bitmap) { +VirtioDeviceFeatures *features = +qmp_decode_features (device_id, bitmap); +strList *transport_list = features->transports;while (transport_list) {monitor_printf (mon,"\t%s" , transport_list->value);
@@ -147,11 +156,11 @@ void hmp_virtio_status(Monitor *mon, const QDict *qdict)monitor_printf (mon," status:\n" );hmp_virtio_dump_status (mon, s->status);monitor_printf (mon," Guest features:\n" ); -hmp_virtio_dump_features (mon, s->guest_features); +hmp_virtio_dump_features (mon, s->device_id, s->guest_features);monitor_printf (mon," Host features:\n" ); -hmp_virtio_dump_features (mon, s->host_features); +hmp_virtio_dump_features (mon, s->device_id, s->host_features);monitor_printf (mon," Backend features:\n" ); -hmp_virtio_dump_features (mon, s->backend_features); +hmp_virtio_dump_features (mon, s->device_id, s->backend_features);if (s->vhost_dev) {monitor_printf (mon," VHost:\n" );
@@ -172,11 +181,13 @@ void hmp_virtio_status(Monitor *mon, const QDict *qdict)monitor_printf (mon," log_size: %" PRId64"\n" , s->vhost_dev->log_size);monitor_printf (mon," Features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->features); +hmp_virtio_dump_features (mon, s->device_id, s->vhost_dev->features);monitor_printf (mon," Acked features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->acked_features); +hmp_virtio_dump_features (mon, + s->device_id, s->vhost_dev->acked_features);monitor_printf (mon," Backend features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->backend_features); +hmp_virtio_dump_features (mon, + s->device_id, s->vhost_dev->backend_features);monitor_printf (mon," Protocol features:\n" );hmp_virtio_dump_protocols (mon, s->vhost_dev->protocol_features); }
hw/virtio/virtio-qmp.c +8 -15
@@ -733,12 +733,9 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) status->name =g_strdup (vdev->name); status->device_id = vdev->device_id; status->vhost_started = vdev->vhost_started; - status->guest_features =qmp_decode_features (vdev->device_id, - vdev->guest_features); - status->host_features =qmp_decode_features (vdev->device_id, - vdev->host_features); - status->backend_features =qmp_decode_features (vdev->device_id, - vdev->backend_features); + status->guest_features = vdev->guest_features; + status->host_features = vdev->host_features; + status->backend_features = vdev->backend_features;switch (vdev->device_endian) {case VIRTIO_DEVICE_ENDIAN_LITTLE :
@@ -753,7 +750,7 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) } status->num_vqs =virtio_get_num_queues (vdev); - status->status =qmp_decode_status (vdev->status); + status->status = vdev->status; status->isr = vdev->isr; status->queue_sel = vdev->queue_sel; status->vm_running = vdev->vm_running;
@@ -775,14 +772,10 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) status->vhost_dev->n_tmp_sections = hdev->n_tmp_sections; status->vhost_dev->nvqs = hdev->nvqs; status->vhost_dev->vq_index = hdev->vq_index; - status->vhost_dev->features = -qmp_decode_features (vdev->device_id, hdev->features); - status->vhost_dev->acked_features = -qmp_decode_features (vdev->device_id, hdev->acked_features); - status->vhost_dev->backend_features = -qmp_decode_features (vdev->device_id, hdev->backend_features); - status->vhost_dev->protocol_features = -qmp_decode_protocols (hdev->protocol_features); + status->vhost_dev->features = hdev->features; + status->vhost_dev->acked_features = hdev->acked_features; + status->vhost_dev->backend_features = hdev->backend_features; + status->vhost_dev->protocol_features = hdev->protocol_features; status->vhost_dev->max_queues = hdev->max_queues; status->vhost_dev->backend_cap = hdev->backend_cap; status->vhost_dev->log_enabled = hdev->log_enabled;
qapi/virtio.json +20 -172
229 lines not on this page · raw message
Signature · 1 line
2.39.1
Re: [PATCH v2 1/2] qapi/virtio: Keep feature and status bits in the QMP output
Quoted 12 lines · Hyman Huang
Maintain the feature and status bits in the x-query-virtio-status output and, as usual, add human-readable output only in HMP.
Applications may find it useful to compare features and status information directly. An upper application, for example, could use the QMP command x-query-virtio-status to retrieve vhost-user net device features and the "ovs-vsctl list interface" command to retrieve interface features (in number format) in order to verify the correctness of the virtio negotiation between guest, QEMU, and OVS-DPDK. The application could then compare the two features directly, without the need for additional feature encoding.
Quoted 1 line
Signed-off-by Hyman Huang <[email protected]>
A bit terse. Here's my try:
qmp: Switch x-query-virtio-status back to numeric encoding
x-query-virtio-status returns several sets of virtio feature and status flags. It goes back to v7.2.0.
In the initial commit 90c066cd682 (qmp: add QMP command x-query-virtio-status), we returned them as numbers, using virtio's well-known binary encoding.
The next commit f3034ad71fc (qmp: decode feature & status bits in virtio-status) replaced the numbers by objects. The objects represent bits QEMU knows symbolically, and any unknown bits numerically just like before.
Commit 8a8287981d1 (hmp: add virtio commands) the matching HMP command "info virtio" (and a few more, which aren't relevant here).
The symbolic representation uses lists of strings. The string format is undocumented. The strings look like "WELL_KNOWN_SYMBOL: human readable explanation".
This symbolic representation is nice for humans. Machines it can save the trouble of decoding virtio's well-known binary encoding.
However, we sometimes want to compare features and status bits without caring for their exact meaning. Say we want to verify the correctness of the virtio negotiation between guest, QEMU, and OVS-DPDK. We can use QMP command x-query-virtio-status to retrieve vhost-user net device features, and the "ovs-vsctl list interface" command to retrieve interface features. Without commit f3034ad71fc, we could then simply compare the numbers. With this commit, we first have to map from the strings back to the numeric encoding.
Revert the decoding for QMP, but keep it for HMP.
This makes the QMP command easier to use for use cases where we don't need to decode, like the comparison above. For use cases where we need to decode, we replace parsing undocumented strings by decoding virtio's well-known binary encoding.
Incompatible change; acceptable because x-query-virtio-status does comes without a stability promise.
Quoted 363 lines
--- hw/virtio/virtio-hmp-cmds.c | 29 ++++-- hw/virtio/virtio-qmp.c | 23 ++--- qapi/virtio.json | 192 ++++-------------------------------- 3 files changed, 48 insertions(+), 196 deletions(-)hw/virtio/virtio-hmp-cmds.c +20
-9@@ -6,6 +6,7 @@*/ #include "qemu/osdep.h" +#include "virtio-qmp.h" #include "monitor/hmp.h" #include "monitor/monitor.h" #include "qapi/qapi-commands-virtio.h" @@ -13,8 +14,10 @@static void hmp_virtio_dump_protocols (Monitor *mon, -VhostDeviceProtocols *pcol) +uint64_t bitmap) { +VhostDeviceProtocols *pcol =qmp_decode_protocols (bitmap); +strList *pcol_list = pcol->protocols;while (pcol_list) {monitor_printf (mon,"\t%s" , pcol_list->value);@@ -31,8 +34,10 @@ static void hmp_virtio_dump_protocols(Monitor *mon, }static void hmp_virtio_dump_status (Monitor *mon, -VirtioDeviceStatus *status) +uint64_t bitmap) { +VirtioDeviceStatus *status =qmp_decode_status (bitmap); +strList *status_list = status->statuses;while (status_list) {monitor_printf (mon,"\t%s" , status_list->value);@@ -49,8 +54,12 @@ static void hmp_virtio_dump_status(Monitor *mon, }static void hmp_virtio_dump_features (Monitor *mon, -VirtioDeviceFeatures *features) +uint16_t device_id, +uint64_t bitmap) { +VirtioDeviceFeatures *features = +qmp_decode_features (device_id, bitmap); +strList *transport_list = features->transports;while (transport_list) {monitor_printf (mon,"\t%s" , transport_list->value);@@ -147,11 +156,11 @@ void hmp_virtio_status(Monitor *mon, const QDict *qdict)monitor_printf (mon," status:\n" );hmp_virtio_dump_status (mon, s->status);monitor_printf (mon," Guest features:\n" ); -hmp_virtio_dump_features (mon, s->guest_features); +hmp_virtio_dump_features (mon, s->device_id, s->guest_features);monitor_printf (mon," Host features:\n" ); -hmp_virtio_dump_features (mon, s->host_features); +hmp_virtio_dump_features (mon, s->device_id, s->host_features);monitor_printf (mon," Backend features:\n" ); -hmp_virtio_dump_features (mon, s->backend_features); +hmp_virtio_dump_features (mon, s->device_id, s->backend_features);if (s->vhost_dev) {monitor_printf (mon," VHost:\n" );@@ -172,11 +181,13 @@ void hmp_virtio_status(Monitor *mon, const QDict *qdict)monitor_printf (mon," log_size: %" PRId64"\n" , s->vhost_dev->log_size);monitor_printf (mon," Features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->features); +hmp_virtio_dump_features (mon, s->device_id, s->vhost_dev->features);monitor_printf (mon," Acked features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->acked_features); +hmp_virtio_dump_features (mon, + s->device_id, s->vhost_dev->acked_features);monitor_printf (mon," Backend features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->backend_features); +hmp_virtio_dump_features (mon, + s->device_id, s->vhost_dev->backend_features);monitor_printf (mon," Protocol features:\n" );hmp_virtio_dump_protocols (mon, s->vhost_dev->protocol_features); }hw/virtio/virtio-qmp.c +8
-15@@ -733,12 +733,9 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) status->name =g_strdup (vdev->name); status->device_id = vdev->device_id; status->vhost_started = vdev->vhost_started; - status->guest_features =qmp_decode_features (vdev->device_id, - vdev->guest_features); - status->host_features =qmp_decode_features (vdev->device_id, - vdev->host_features); - status->backend_features =qmp_decode_features (vdev->device_id, - vdev->backend_features); + status->guest_features = vdev->guest_features; + status->host_features = vdev->host_features; + status->backend_features = vdev->backend_features;switch (vdev->device_endian) {case VIRTIO_DEVICE_ENDIAN_LITTLE :@@ -753,7 +750,7 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) } status->num_vqs =virtio_get_num_queues (vdev); - status->status =qmp_decode_status (vdev->status); + status->status = vdev->status; status->isr = vdev->isr; status->queue_sel = vdev->queue_sel; status->vm_running = vdev->vm_running;@@ -775,14 +772,10 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) status->vhost_dev->n_tmp_sections = hdev->n_tmp_sections; status->vhost_dev->nvqs = hdev->nvqs; status->vhost_dev->vq_index = hdev->vq_index; - status->vhost_dev->features = -qmp_decode_features (vdev->device_id, hdev->features); - status->vhost_dev->acked_features = -qmp_decode_features (vdev->device_id, hdev->acked_features); - status->vhost_dev->backend_features = -qmp_decode_features (vdev->device_id, hdev->backend_features); - status->vhost_dev->protocol_features = -qmp_decode_protocols (hdev->protocol_features); + status->vhost_dev->features = hdev->features; + status->vhost_dev->acked_features = hdev->acked_features; + status->vhost_dev->backend_features = hdev->backend_features; + status->vhost_dev->protocol_features = hdev->protocol_features; status->vhost_dev->max_queues = hdev->max_queues; status->vhost_dev->backend_cap = hdev->backend_cap; status->vhost_dev->log_enabled = hdev->log_enabled;qapi/virtio.json +18
-167@@ -102,10 +102,10 @@ 'n-tmp-sections': 'int', 'nvqs': 'uint32', 'vq-index': 'int', - 'features': 'VirtioDeviceFeatures', - 'acked-features': 'VirtioDeviceFeatures', - 'backend-features': 'VirtioDeviceFeatures', - 'protocol-features': 'VhostDeviceProtocols', + 'features': 'uint64', + 'acked-features': 'uint64', + 'backend-features': 'uint64', + 'protocol-features': 'uint64', 'max-queues': 'uint64', 'backend-cap': 'uint64', 'log-enabled': 'bool',@@ -170,11 +170,11 @@ 'device-id': 'uint16', 'vhost-started': 'bool', 'device-endian': 'str', - 'guest-features': 'VirtioDeviceFeatures', - 'host-features': 'VirtioDeviceFeatures', - 'backend-features': 'VirtioDeviceFeatures', + 'guest-features': 'uint64', + 'host-features': 'uint64', + 'backend-features': 'uint64', 'num-vqs': 'int', - 'status': 'VirtioDeviceStatus', + 'status': 'uint8', 'isr': 'uint8', 'queue-sel': 'uint16', 'vm-running': 'bool',@@ -217,41 +217,14 @@ # "name": "virtio-crypto", # "started": true, # "device-id": 20, -# "backend-features": { -# "transports": [], -# "dev-features": [] -# }, +# "backend-features": 0, # "start-on-kick": false, # "isr": 1, # "broken": false, -# "status": { -# "statuses": [ -# "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" -# ] -# }, +# "status": 15, # "num-vqs": 2, -# "guest-features": { -# "dev-features": [], -# "transports": [ -# "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": { -# "unknown-dev-features": 1073741824, -# "dev-features": [], -# "transports": [ -# "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" -# ] -# }, +# "guest-features": 5100273664, +# "host-features": 6325010432, # "use-guest-notifier-mask": true, # "vm-running": true, # "queue-sel": 1,@@ -279,147 +252,22 @@ # "max-queues": 1, # "backend-cap": 2, # "log-size": 0, -# "backend-features": { -# "dev-features": [], -# "transports": [] -# }, +# "backend-features": 0, # "nvqs": 2, -# "protocol-features": { -# "protocols": [] -# }, +# "protocol-features": 0, # "vq-index": 0, # "log-enabled": false, -# "acked-features": { -# "dev-features": [ -# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers" -# ], -# "transports": [ -# "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)" -# ] -# }, -# "features": { -# "dev-features": [ -# "VHOST_F_LOG_ALL: Logging write descriptors supported", -# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers" -# ], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled", -# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported", -# "VIRTIO_F_IOMMU_PLATFORM: Device can be used on IOMMU platform", -# "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" -# ] -# } -# }, -# "backend-features": { -# "dev-features": [ -# "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features negotiation supported", -# "VIRTIO_NET_F_GSO: Handling GSO-type packets supported", -# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel", -# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported", -# "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supported", -# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported", -# "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported", -# "VIRTIO_NET_F_CTRL_VQ: Control channel available", -# "VIRTIO_NET_F_STATUS: Configuration status field available", -# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers", -# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", -# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN", -# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", -# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", -# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", -# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN", -# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", -# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", -# "VIRTIO_NET_F_MAC: Device has given MAC address", -# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported", -# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported", -# "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported" -# ], -# "transports": [ -# "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" -# ] +# "acked-features": 5100306432, +# "features": 13908344832, # }, +# "backend-features": 6337593319, # "start-on-kick": false, # "isr": 1, # "broken": false, -# "status": { -# "statuses": [ -# "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" -# ] -# }, +# "status": 15, # "num-vqs": 3, -# "guest-features": { -# "dev-features": [ -# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel", -# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported", -# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported", -# "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported", -# "VIRTIO_NET_F_CTRL_VQ: Control channel available", -# "VIRTIO_NET_F_STATUS: Configuration status field available", -# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers", -# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", -# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN", -# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", -# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", -# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", -# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN", -# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", -# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", -# "VIRTIO_NET_F_MAC: Device has given MAC address", -# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported", -# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported", -# "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported" -# ], -# "transports": [ -# "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": { -# "dev-features": [ -# "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features negotiation supported", -# "VIRTIO_NET_F_GSO: Handling GSO-type packets supported", -# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel", -# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported", -# "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supported", -# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported", -# "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported", -# "VIRTIO_NET_F_CTRL_VQ: Control channel available", -# "VIRTIO_NET_F_STATUS: Configuration status field available", -# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers", -# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", -# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN", -# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", -# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", -# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", -# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN", -# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", -# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", -# "VIRTIO_NET_F_MAC: Device has given MAC address", -# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported", -# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported", -# "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported" -# ], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled", -# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
qapi/virtio.json line 273
Quoted 10 lines
qapi/virtio.json +2
-5-# "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" -# ] -# }, +# "guest-features": 5111807911, +# "host-features": 6337593319, # "use-guest-notifier-mask": true, # "vm-running": true, # "queue-sel": 2,
qmp_decode_protocols(), qmp_decode_status(), and qmp_decode_features() are now only used in virtio-hmp-cmds.c. Please move them there, and replace the qmp_ prefix by hmp_ or simply drop it.
VhostDeviceProtocols and VirtioDeviceFeatures are then only used in virtio-hmp-cmds.c. Please define them as plain C types there, and drop them from the QAPI schema.
You may want to do this as a separate cleanup commit. Use your judgement.
Re: [PATCH v2 1/2] qapi/virtio: Keep feature and status bits in the QMP output
Quoted 56 lines · Markus Armbruster
Quoted 12 lines · Hyman Huang
Maintain the feature and status bits in the x-query-virtio-status output and, as usual, add human-readable output only in HMP.
Applications may find it useful to compare features and status information directly. An upper application, for example, could use the QMP command x-query-virtio-status to retrieve vhost-user net device features and the "ovs-vsctl list interface" command to retrieve interface features (in number format) in order to verify the correctness of the virtio negotiation between guest, QEMU, and OVS-DPDK. The application could then compare the two features directly, without the need for additional feature encoding.
Quoted 1 line
Signed-off-by Hyman Huang <[email protected]>A bit terse. Here's my try:
qmp: Switch x-query-virtio-status back to numeric encoding
x-query-virtio-status returns several sets of virtio feature and status flags. It goes back to v7.2.0.
In the initial commit
90c066cd682(qmp: add QMP command x-query-virtio-status), we returned them as numbers, using virtio's well-known binary encoding.The next commit
f3034ad71fc(qmp: decode feature & status bits in virtio-status) replaced the numbers by objects. The objects represent bits QEMU knows symbolically, and any unknown bits numerically just
like
before.Commit
8a8287981d1(hmp: add virtio commands) the matching HMP command "info virtio" (and a few more, which aren't relevant here).The symbolic representation uses lists of strings. The string format
is
undocumented. The strings look like "WELL_KNOWN_SYMBOL: human readable explanation".This symbolic representation is nice for humans. Machines it can save the trouble of decoding virtio's well-known binary encoding.
However, we sometimes want to compare features and status bits without caring for their exact meaning. Say we want to verify the correctness of the virtio negotiation between guest, QEMU, and OVS-DPDK. We can
use
QMP command x-query-virtio-status to retrieve vhost-user net device features, and the "ovs-vsctl list interface" command to retrieve interface features. Without commitf3034ad71fc, we could then simply compare the numbers. With this commit, we first have to map from the strings back to the numeric encoding.Revert the decoding for QMP, but keep it for HMP.
Quoted 8 lines
This makes the QMP command easier to use for use cases where we don't need to decode, like the comparison above. For use cases where we need to decode, we replace parsing undocumented strings by decoding virtio's well-known binary encoding.
Incompatible change; acceptable because x-query-virtio-status does comes without a stability promise.
Thanks for the refining, I'll post this commit message in the next version.
Quoted 465 lines
hw/virtio/virtio-hmp-cmds.c void hmp_virtio_status(Monitor *mon, const QDict
Quoted 58 lines
--- hw/virtio/virtio-hmp-cmds.c | 29 ++++-- hw/virtio/virtio-qmp.c | 23 ++--- qapi/virtio.json | 192 ++++-------------------------------- 3 files changed, 48 insertions(+), 196 deletions(-)hw/virtio/virtio-hmp-cmds.c +12
-3@@ -6,6 +6,7 @@*/ #include "qemu/osdep.h" +#include "virtio-qmp.h" #include "monitor/hmp.h" #include "monitor/monitor.h" #include "qapi/qapi-commands-virtio.h" @@ -13,8 +14,10 @@static void hmp_virtio_dump_protocols (Monitor *mon, -VhostDeviceProtocols *pcol) +uint64_t bitmap) { +VhostDeviceProtocols *pcol =qmp_decode_protocols (bitmap); +strList *pcol_list = pcol->protocols;while (pcol_list) {monitor_printf (mon,"\t%s" , pcol_list->value);@@ -31,8 +34,10 @@ static void hmp_virtio_dump_protocols(Monitor *mon, }static void hmp_virtio_dump_status (Monitor *mon, -VirtioDeviceStatus *status) +uint64_t bitmap) { +VirtioDeviceStatus *status =qmp_decode_status (bitmap); +strList *status_list = status->statuses;while (status_list) {monitor_printf (mon,"\t%s" , status_list->value);@@ -49,8 +54,12 @@ static void hmp_virtio_dump_status(Monitor *mon, }static void hmp_virtio_dump_features (Monitor *mon, -VirtioDeviceFeatures *features) +uint16_t device_id, +uint64_t bitmap) { +VirtioDeviceFeatures *features = +qmp_decode_features (device_id, bitmap); +strList *transport_list = features->transports;while (transport_list) {monitor_printf (mon,"\t%s" , transport_list->value);@@ -147,11 +156,11 @@ void hmp_virtio_status(Monitor *mon, const QDict*qdict)
hw/virtio/virtio-hmp-cmds.c void hmp_virtio_status(Monitor *mon, const QDict
Quoted 15 lines
hw/virtio/virtio-hmp-cmds.c +3
-3monitor_printf (mon," status:\n" );hmp_virtio_dump_status (mon, s->status);monitor_printf (mon," Guest features:\n" ); -hmp_virtio_dump_features (mon, s->guest_features); +hmp_virtio_dump_features (mon, s->device_id, s->guest_features);monitor_printf (mon," Host features:\n" ); -hmp_virtio_dump_features (mon, s->host_features); +hmp_virtio_dump_features (mon, s->device_id, s->host_features);monitor_printf (mon," Backend features:\n" ); -hmp_virtio_dump_features (mon, s->backend_features); +hmp_virtio_dump_features (mon, s->device_id, s->backend_features);if (s->vhost_dev) {monitor_printf (mon," VHost:\n" );@@ -172,11 +181,13 @@ void hmp_virtio_status(Monitor *mon, const QDict*qdict)
hw/virtio/virtio-hmp-cmds.c void hmp_virtio_status(Monitor *mon, const QDict *qdict)
Quoted 5 lines
hw/virtio/virtio-hmp-cmds.c +1
-1monitor_printf (mon," log_size: %" PRId64"\n" , s->vhost_dev->log_size);monitor_printf (mon," Features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->features); + hmp_virtio_dump_features(mon, s->device_id,
s->vhost_dev->features);hw/virtio/virtio-qmp.c VirtioStatus *qmp_x_query_virtio_status(const char
Quoted 16 lines
hw/virtio/virtio-hmp-cmds.c +4
-2monitor_printf (mon," Acked features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->acked_features); +hmp_virtio_dump_features (mon, + s->device_id, s->vhost_dev->acked_features);monitor_printf (mon," Backend features:\n" ); -hmp_virtio_dump_features (mon, s->vhost_dev->backend_features); +hmp_virtio_dump_features (mon, + s->device_id, s->vhost_dev->backend_features);monitor_printf (mon," Protocol features:\n" );hmp_virtio_dump_protocols (mon, s->vhost_dev->protocol_features); }hw/virtio/virtio-qmp.c +0
-0@@ -733,12 +733,9 @@ VirtioStatus *qmp_x_query_virtio_status(const char*path, Error **errp)
hw/virtio/virtio-qmp.c VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
Quoted 9 lines
hw/virtio/virtio-qmp.c +0
-6status->name =g_strdup (vdev->name); status->device_id = vdev->device_id; status->vhost_started = vdev->vhost_started; - status->guest_features =qmp_decode_features (vdev->device_id, - vdev->guest_features); - status->host_features =qmp_decode_features (vdev->device_id, - vdev->host_features); - status->backend_features = qmp_decode_features(vdev->device_id, -
vdev->backend_features);hw/virtio/virtio-qmp.c VirtioStatus *qmp_x_query_virtio_status(const char
Quoted 7 lines
hw/virtio/virtio-qmp.c +3
-0+ status->guest_features = vdev->guest_features; + status->host_features = vdev->host_features; + status->backend_features = vdev->backend_features;switch (vdev->device_endian) {case VIRTIO_DEVICE_ENDIAN_LITTLE :@@ -753,7 +750,7 @@ VirtioStatus *qmp_x_query_virtio_status(const char*path, Error **errp)
hw/virtio/virtio-qmp.c VirtioStatus *qmp_x_query_virtio_status(const char
Quoted 9 lines
hw/virtio/virtio-qmp.c +1
-1} status->num_vqs =virtio_get_num_queues (vdev); - status->status =qmp_decode_status (vdev->status); + status->status = vdev->status; status->isr = vdev->isr; status->queue_sel = vdev->queue_sel; status->vm_running = vdev->vm_running;@@ -775,14 +772,10 @@ VirtioStatus *qmp_x_query_virtio_status(const char*path, Error **errp)
hw/virtio/virtio-qmp.c VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
Quoted 9 lines
hw/virtio/virtio-qmp.c +0
-6status->vhost_dev->n_tmp_sections = hdev->n_tmp_sections; status->vhost_dev->nvqs = hdev->nvqs; status->vhost_dev->vq_index = hdev->vq_index; - status->vhost_dev->features = -qmp_decode_features (vdev->device_id, hdev->features); - status->vhost_dev->acked_features = -qmp_decode_features (vdev->device_id, hdev->acked_features); - status->vhost_dev->backend_features = - qmp_decode_features(vdev->device_id,
hdev->backend_features);Quoted 49 lines
hw/virtio/virtio-qmp.c +4
-2- status->vhost_dev->protocol_features = -qmp_decode_protocols (hdev->protocol_features); + status->vhost_dev->features = hdev->features; + status->vhost_dev->acked_features = hdev->acked_features; + status->vhost_dev->backend_features = hdev->backend_features; + status->vhost_dev->protocol_features = hdev->protocol_features; status->vhost_dev->max_queues = hdev->max_queues; status->vhost_dev->backend_cap = hdev->backend_cap; status->vhost_dev->log_enabled = hdev->log_enabled;qapi/virtio.json +8
-9@@ -102,10 +102,10 @@ 'n-tmp-sections': 'int', 'nvqs': 'uint32', 'vq-index': 'int', - 'features': 'VirtioDeviceFeatures', - 'acked-features': 'VirtioDeviceFeatures', - 'backend-features': 'VirtioDeviceFeatures', - 'protocol-features': 'VhostDeviceProtocols', + 'features': 'uint64', + 'acked-features': 'uint64', + 'backend-features': 'uint64', + 'protocol-features': 'uint64', 'max-queues': 'uint64', 'backend-cap': 'uint64', 'log-enabled': 'bool',@@ -170,11 +170,11 @@ 'device-id': 'uint16', 'vhost-started': 'bool', 'device-endian': 'str', - 'guest-features': 'VirtioDeviceFeatures', - 'host-features': 'VirtioDeviceFeatures', - 'backend-features': 'VirtioDeviceFeatures', + 'guest-features': 'uint64', + 'host-features': 'uint64', + 'backend-features': 'uint64', 'num-vqs': 'int', - 'status': 'VirtioDeviceStatus', + 'status': 'uint8', 'isr': 'uint8', 'queue-sel': 'uint16', 'vm-running': 'bool',@@ -217,41 +217,14 @@ # "name": "virtio-crypto", # "started": true, # "device-id": 20, -# "backend-features": {qapi/virtio.json line 229
Quoted 10 lines
qapi/virtio.json +1
-6-# "transports": [], -# "dev-features": [] -# }, +# "backend-features": 0, # "start-on-kick": false, # "isr": 1, # "broken": false, -# "status": { -# "statuses": [ -# "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio devicefound",
qapi/virtio.json line 230
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible withdevice",
qapi/virtio.json line 231
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiationcomplete",
qapi/virtio.json
Quoted 9 lines
qapi/virtio.json +1
-7-# "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready" -# ] -# }, +# "status": 15, # "num-vqs": 2, -# "guest-features": { -# "dev-features": [], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fieldsenabled",
qapi/virtio.json line 240
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptorssupported",
qapi/virtio.json line 241
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_VERSION_1: Device compliant for v1 spec(legacy)"
qapi/virtio.json
Quoted 7 lines
qapi/virtio.json +0
-7-# ] -# }, -# "host-features": { -# "unknown-dev-features": 1073741824, -# "dev-features": [], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fieldsenabled",
qapi/virtio.json line 249
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptorssupported",
qapi/virtio.json line 250
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_VERSION_1: Device compliant for v1 spec(legacy)",
qapi/virtio.json line 251
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc.layouts",
qapi/virtio.json line 252
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runsout of avail. descs. on VQ"
Quoted 16 lines
qapi/virtio.json +3
-6-# ] -# }, +# "guest-features": 5100273664, +# "host-features": 6325010432, # "use-guest-notifier-mask": true, # "vm-running": true, # "queue-sel": 1,@@ -279,147 +252,22 @@ # "max-queues": 1, # "backend-cap": 2, # "log-size": 0, -# "backend-features": { -# "dev-features": [], -# "transports": [] -# }, +# "backend-features": 0,qapi/virtio.json line 294
Quoted 10 lines
qapi/virtio.json +1
-6# "nvqs": 2, -# "protocol-features": { -# "protocols": [] -# }, +# "protocol-features": 0, # "vq-index": 0, # "log-enabled": false, -# "acked-features": { -# "dev-features": [ -# "VIRTIO_NET_F_MRG_RXBUF: Driver can mergereceive buffers"
qapi/virtio.json
Quoted 3 lines
qapi/virtio.json +0
-3-# ], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. eventfields enabled",
qapi/virtio.json line 298
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_RING_F_INDIRECT_DESC: Indirectdescriptors supported",
qapi/virtio.json line 299
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_VERSION_1: Device compliant for v1spec (legacy)"
qapi/virtio.json
Quoted 5 lines
qapi/virtio.json +0
-5-# ] -# }, -# "features": { -# "dev-features": [ -# "VHOST_F_LOG_ALL: Logging write descriptorssupported",
qapi/virtio.json line 305
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_MRG_RXBUF: Driver can mergereceive buffers"
qapi/virtio.json
Quoted 3 lines
qapi/virtio.json +0
-3-# ], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. eventfields enabled",
qapi/virtio.json line 309
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_RING_F_INDIRECT_DESC: Indirectdescriptors supported",
qapi/virtio.json line 310
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_IOMMU_PLATFORM: Device can be used onIOMMU platform",
qapi/virtio.json line 311
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_VERSION_1: Device compliant for v1spec (legacy)",
qapi/virtio.json line 312
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrarydesc. layouts",
qapi/virtio.json line 313
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when deviceruns out of avail. descs. on VQ"
qapi/virtio.json
Quoted 6 lines
qapi/virtio.json +0
-6-# ] -# } -# }, -# "backend-features": { -# "dev-features": [ -# "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocolfeatures negotiation supported",
qapi/virtio.json line 320
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_GSO: Handling GSO-type packetssupported",
qapi/virtio.json line 321
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set throughcontrol channel",
qapi/virtio.json line 322
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sendinggratuitous packets supported",
qapi/virtio.json line 323
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode controlsupported",
qapi/virtio.json line 324
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLANfiltering supported",
qapi/virtio.json line 325
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_RX: Control channel RX modesupported",
qapi/virtio.json line 327
Quoted 2 lines
qapi/virtio.json +0
-2-# "VIRTIO_NET_F_CTRL_VQ: Control channel available", -# "VIRTIO_NET_F_STATUS: Configuration status fieldavailable",
qapi/virtio.json line 328
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receivebuffers",
qapi/virtio.json line 330
Quoted 2 lines
qapi/virtio.json +0
-2-# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", -# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO withECN",
qapi/virtio.json
Quoted 4 lines
qapi/virtio.json +0
-4-# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", -# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", -# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", -# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO withECN",
qapi/virtio.json
Quoted 4 lines
qapi/virtio.json +0
-4-# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", -# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", -# "VIRTIO_NET_F_MAC: Device has given MAC address", -# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channeloffloading reconfig. supported",
qapi/virtio.json line 339
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packetswith partial checksum supported",
qapi/virtio.json line 340
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CSUM: Device handling packets withpartial checksum supported"
qapi/virtio.json
Quoted 3 lines
qapi/virtio.json +0
-3-# ], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fieldsenabled",
qapi/virtio.json line 344
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptorssupported",
qapi/virtio.json line 345
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_VERSION_1: Device compliant for v1 spec(legacy)",
qapi/virtio.json line 346
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc.layouts",
qapi/virtio.json line 347
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runsout of avail. descs. on VQ"
qapi/virtio.json
Quoted 11 lines
qapi/virtio.json +3
-4-# ] +# "acked-features": 5100306432, +# "features": 13908344832, # }, +# "backend-features": 6337593319, # "start-on-kick": false, # "isr": 1, # "broken": false, -# "status": { -# "statuses": [ -# "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio devicefound",
qapi/virtio.json line 356
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible withdevice",
qapi/virtio.json line 357
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiationcomplete",
qapi/virtio.json
Quoted 8 lines
qapi/virtio.json +1
-6-# "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready" -# ] -# }, +# "status": 15, # "num-vqs": 3, -# "guest-features": { -# "dev-features": [ -# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set throughcontrol channel",
qapi/virtio.json line 365
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sendinggratuitous packets supported",
qapi/virtio.json line 366
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLANfiltering supported",
qapi/virtio.json line 367
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_RX: Control channel RX modesupported",
qapi/virtio.json line 369
Quoted 2 lines
qapi/virtio.json +0
-2-# "VIRTIO_NET_F_CTRL_VQ: Control channel available", -# "VIRTIO_NET_F_STATUS: Configuration status fieldavailable",
qapi/virtio.json line 370
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receivebuffers",
qapi/virtio.json line 372
Quoted 2 lines
qapi/virtio.json +0
-2-# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", -# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO withECN",
qapi/virtio.json
Quoted 4 lines
qapi/virtio.json +0
-4-# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", -# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", -# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", -# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO withECN",
qapi/virtio.json
Quoted 4 lines
qapi/virtio.json +0
-4-# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", -# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", -# "VIRTIO_NET_F_MAC: Device has given MAC address", -# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channeloffloading reconfig. supported",
qapi/virtio.json line 381
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packetswith partial checksum supported",
qapi/virtio.json line 382
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CSUM: Device handling packets withpartial checksum supported"
qapi/virtio.json
Quoted 3 lines
qapi/virtio.json +0
-3-# ], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fieldsenabled",
qapi/virtio.json line 386
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptorssupported",
qapi/virtio.json line 387
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_VERSION_1: Device compliant for v1 spec(legacy)"
qapi/virtio.json
Quoted 5 lines
qapi/virtio.json +0
-5-# ] -# }, -# "host-features": { -# "dev-features": [ -# "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocolfeatures negotiation supported",
qapi/virtio.json line 393
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_GSO: Handling GSO-type packetssupported",
qapi/virtio.json line 394
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set throughcontrol channel",
qapi/virtio.json line 395
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sendinggratuitous packets supported",
qapi/virtio.json line 396
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode controlsupported",
qapi/virtio.json line 397
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLANfiltering supported",
qapi/virtio.json line 398
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CTRL_RX: Control channel RX modesupported",
qapi/virtio.json line 400
Quoted 2 lines
qapi/virtio.json +0
-2-# "VIRTIO_NET_F_CTRL_VQ: Control channel available", -# "VIRTIO_NET_F_STATUS: Configuration status fieldavailable",
qapi/virtio.json line 401
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receivebuffers",
qapi/virtio.json line 403
Quoted 2 lines
qapi/virtio.json +0
-2-# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", -# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO withECN",
qapi/virtio.json
Quoted 4 lines
qapi/virtio.json +0
-4-# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", -# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", -# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", -# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO withECN",
qapi/virtio.json
Quoted 4 lines
qapi/virtio.json +0
-4-# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", -# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", -# "VIRTIO_NET_F_MAC: Device has given MAC address", -# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channeloffloading reconfig. supported",
qapi/virtio.json line 412
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packetswith partial checksum supported",
qapi/virtio.json line 413
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_NET_F_CSUM: Device handling packets withpartial checksum supported"
qapi/virtio.json
Quoted 3 lines
qapi/virtio.json +0
-3-# ], -# "transports": [ -# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fieldsenabled",
qapi/virtio.json line 417
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptorssupported",
qapi/virtio.json line 418
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_VERSION_1: Device compliant for v1 spec(legacy)",
qapi/virtio.json line 419
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc.layouts",
qapi/virtio.json line 420
Quoted 1 line
qapi/virtio.json +0
-1-# "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runsout of avail. descs. on VQ"
qapi/virtio.json line 273
Quoted 7 lines
qapi/virtio.json +2
-2-# ] -# }, +# "guest-features": 5111807911, +# "host-features": 6337593319, # "use-guest-notifier-mask": true, # "vm-running": true, # "queue-sel": 2,
qmp_decode_protocols(),qmp_decode_status(), andqmp_decode_features()are now only used invirtio-hmp-cmds.c. Please move them there, and replace theqmp_prefix byhmp_or simply drop it.
Quoted 7 lines
VhostDeviceProtocols and VirtioDeviceFeatures are then only used in
virtio-hmp-cmds.c. Please define them as plain C types there, and drop them from the QAPI schema.You may want to do this as a separate cleanup commit. Use your judgement.
Get it, I'll try in the next version.
Quoted 1 line
Thanks for the comment.
Yong
Signature · 1 line
Best regards
PATCH v2 2/2 hmp: Drop unknown feature and status bits
In reply to Hyman HuangThe QMP command "x-query-virtio-status" outputs the full feature and status bit information, so there is no need to maintain it in the HMP output; drop it.
--- hw/virtio/virtio-hmp-cmds.c | 13 ------------- 1 file changed, 13 deletions(-)
hw/virtio/virtio-hmp-cmds.c +0 -13
@@ -27,10 +27,6 @@ static void hmp_virtio_dump_protocols(Monitor *mon, } }monitor_printf (mon,"\n" ); -if (pcol->has_unknown_protocols) { -monitor_printf (mon," unknown-protocols(0x%016" PRIx64")\n" , - pcol->unknown_protocols); - } } static void hmp_virtio_dump_status(Monitor *mon,
@@ -47,10 +43,6 @@ static void hmp_virtio_dump_status(Monitor *mon, } }monitor_printf (mon,"\n" ); -if (status->has_unknown_statuses) { -monitor_printf (mon," unknown-statuses(0x%016" PRIx32")\n" , - status->unknown_statuses); - } } static void hmp_virtio_dump_features(Monitor *mon,
@@ -81,11 +73,6 @@ static void hmp_virtio_dump_features(Monitor *mon, }monitor_printf (mon,"\n" ); } - -if (features->has_unknown_dev_features) { -monitor_printf (mon," unknown-features(0x%016" PRIx64")\n" , - features->unknown_dev_features); - } }void hmp_virtio_query (Monitor *mon,const QDict *qdict)
Signature · 1 line
2.39.1
Re: [PATCH v2 2/2] hmp: Drop unknown feature and status bits
Quoted 5 lines · Hyman Huang
The QMP command "x-query-virtio-status" outputs the full feature and status bit information, so there is no need to maintain it in the HMP output; drop it.
Signed-off-by Hyman Huang <[email protected]>
I'm not sure hiding unknown bits from HMP users is a good idea. Sure, you can use QMP to find them, but why would you when HMP gives no clue that its output is incomplete?
I'd simply keep them, i.e. drop this patch.
Re: [PATCH v2 2/2] hmp: Drop unknown feature and status bits
Quoted 6 lines · Markus Armbruster
Quoted 4 lines · Hyman Huang
The QMP command "x-query-virtio-status" outputs the full feature and status bit information, so there is no need to maintain it in the HMP output; drop it.
Quoted 9 lines
Quoted 1 line
Signed-off-by Hyman Huang <[email protected]>I'm not sure hiding unknown bits from HMP users is a good idea. Sure, you can use QMP to find them, but why would you when HMP gives no clue that its output is incomplete?
I'd simply keep them, i.e. drop this patch.
Ok, I'm not insisting on that.
Thanks,
Yong
Signature · 1 line
Best regards