Message ID | 1542895581-10721-13-git-send-email-wexu@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | packed ring virtio-net backend support | expand |
On 2018/11/22 下午10:06, wexu@redhat.com wrote: > From: Wei Xu <wexu@redhat.com> > > Signed-off-by: Wei Xu <wexu@redhat.com> I think you need subsection. Otherwise you will break migration compatibility. Thanks > --- > hw/virtio/virtio.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index 240c4e3..64d5c04 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -2558,6 +2558,12 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f) > */ > qemu_put_be64(f, vdev->vq[i].vring.desc); > qemu_put_be16s(f, &vdev->vq[i].last_avail_idx); > + qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].avail_wrap_counter); > + qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].event_wrap_counter); > + qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].used_wrap_counter); > + qemu_put_be16s(f, &vdev->vq[i].used_idx); > + qemu_put_be16s(f, &vdev->vq[i].shadow_avail_idx); > + qemu_put_be32s(f, &vdev->vq[i].inuse); > if (k->save_queue) { > k->save_queue(qbus->parent, i, f); > } > @@ -2705,6 +2711,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) > } > vdev->vq[i].vring.desc = qemu_get_be64(f); > qemu_get_be16s(f, &vdev->vq[i].last_avail_idx); > + > + qemu_get_8s(f, (uint8_t *)&vdev->vq[i].avail_wrap_counter); > + qemu_get_8s(f, (uint8_t *)&vdev->vq[i].event_wrap_counter); > + qemu_get_8s(f, (uint8_t *)&vdev->vq[i].used_wrap_counter); > + qemu_get_be16s(f, &vdev->vq[i].used_idx); > + qemu_get_be16s(f, &vdev->vq[i].shadow_avail_idx); > + qemu_get_be32s(f, &vdev->vq[i].inuse); > + > vdev->vq[i].signalled_used_valid = false; > vdev->vq[i].notification = true; > > @@ -2786,6 +2800,10 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) > virtio_queue_update_rings(vdev, i); > } > > + if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { > + continue; > + } > + > nheads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx; > /* Check it isn't doing strange things with descriptor numbers. */ > if (nheads > vdev->vq[i].vring.num) {
On Thu, Nov 22, 2018 at 10:45:36PM +0800, Jason Wang wrote: > > On 2018/11/22 下午10:06, wexu@redhat.com wrote: > >From: Wei Xu <wexu@redhat.com> > > > >Signed-off-by: Wei Xu <wexu@redhat.com> > > > I think you need subsection. Otherwise you will break migration > compatibility. ok, thanks. Wei > > Thanks > > > >--- > > hw/virtio/virtio.c | 18 ++++++++++++++++++ > > 1 file changed, 18 insertions(+) > > > >diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > >index 240c4e3..64d5c04 100644 > >--- a/hw/virtio/virtio.c > >+++ b/hw/virtio/virtio.c > >@@ -2558,6 +2558,12 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f) > > */ > > qemu_put_be64(f, vdev->vq[i].vring.desc); > > qemu_put_be16s(f, &vdev->vq[i].last_avail_idx); > >+ qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].avail_wrap_counter); > >+ qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].event_wrap_counter); > >+ qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].used_wrap_counter); > >+ qemu_put_be16s(f, &vdev->vq[i].used_idx); > >+ qemu_put_be16s(f, &vdev->vq[i].shadow_avail_idx); > >+ qemu_put_be32s(f, &vdev->vq[i].inuse); > > if (k->save_queue) { > > k->save_queue(qbus->parent, i, f); > > } > >@@ -2705,6 +2711,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) > > } > > vdev->vq[i].vring.desc = qemu_get_be64(f); > > qemu_get_be16s(f, &vdev->vq[i].last_avail_idx); > >+ > >+ qemu_get_8s(f, (uint8_t *)&vdev->vq[i].avail_wrap_counter); > >+ qemu_get_8s(f, (uint8_t *)&vdev->vq[i].event_wrap_counter); > >+ qemu_get_8s(f, (uint8_t *)&vdev->vq[i].used_wrap_counter); > >+ qemu_get_be16s(f, &vdev->vq[i].used_idx); > >+ qemu_get_be16s(f, &vdev->vq[i].shadow_avail_idx); > >+ qemu_get_be32s(f, &vdev->vq[i].inuse); > >+ > > vdev->vq[i].signalled_used_valid = false; > > vdev->vq[i].notification = true; > >@@ -2786,6 +2800,10 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) > > virtio_queue_update_rings(vdev, i); > > } > >+ if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { > >+ continue; > >+ } > >+ > > nheads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx; > > /* Check it isn't doing strange things with descriptor numbers. */ > > if (nheads > vdev->vq[i].vring.num) { >
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 240c4e3..64d5c04 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2558,6 +2558,12 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f) */ qemu_put_be64(f, vdev->vq[i].vring.desc); qemu_put_be16s(f, &vdev->vq[i].last_avail_idx); + qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].avail_wrap_counter); + qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].event_wrap_counter); + qemu_put_8s(f, (const uint8_t *)&vdev->vq[i].used_wrap_counter); + qemu_put_be16s(f, &vdev->vq[i].used_idx); + qemu_put_be16s(f, &vdev->vq[i].shadow_avail_idx); + qemu_put_be32s(f, &vdev->vq[i].inuse); if (k->save_queue) { k->save_queue(qbus->parent, i, f); } @@ -2705,6 +2711,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) } vdev->vq[i].vring.desc = qemu_get_be64(f); qemu_get_be16s(f, &vdev->vq[i].last_avail_idx); + + qemu_get_8s(f, (uint8_t *)&vdev->vq[i].avail_wrap_counter); + qemu_get_8s(f, (uint8_t *)&vdev->vq[i].event_wrap_counter); + qemu_get_8s(f, (uint8_t *)&vdev->vq[i].used_wrap_counter); + qemu_get_be16s(f, &vdev->vq[i].used_idx); + qemu_get_be16s(f, &vdev->vq[i].shadow_avail_idx); + qemu_get_be32s(f, &vdev->vq[i].inuse); + vdev->vq[i].signalled_used_valid = false; vdev->vq[i].notification = true; @@ -2786,6 +2800,10 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) virtio_queue_update_rings(vdev, i); } + if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { + continue; + } + nheads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx; /* Check it isn't doing strange things with descriptor numbers. */ if (nheads > vdev->vq[i].vring.num) {