From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [RFC 4/5] qmp: add QMP command virtio-queue-element
Date: Thu, 2 Apr 2020 15:58:30 +0100 [thread overview]
Message-ID: <20200402145830.GP2834@work-vm> (raw)
In-Reply-To: <20200402100302.833267-5-lvivier@redhat.com>
* Laurent Vivier (lvivier@redhat.com) 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 / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-04-02 15:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-02 10:02 [RFC 0/5] hmp,qmp: Add some commands to introspect virtio devices Laurent Vivier
2020-04-02 10:02 ` [RFC 1/5] qmp: add QMP command query-virtio Laurent Vivier
2020-04-02 14:23 ` Eric Blake
2020-04-02 10:02 ` [RFC 2/5] qmp: add QMP command virtio-status Laurent Vivier
2020-04-02 14:27 ` Eric Blake
2020-04-02 10:03 ` [RFC 3/5] qmp: add QMP command virtio-queue-status Laurent Vivier
2020-04-02 14:30 ` Eric Blake
2020-04-02 10:03 ` [RFC 4/5] qmp: add QMP command virtio-queue-element Laurent Vivier
2020-04-02 14:31 ` Eric Blake
2020-04-02 14:58 ` Dr. David Alan Gilbert [this message]
2020-04-02 10:03 ` [RFC 5/5] hmp: add virtio commands Laurent Vivier
2020-04-02 15:08 ` Dr. David Alan Gilbert
2020-04-02 14:33 ` [RFC 0/5] hmp, qmp: Add some commands to introspect virtio devices Marc-André Lureau
2020-04-02 15:23 ` Dr. David Alan Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200402145830.GP2834@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=lvivier@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).