search for: virtqueue_pop

Displaying 20 results from an estimated 111 matches for "virtqueue_pop".

Did you mean: virtqueue_poll
2016 Jul 19
2
[PATCH 2/3] qemu: Implement virtio-pstore device
...tio_pstore_handle_io(VirtIODevice *vdev, VirtQueue *vq) > > +{ > > + VirtIOPstore *s = VIRTIO_PSTORE(vdev); > > + VirtQueueElement *elem; > > + struct virtio_pstore_hdr *hdr; > > + ssize_t len; > > + > > + for (;;) { > > + elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); > > + if (!elem) { > > + return; > > + } > > + > > + hdr = elem->out_sg[0].iov_base; > > + if (elem->out_sg[0].iov_len != sizeof(*hdr)) { > > + error_report("invalid...
2016 Jul 19
2
[PATCH 2/3] qemu: Implement virtio-pstore device
...tio_pstore_handle_io(VirtIODevice *vdev, VirtQueue *vq) > > +{ > > + VirtIOPstore *s = VIRTIO_PSTORE(vdev); > > + VirtQueueElement *elem; > > + struct virtio_pstore_hdr *hdr; > > + ssize_t len; > > + > > + for (;;) { > > + elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); > > + if (!elem) { > > + return; > > + } > > + > > + hdr = elem->out_sg[0].iov_base; > > + if (elem->out_sg[0].iov_len != sizeof(*hdr)) { > > + error_report("invalid...
2007 Dec 21
2
[Virtio-for-kvm] [PATCH 7/7] userspace virtio
...struct timeval tv; + int max_fd = -1; VirtQueueElement elem; struct virtio_net_hdr *hdr; - int offset, i; - - /* FIXME: the drivers really need to set their status better */ - if (n->rx_vq->vring.avail == NULL) { - n->can_receive = 0; - return; - } - - if (virtqueue_pop(n->rx_vq, &elem) == 0) { - /* wait until the guest adds some rx bufs */ - n->can_receive = 0; - return; - } - - hdr = (void *)elem.in_sg[0].iov_base; - hdr->flags = 0; - hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE; - - /* copy in packet. ugh */ - offset = 0;...
2007 Dec 21
2
[Virtio-for-kvm] [PATCH 7/7] userspace virtio
...struct timeval tv; + int max_fd = -1; VirtQueueElement elem; struct virtio_net_hdr *hdr; - int offset, i; - - /* FIXME: the drivers really need to set their status better */ - if (n->rx_vq->vring.avail == NULL) { - n->can_receive = 0; - return; - } - - if (virtqueue_pop(n->rx_vq, &elem) == 0) { - /* wait until the guest adds some rx bufs */ - n->can_receive = 0; - return; - } - - hdr = (void *)elem.in_sg[0].iov_base; - hdr->flags = 0; - hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE; - - /* copy in packet. ugh */ - offset = 0;...
2015 Apr 20
4
[PATCH 00/18] virtio-blk: Support "VIRTIO_CONFIG_S_NEEDS_RESET"
...> virtio: Return error from virtqueue_map_sg > virtio: Return error from virtqueue_num_heads > virtio: Return error from virtqueue_get_head > virtio: Return error from virtqueue_next_desc > virtio: Return error from virtqueue_get_avail_bytes > virtio: Return error from virtqueue_pop > virtio: Return error from virtqueue_avail_bytes > virtio: Return error from virtio_add_queue > virtio: Return error from virtio_del_queue > virtio: Add macro for VIRTIO_CONFIG_S_NEEDS_RESET > virtio: Add "needs_reset" flag to virtio device > virtio: Return...
2015 Apr 20
4
[PATCH 00/18] virtio-blk: Support "VIRTIO_CONFIG_S_NEEDS_RESET"
...> virtio: Return error from virtqueue_map_sg > virtio: Return error from virtqueue_num_heads > virtio: Return error from virtqueue_get_head > virtio: Return error from virtqueue_next_desc > virtio: Return error from virtqueue_get_avail_bytes > virtio: Return error from virtqueue_pop > virtio: Return error from virtqueue_avail_bytes > virtio: Return error from virtio_add_queue > virtio: Return error from virtio_del_queue > virtio: Add macro for VIRTIO_CONFIG_S_NEEDS_RESET > virtio: Add "needs_reset" flag to virtio device > virtio: Return...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 2/7] userspace virtio
...int size) +{ + VirtIONet *n = opaque; + VirtQueueElement elem; + struct virtio_net_hdr *hdr; + int offset, i; + + /* FIXME: the drivers really need to set their status better */ + if (n->rx_vq->vring.avail == NULL) { + n->can_receive = 0; + return; + } + + if (virtqueue_pop(n->rx_vq, &elem) == 0) { + /* wait until the guest adds some rx bufs */ + n->can_receive = 0; + return; + } + + hdr = (void *)elem.in_sg[0].iov_base; + hdr->flags = 0; + hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE; + + /* copy in packet. ugh */ + offset = 0;...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 2/7] userspace virtio
...int size) +{ + VirtIONet *n = opaque; + VirtQueueElement elem; + struct virtio_net_hdr *hdr; + int offset, i; + + /* FIXME: the drivers really need to set their status better */ + if (n->rx_vq->vring.avail == NULL) { + n->can_receive = 0; + return; + } + + if (virtqueue_pop(n->rx_vq, &elem) == 0) { + /* wait until the guest adds some rx bufs */ + n->can_receive = 0; + return; + } + + hdr = (void *)elem.in_sg[0].iov_base; + hdr->flags = 0; + hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE; + + /* copy in packet. ugh */ + offset = 0;...
2016 Mar 03
0
[RFC qemu 2/4] virtio-balloon: Add a new feature to balloon device
...; } > > +static void virtio_balloon_get_free_pages(VirtIODevice *vdev, VirtQueue *vq) > +{ > + VirtIOBalloon *s = VIRTIO_BALLOON(vdev); > + VirtQueueElement *elem; > + size_t offset = 0; > + uint64_t bitmap_bytes = 0, free_pages_count = 0; > + > + elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); > + if (!elem) { > + return; > + } > + s->free_pages_vq_elem = elem; > + > + if (!elem->out_num) { > + return; > + } > + > + iov_to_buf(elem->out_sg, elem->out_num, offset, > +...
2016 Mar 03
2
[RFC qemu 2/4] virtio-balloon: Add a new feature to balloon device
...erval > 0; @@ -293,6 +299,37 @@ out: } } +static void virtio_balloon_get_free_pages(VirtIODevice *vdev, VirtQueue *vq) +{ + VirtIOBalloon *s = VIRTIO_BALLOON(vdev); + VirtQueueElement *elem; + size_t offset = 0; + uint64_t bitmap_bytes = 0, free_pages_count = 0; + + elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); + if (!elem) { + return; + } + s->free_pages_vq_elem = elem; + + if (!elem->out_num) { + return; + } + + iov_to_buf(elem->out_sg, elem->out_num, offset, + &free_pages_count, sizeof(uint64_t)); + + offset...
2016 Jul 20
0
[PATCH 2/3] qemu: Implement virtio-pstore device
...VirtQueue *vq) > > > +{ > > > + VirtIOPstore *s = VIRTIO_PSTORE(vdev); > > > + VirtQueueElement *elem; > > > + struct virtio_pstore_hdr *hdr; > > > + ssize_t len; > > > + > > > + for (;;) { > > > + elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); > > > + if (!elem) { > > > + return; > > > + } > > > + > > > + hdr = elem->out_sg[0].iov_base; > > > + if (elem->out_sg[0].iov_len != sizeof(*hdr)) { > > > +...
2017 Oct 11
2
[PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ
...on to continue where source left off without guest help. > > > > I'm afraid it would be difficult to pass the entire VirtQueueElement to the > destination. I think > that would also be the reason that stats_vq_elem chose to rewind from the > guest vq, which re-do the > virtqueue_pop() --> virtqueue_map_desc() steps (the QEMU virtual address to > the guest physical > address relationship may be changed on the destination). Yes but note how that rewind does not involve modifying the ring. It just rolls back some indices. > > How about another direction which w...
2017 Oct 11
2
[PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ
...on to continue where source left off without guest help. > > > > I'm afraid it would be difficult to pass the entire VirtQueueElement to the > destination. I think > that would also be the reason that stats_vq_elem chose to rewind from the > guest vq, which re-do the > virtqueue_pop() --> virtqueue_map_desc() steps (the QEMU virtual address to > the guest physical > address relationship may be changed on the destination). Yes but note how that rewind does not involve modifying the ring. It just rolls back some indices. > > How about another direction which w...
2017 Oct 11
0
[PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ
...to destination for > destination to continue where source left off without guest help. > I'm afraid it would be difficult to pass the entire VirtQueueElement to the destination. I think that would also be the reason that stats_vq_elem chose to rewind from the guest vq, which re-do the virtqueue_pop() --> virtqueue_map_desc() steps (the QEMU virtual address to the guest physical address relationship may be changed on the destination). How about another direction which would be easier - using two 32-bit device specific configuration registers, Host2Guest and Guest2Host command registers,...
2017 Oct 10
2
[PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ
On Mon, Oct 02, 2017 at 04:38:01PM +0000, Wang, Wei W wrote: > On Sunday, October 1, 2017 11:19 AM, Michael S. Tsirkin wrote: > > On Sat, Sep 30, 2017 at 12:05:54PM +0800, Wei Wang wrote: > > > +static void ctrlq_send_cmd(struct virtio_balloon *vb, > > > + struct virtio_balloon_ctrlq_cmd *cmd, > > > + bool inbuf) > > > +{ > > > + struct
2017 Oct 10
2
[PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ
On Mon, Oct 02, 2017 at 04:38:01PM +0000, Wang, Wei W wrote: > On Sunday, October 1, 2017 11:19 AM, Michael S. Tsirkin wrote: > > On Sat, Sep 30, 2017 at 12:05:54PM +0800, Wei Wang wrote: > > > +static void ctrlq_send_cmd(struct virtio_balloon *vb, > > > + struct virtio_balloon_ctrlq_cmd *cmd, > > > + bool inbuf) > > > +{ > > > + struct
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 1/7] userspace virtio
...xt entry in the used ring. */ + used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num]; + used->id = elem->index; + used->len = len; + /* Make sure buffer is written before we update index. */ + wmb(); + vq->vring.used->idx++; +} + +int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) +{ + unsigned int i, head; + unsigned int position; + + /* Check it isn't doing very strange things with descriptor numbers. */ + if ((uint16_t)(vq->vring.avail->idx - vq->last_avail_idx) > vq->vring.num) + errx(1, "Gues...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 1/7] userspace virtio
...xt entry in the used ring. */ + used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num]; + used->id = elem->index; + used->len = len; + /* Make sure buffer is written before we update index. */ + wmb(); + vq->vring.used->idx++; +} + +int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) +{ + unsigned int i, head; + unsigned int position; + + /* Check it isn't doing very strange things with descriptor numbers. */ + if ((uint16_t)(vq->vring.avail->idx - vq->last_avail_idx) > vq->vring.num) + errx(1, "Gues...
2013 Nov 25
0
QEMU dies on any attempt to load a Linux kernel module when using a 9P rootfs
...434 error_report("virtio: trying to map MMIO memory"); > (gdb) bt > #0 virtqueue_map_sg (sg=0x7f695b797b98, addr=0x7f695b793b98, num_sg=3, > is_write=1) at > /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:434 > #1 0x00000000006eb666 in virtqueue_pop (vq=0x1b23740, > elem=0x7f695b793b88) at > /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:500 > #2 0x00000000004a74ee in handle_9p_output (vdev=0x7f695b1fd910, > vq=0x1b23740) at > /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/9pfs/virtio-9p.c:3254 > #3...
2016 Jul 18
3
[PATCH 2/3] qemu: Implement virtio-pstore device
...e(s, path, sizeof(path), hdr); + + return unlink(path); +} + +static void virtio_pstore_handle_io(VirtIODevice *vdev, VirtQueue *vq) +{ + VirtIOPstore *s = VIRTIO_PSTORE(vdev); + VirtQueueElement *elem; + struct virtio_pstore_hdr *hdr; + ssize_t len; + + for (;;) { + elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); + if (!elem) { + return; + } + + hdr = elem->out_sg[0].iov_base; + if (elem->out_sg[0].iov_len != sizeof(*hdr)) { + error_report("invalid header size: %u", + (unsigned)elem->o...