[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v12 5/8] qmp: decode feature & status bits in virtio-status
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v12 5/8] qmp: decode feature & status bits in virtio-status |
Date: |
Fri, 11 Feb 2022 13:30:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Jonah Palmer <jonah.palmer@oracle.com> writes:
> From: Laurent Vivier <lvivier@redhat.com>
>
> Display feature names instead of bitmaps for host, guest, and
> backend for VirtIODevices.
>
> Display status names instead of bitmaps for VirtIODevices.
>
> Display feature names instead of bitmaps for backend, protocol,
> acked, and features (hdev->features) for vhost devices.
>
> Decode features according to device ID. Decode statuses
> according to configuration status bitmap (config_status_map).
> Decode vhost user protocol features according to vhost user
> protocol bitmap (vhost_user_protocol_map).
>
> Transport features are on the first line. Undecoded bits (if
> any) are stored in a separate field.
>
> Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
[...]
> diff --git a/qapi/virtio.json b/qapi/virtio.json
> index ba61d83..474a8bd 100644
> --- a/qapi/virtio.json
> +++ b/qapi/virtio.json
> @@ -106,10 +106,10 @@
> 'n-tmp-sections': 'int',
> 'nvqs': 'uint32',
> 'vq-index': 'int',
> - 'features': 'uint64',
> - 'acked-features': 'uint64',
> - 'backend-features': 'uint64',
> - 'protocol-features': 'uint64',
> + 'features': 'VirtioDeviceFeatures',
> + 'acked-features': 'VirtioDeviceFeatures',
> + 'backend-features': 'VirtioDeviceFeatures',
> + 'protocol-features': 'VhostDeviceProtocols',
> 'max-queues': 'uint64',
> 'backend-cap': 'uint64',
> 'log-enabled': 'bool',
> @@ -176,11 +176,11 @@
> 'device-id': 'uint16',
> 'vhost-started': 'bool',
> 'device-endian': 'str',
> - 'guest-features': 'uint64',
> - 'host-features': 'uint64',
> - 'backend-features': 'uint64',
> + 'guest-features': 'VirtioDeviceFeatures',
> + 'host-features': 'VirtioDeviceFeatures',
> + 'backend-features': 'VirtioDeviceFeatures',
> 'num-vqs': 'int',
> - 'status': 'uint8',
> + 'status': 'VirtioDeviceStatus',
> 'isr': 'uint8',
> 'queue-sel': 'uint16',
> 'vm-running': 'bool',
> @@ -222,14 +222,28 @@
> # "name": "virtio-crypto",
> # "started": true,
> # "device-id": 20,
> -# "backend-features": 0,
> +# "backend-features": {
> +# "transports": [],
> +# "dev-features": []
> +# },
> # "start-on-kick": false,
> # "isr": 1,
> # "broken": false,
> -# "status": 15,
> +# "status": {
> +# "statuses": ["ACKNOWLEDGE", "DRIVER", "FEATURES_OK",
> +# "DRIVER_OK"]
> +# },
> # "num-vqs": 2,
> -# "guest-features": 5100273664,
> -# "host-features": 6325010432,
> +# "guest-features": {
> +# "transports": ["EVENT_IDX", "INDIRECT_DESC", "VERSION_1"],
> +# "dev-features": []
> +# },
> +# "host-features": {
> +# "transports": ["PROTOCOL_FEATURES", "EVENT_IDX",
> +# "INDIRECT_DESC", "VERSION_1", "ANY_LAYOUT",
> +# "NOTIFY_ON_EMPTY"],
> +# "dev-features": []
> +# },
> # "use-guest-notifier-mask": true,
> # "vm-running": true,
> # "queue-sel": 1,
> @@ -257,22 +271,65 @@
> # "max-queues": 1,
> # "backend-cap": 2,
> # "log-size": 0,
> -# "backend-features": 0,
> +# "backend-features": {
> +# "transports": [],
> +# "dev-features": []
> +# },
> # "nvqs": 2,
> -# "protocol-features": 0,
> +# "protocol-features": {
> +# "protocols": []
> +# },
> # "vq-index": 0,
> # "log-enabled": false,
> -# "acked-features": 5100306432,
> -# "features": 13908344832
> +# "acked-features": {
> +# "transports": ["EVENT_IDX", "INDIRECT_DESC", "VERSION_1",
> +# "ANY_LAYOUT", "NOTIFY_ON_EMPTY"],
> +# "dev-features": ["MRG_RXBUF"]
> +# },
> +# "features": {
> +# "transports": ["EVENT_IDX", "INDIRECT_DESC",
> +# "IOMMU_PLATFORM", "VERSION_1",
> "ANY_LAYOUT",
> +# "NOTIFY_ON_EMPTY"],
> +# "dev-features": ["LOG_ALL", "MRG_RXBUF"]
> +# }
> +# },
> +# "backend-features": {
> +# "transports": ["PROTOCOL_FEATURES", "EVENT_IDX",
> "INDIRECT_DESC",
> +# "VERSION_1", "ANY_LAYOUT", "NOTIFY_ON_EMPTY"],
> +# "dev-features": ["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": 6337593319,
> # "start-on-kick": false,
> # "isr": 1,
> # "broken": false,
> -# "status": 15,
> +# "status": {
> +# "statuses": ["ACKNOWLEDGE", "DRIVER", "FEATURES_OK",
> "DRIVER_OK"]
> +# },
> # "num-vqs": 3,
> -# "guest-features": 5111807911,
> -# "host-features": 6337593319,
> +# "guest-features": {
> +# "transports": ["EVENT_IDX", "INDIRECT_DESC", "VERSION_1"],
> +# "dev-features": ["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": {
> +# "transports": ["PROTOCOL_FEATURES", "EVENT_IDX",
> +# "INDIRECT_DESC", "VERSION_1", "ANY_LAYOUT",
> +# "NOTIFY_ON_EMPTY"],
> +# "dev-features": ["GSO", "CTRL_MAC_ADDR", "GUEST_ANNOUNCE",
> +# "CTRL_RX_EXTRA", "CTRL_VLAN", "CTRL_RX",
> +# "CTRL_VQ", "STATUS", "MRG_RXBUF",
> "HOST_UFO",
> +# "HOST_ECN", "HOST_TSO4", "HOST_TSO4",
> +# "GUEST_UFO", "GUEST_ECN", "GUEST_TSO6",
> +# "GUEST_TSO4", "MAC", "CTRL_GUEST_OFFLOADS",
> +# "GUEST_CSUM", "CSUM"]
> +# },
> # "use-guest-notifier-mask": true,
> # "vm-running": true,
> # "queue-sel": 2,
> @@ -288,3 +345,62 @@
> 'data': { 'path': 'str' },
> 'returns': 'VirtioStatus',
> 'features': [ 'unstable' ] }
> +
> +##
> +# @VirtioDeviceStatus:
> +#
> +# A structure defined to list the configuration statuses of a virtio
> +# device
> +#
> +# @statuses: List of decoded configuration statuses of the virtio
> +# device
> +#
> +# @unknown-statuses: Virtio device statuses bitmap that have not been decoded
> +#
> +# Since: 7.0
> +##
> +
> +{ 'struct': 'VirtioDeviceStatus',
> + 'data': { 'statuses': [ 'str' ],
> + '*unknown-statuses': 'uint8' } }
> +
> +##
> +# @VhostDeviceProtocols:
> +#
> +# A structure defined to list the vhost user protocol features of a
> +# Vhost User device
> +#
> +# @protocols: List of decoded vhost user protocol features of a vhost
> +# user device
> +#
> +# @unknown-protocols: Vhost user device protocol features bitmap that
> +# have not been decoded
> +#
> +# Since: 7.0
> +##
> +
> +{ 'struct': 'VhostDeviceProtocols',
> + 'data': { 'protocols': [ 'str' ],
> + '*unknown-protocols': 'uint64' } }
> +
> +##
> +# @VirtioDeviceFeatures:
> +#
> +# The common fields that apply to most Virtio devices. Some devices
> +# may not have their own device-specific features (e.g. virtio-rng).
> +#
> +# @transports: List of transport features of the virtio device
> +#
> +# @dev-features: List of device-specific features (if the device has
> +# unique features)
> +#
> +# @unknown-dev-features: Virtio device features bitmap that have not
> +# been decoded
> +#
> +# Since: 7.0
> +##
> +
> +{ 'struct': 'VirtioDeviceFeatures',
> + 'data': { 'transports': [ 'str' ],
> + '*dev-features': [ 'str' ],
> + '*unknown-dev-features': 'uint64' } }
I think I'd factor out the common pair of members (list of strings, list
of integers). This is not a demand.
QAPI schema
Acked-by: Markus Armbruster <armbru@redhat.com>
- [PATCH v12 2/8] virtio: add vhost support for virtio devices, (continued)
- [PATCH v12 2/8] virtio: add vhost support for virtio devices, Jonah Palmer, 2022/02/10
- [PATCH v12 4/8] qmp: add QMP command x-query-virtio-status, Jonah Palmer, 2022/02/10
- [PATCH v12 3/8] qmp: add QMP command x-query-virtio, Jonah Palmer, 2022/02/10
- [PATCH v12 6/8] qmp: add QMP commands for virtio/vhost queue-status, Jonah Palmer, 2022/02/10
- [PATCH v12 5/8] qmp: decode feature & status bits in virtio-status, Jonah Palmer, 2022/02/10
- Re: [PATCH v12 5/8] qmp: decode feature & status bits in virtio-status,
Markus Armbruster <=
- [PATCH v12 7/8] qmp: add QMP command x-query-virtio-queue-element, Jonah Palmer, 2022/02/10
- [PATCH v12 8/8] hmp: add virtio commands, Jonah Palmer, 2022/02/10