qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 4/5] qmp: add QMP command virtio-queue-element


From: Dr. David Alan Gilbert
Subject: Re: [RFC 4/5] qmp: add QMP command virtio-queue-element
Date: Thu, 2 Apr 2020 15:58:30 +0100
User-agent: Mutt/1.13.4 (2020-02-15)

* Laurent Vivier (address@hidden) wrote:
> This new command shows the information of a VirtQueue element.

Having had a few second play with this, I think I've always seen it say
that the ring is empty; is this pretty much always the case when the VM
is running and the device is consuming elements off the queue - so most
cases where this is useful is where the VM is paused?
> +        desc_cache = &caches->desc;
> +        vring_split_desc_read(vdev, &desc, desc_cache, i);
> +        if (desc.flags & VRING_DESC_F_INDIRECT) {
> +            error_setg(errp, "Unsupported indirect buffer feature");
> +            return NULL;
> +        }

I did trigger this in the case I was playing with.

Dave

> +        element = g_new0(VirtioQueueElement, 1);
> +        element->index = head;
> +        element->ndescs = 1;
> +        element->descs = g_new0(VirtioRingDescList, 1);
> +        element->descs->value = g_new0(VirtioRingDesc, 1);
> +        element->descs->value->addr = desc.addr;
> +        element->descs->value->len = desc.len;
> +        element->descs->value->flags = desc.flags;
> +    }
> +
> +    return element;
> +}
> +
>  static const TypeInfo virtio_device_info = {
>      .name = TYPE_VIRTIO_DEVICE,
>      .parent = TYPE_DEVICE,
> diff --git a/qapi/virtio.json b/qapi/virtio.json
> index ab70500d919b..3e8865511217 100644
> --- a/qapi/virtio.json
> +++ b/qapi/virtio.json
> @@ -215,3 +215,88 @@
>    'data': { 'path': 'str', 'queue': 'uint16' },
>    'returns': 'VirtQueueStatus'
>  }
> +
> +##
> +# @VirtioRingDesc:
> +#
> +# @addr: guest physical address of the descriptor data
> +#
> +# @len: length of the descriptor data
> +#
> +# @flags: descriptor flags (write-only, read-only, ...)
> +#
> +# Since: 5.1
> +#
> +##
> +
> +{ 'struct': 'VirtioRingDesc',
> +  'data': {
> +    'addr': 'uint64',
> +    'len': 'uint32',
> +    'flags': 'uint16'
> +  }
> +}
> +
> +##
> +# @VirtioQueueElement:
> +#
> +# @index: index of the element in the queue
> +#
> +# @len: length of the element data
> +#
> +# @ndescs: number of descriptors
> +#
> +# @descs: list of the descriptors
> +#
> +# Since: 5.1
> +#
> +##
> +
> +{ 'struct': 'VirtioQueueElement',
> +  'data': {
> +    'index': 'uint32',
> +    'len': 'uint32',
> +    'ndescs': 'uint32',
> +    'descs': ['VirtioRingDesc']
> +  }
> +}
> +
> +##
> +# @virtio-queue-element:
> +#
> +# Return the information about an element queue (by default head)
> +#
> +# @path: QOBject path of the VirtIODevice
> +#
> +# @queue: queue number to examine
> +#
> +# @index: the index in the queue, by default head
> +#
> +# Returns: the element information
> +#
> +# Since: 5.1
> +#
> +# Example:
> +#
> +# -> { "execute": "virtio-queue-element",
> +#      "arguments": {
> +#          "path": "/machine/peripheral-anon/device[3]/virtio-backend",
> +#          "queue": 0
> +#      }
> +#   }
> +# -> { "return": {
> +#         "index": 109,
> +#         "len": 0,
> +#         "ndescs": 1,
> +#         "descs": [
> +#             { "flags": 2, "len": 2048, "addr": 853145600 }
> +#         ]
> +#      }
> +#   }
> +#
> +##
> +
> +{ 'command': 'virtio-queue-element',
> +  'data': { 'path': 'str', 'queue': 'uint16', '*index': 'uint16' },
> +  'returns': 'VirtioQueueElement'
> +}
> -- 
> 2.25.1
> 
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK




reply via email to

[Prev in Thread] Current Thread [Next in Thread]