search for: virtqueue_push

Displaying 20 results from an estimated 65 matches for "virtqueue_push".

2007 Dec 21
2
[Virtio-for-kvm] [PATCH 7/7] userspace virtio
...eadv(vnet->tap_fd, &elem.in_sg[1], elem.in_num - 1); + if (len == -1) + if (errno == EINTR || errno == EAGAIN) + goto again; + else + fprintf(stderr, "reading network error %d", len); + + virtqueue_push(vnet->rx_vq, &elem, sizeof(*hdr) + len); + vnet->do_notify = 1; + } + + /* signal other side */ + did_notify = 0; + for (vnet = VirtIONetHead; vnet; vnet = vnet->next) + if (vnet->do_notify) { + virtio_notify(&vnet...
2007 Dec 21
2
[Virtio-for-kvm] [PATCH 7/7] userspace virtio
...eadv(vnet->tap_fd, &elem.in_sg[1], elem.in_num - 1); + if (len == -1) + if (errno == EINTR || errno == EAGAIN) + goto again; + else + fprintf(stderr, "reading network error %d", len); + + virtqueue_push(vnet->rx_vq, &elem, sizeof(*hdr) + len); + vnet->do_notify = 1; + } + + /* signal other side */ + did_notify = 0; + for (vnet = VirtIONetHead; vnet; vnet = vnet->next) + if (vnet->do_notify) { + virtio_notify(&vnet...
2015 Mar 09
0
virtio fixes pull for 4.0?
...sed ring. */ vring_used_ring_id(vq, idx, elem->index); - vring_used_ring_len(vq, idx, len); + vring_used_ring_len(vq, idx, len_written); } void virtqueue_flush(VirtQueue *vq, unsigned int count) @@ -288,9 +293,9 @@ void virtqueue_flush(VirtQueue *vq, unsigned int count) } void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, - unsigned int len) + unsigned int len_written) { - virtqueue_fill(vq, elem, len, 0); + virtqueue_fill(vq, elem, len_written, 0); virtqueue_flush(vq, 1); } diff --git a/include/hw/virtio/virtio.h b/inc...
2015 Mar 09
0
virtio fixes pull for 4.0?
...sed ring. */ vring_used_ring_id(vq, idx, elem->index); - vring_used_ring_len(vq, idx, len); + vring_used_ring_len(vq, idx, len_written); } void virtqueue_flush(VirtQueue *vq, unsigned int count) @@ -288,9 +293,9 @@ void virtqueue_flush(VirtQueue *vq, unsigned int count) } void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, - unsigned int len) + unsigned int len_written) { - virtqueue_fill(vq, elem, len, 0); + virtqueue_fill(vq, elem, len_written, 0); virtqueue_flush(vq, 1); } diff --git a/include/hw/virtio/virtio.h b/inc...
2016 Aug 24
2
[PATCH 2/3] qemu: Implement virtio-pstore device
...+ res.ret = cpu_to_le32(ret); > + > + /* now copy res and fileinfo */ > + iov_from_buf(elem->in_sg, elem->in_num, 0, &res, sizeof(res)); > + iov_from_buf(elem->in_sg, elem->in_num, sizeof(res), info, sizeof(*info)); > + > + len += offset; > + virtqueue_push(vps->rvq, elem, len); > + virtio_notify(VIRTIO_DEVICE(vps), vps->rvq); > + > + return G_SOURCE_REMOVE; G_SOURCE_REMOVE was added in glib 2.32, but QEMU only permits stuff that is present in 2.22. Just use "FALSE" instead. > +static ssize_t virtio_pstore_do_read(V...
2016 Aug 24
2
[PATCH 2/3] qemu: Implement virtio-pstore device
...+ res.ret = cpu_to_le32(ret); > + > + /* now copy res and fileinfo */ > + iov_from_buf(elem->in_sg, elem->in_num, 0, &res, sizeof(res)); > + iov_from_buf(elem->in_sg, elem->in_num, sizeof(res), info, sizeof(*info)); > + > + len += offset; > + virtqueue_push(vps->rvq, elem, len); > + virtio_notify(VIRTIO_DEVICE(vps), vps->rvq); > + > + return G_SOURCE_REMOVE; G_SOURCE_REMOVE was added in glib 2.32, but QEMU only permits stuff that is present in 2.22. Just use "FALSE" instead. > +static ssize_t virtio_pstore_do_read(V...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 2/7] userspace virtio
...py in packet. ugh */ + offset = 0; + i = 1; + while (offset < size && i < elem.in_num) { + int len = MIN(elem.in_sg[i].iov_len, size - offset); + memcpy(elem.in_sg[i].iov_base, buf + offset, len); + offset += len; + i++; + } + + /* signal other side */ + virtqueue_push(n->rx_vq, &elem, sizeof(*hdr) + offset); + virtio_notify(&n->vdev, n->rx_vq); +} + +/* TX */ +static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) +{ + VirtIONet *n = to_virtio_net(vdev); + VirtQueueElement elem; + + while (virtqueue_pop(vq, &elem)) {...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 2/7] userspace virtio
...py in packet. ugh */ + offset = 0; + i = 1; + while (offset < size && i < elem.in_num) { + int len = MIN(elem.in_sg[i].iov_len, size - offset); + memcpy(elem.in_sg[i].iov_base, buf + offset, len); + offset += len; + i++; + } + + /* signal other side */ + virtqueue_push(n->rx_vq, &elem, sizeof(*hdr) + offset); + virtio_notify(&n->vdev, n->rx_vq); +} + +/* TX */ +static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) +{ + VirtIONet *n = to_virtio_net(vdev); + VirtQueueElement elem; + + while (virtqueue_pop(vq, &elem)) {...
2015 Mar 07
4
virtio fixes pull for 4.0?
Hi Rusty! There are a bunch of (mostly virtio 1.0 related) fixes for virtio that need to go into 4.0 I think. virtio_blk: typo fix virtio_blk: fix comment for virtio 1.0 virtio_console: init work unconditionally virtio_console: avoid config access from irq virtio_balloon: set DRIVER_OK before using device seem ready? virtio_mmio: generation support virtio_mmio: fix endian-ness for mmio
2015 Mar 07
4
virtio fixes pull for 4.0?
Hi Rusty! There are a bunch of (mostly virtio 1.0 related) fixes for virtio that need to go into 4.0 I think. virtio_blk: typo fix virtio_blk: fix comment for virtio 1.0 virtio_console: init work unconditionally virtio_console: avoid config access from irq virtio_balloon: set DRIVER_OK before using device seem ready? virtio_mmio: generation support virtio_mmio: fix endian-ness for mmio
2016 Aug 26
0
[PATCH 2/3] qemu: Implement virtio-pstore device
...> > + > > + /* now copy res and fileinfo */ > > + iov_from_buf(elem->in_sg, elem->in_num, 0, &res, sizeof(res)); > > + iov_from_buf(elem->in_sg, elem->in_num, sizeof(res), info, sizeof(*info)); > > + > > + len += offset; > > + virtqueue_push(vps->rvq, elem, len); > > + virtio_notify(VIRTIO_DEVICE(vps), vps->rvq); > > + > > + return G_SOURCE_REMOVE; > > G_SOURCE_REMOVE was added in glib 2.32, but QEMU only permits > stuff that is present in 2.22. Just use "FALSE" instead. Didn't kno...
2014 Jul 28
2
When I boot two virtio-rng devices, guest will hang
...RNG *vrng) && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { return true; } + trace_virtio_rng_guest_not_ready(vrng); return false; } @@ -62,6 +64,7 @@ static void chr_read(void *opaque, const void *buf, size_t size) offset += len; virtqueue_push(vrng->vq, &elem, len); + trace_virtio_rng_pushed(vrng, len); } virtio_notify(vdev, vrng->vq); } @@ -81,7 +84,11 @@ static void virtio_rng_process(VirtIORNG *vrng) quota = MIN((uint64_t)vrng->quota_remaining, (uint64_t)UINT32_MAX); } size = get_reque...
2014 Jul 28
2
When I boot two virtio-rng devices, guest will hang
...RNG *vrng) && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { return true; } + trace_virtio_rng_guest_not_ready(vrng); return false; } @@ -62,6 +64,7 @@ static void chr_read(void *opaque, const void *buf, size_t size) offset += len; virtqueue_push(vrng->vq, &elem, len); + trace_virtio_rng_pushed(vrng, len); } virtio_notify(vdev, vrng->vq); } @@ -81,7 +84,11 @@ static void virtio_rng_process(VirtIORNG *vrng) quota = MIN((uint64_t)vrng->quota_remaining, (uint64_t)UINT32_MAX); } size = get_reque...
2016 Aug 20
0
[PATCH 2/3] qemu: Implement virtio-pstore device
...o_le16(VIRTIO_PSTORE_TYPE_UNKNOWN); + res.ret = cpu_to_le32(ret); + + /* now copy res and fileinfo */ + iov_from_buf(elem->in_sg, elem->in_num, 0, &res, sizeof(res)); + iov_from_buf(elem->in_sg, elem->in_num, sizeof(res), info, sizeof(*info)); + + len += offset; + virtqueue_push(vps->rvq, elem, len); + virtio_notify(VIRTIO_DEVICE(vps), vps->rvq); + + return G_SOURCE_REMOVE; +} + +static void free_rarg_fn(gpointer data) +{ + struct pstore_read_arg *rarg = data; + + qio_channel_close(rarg->ioc, NULL); + + g_free(rarg->elem); + g_free(rarg); +} +...
2020 Mar 12
0
[RFC for QEMU] virtio-balloon: Add option thp-order to set VIRTIO_BALLOON_F_THP_ORDER
...} > } > + memory_region_unref(section.mr); > + > + pa += BALLOON_PAGE_SIZE; > + handle_size -= BALLOON_PAGE_SIZE; > } > - memory_region_unref(section.mr); > } > > virtqueue_push(vq, elem, offset); > @@ -693,6 +705,8 @@ static void virtio_balloon_set_config(VirtIODevice *vdev, > > memcpy(&config, config_data, virtio_balloon_config_size(dev)); > dev->actual = le32_to_cpu(config.actual); > + if (virtio_has_feature(vdev->host_features, V...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 1/7] userspace virtio
...39;re not leading us off end of descriptors. */ + next = vq->vring.desc[i].next; + /* Make sure compiler knows to grab that: we don't want it changing! */ + wmb(); + + if (next >= vq->vring.num) + errx(1, "Desc next is %u", next); + + return next; +} + +void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, + unsigned int len) +{ + VRingUsedElem *used; + + /* Get a pointer to the next entry in the used ring. */ + used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num]; + used->id = elem->index; +...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 1/7] userspace virtio
...39;re not leading us off end of descriptors. */ + next = vq->vring.desc[i].next; + /* Make sure compiler knows to grab that: we don't want it changing! */ + wmb(); + + if (next >= vq->vring.num) + errx(1, "Desc next is %u", next); + + return next; +} + +void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, + unsigned int len) +{ + VRingUsedElem *used; + + /* Get a pointer to the next entry in the used ring. */ + used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num]; + used->id = elem->index; +...
2016 Nov 10
0
[PATCH 2/3] qemu: Implement virtio-pstore device
.../* now copy res and fileinfo */ > > > + iov_from_buf(elem->in_sg, elem->in_num, 0, &res, sizeof(res)); > > > + iov_from_buf(elem->in_sg, elem->in_num, sizeof(res), info, sizeof(*info)); > > > + > > > + len += offset; > > > + virtqueue_push(vps->rvq, elem, len); > > > + virtio_notify(VIRTIO_DEVICE(vps), vps->rvq); > > > + > > > + return G_SOURCE_REMOVE; > > > +} > > > + > > > +static void free_rarg_fn(gpointer data) > > > +{ > > > + struct pstore_re...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 3/7] userspace virtio
...lt; elem.in_num - 1; i++) { + bdrv_read(s->bs, off, + elem.in_sg[i].iov_base, + elem.in_sg[i].iov_len / 512); + off += elem.in_sg[i].iov_len / 512; + wlen += elem.in_sg[i].iov_len; + } + + in->status = VIRTIO_BLK_S_OK; + } + + virtqueue_push(vq, &elem, wlen); + virtio_notify(vdev, vq); + } +} + +static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) +{ + VirtIOBlock *s = to_virtio_blk(vdev); + struct virtio_blk_config blkcfg; + int64_t capacity; + + bdrv_get_geometry(s->bs, &capacity); +...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 3/7] userspace virtio
...lt; elem.in_num - 1; i++) { + bdrv_read(s->bs, off, + elem.in_sg[i].iov_base, + elem.in_sg[i].iov_len / 512); + off += elem.in_sg[i].iov_len / 512; + wlen += elem.in_sg[i].iov_len; + } + + in->status = VIRTIO_BLK_S_OK; + } + + virtqueue_push(vq, &elem, wlen); + virtio_notify(vdev, vq); + } +} + +static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) +{ + VirtIOBlock *s = to_virtio_blk(vdev); + struct virtio_blk_config blkcfg; + int64_t capacity; + + bdrv_get_geometry(s->bs, &capacity); +...