On Fri, 3 Mar 2017 16:51:28 +0800 Jason Wang <jasow...@redhat.com> wrote:
> Current code depends on virtio_queue_update_rings() to setup address > space cache. But this does not work for 1.0 device since we can't infer > avail and used. Fixing this by calling virtio_init_region_cache() > after subsections load which can guarantee avail and used are correct. > > Fixes: 97cd965c0701 ("virtio: use VRingMemoryRegionCaches for avail > and used rings") > Cc: Paolo Bonzini <pbonz...@redhat.com> > Signed-off-by: Jason Wang <jasow...@redhat.com> > --- > hw/virtio/virtio.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index 23483c7..faa45cb 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -2059,6 +2059,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int > version_id) > > rcu_read_lock(); > for (i = 0; i < num; i++) { > + virtio_init_region_cache(vdev, i); > if (vdev->vq[i].vring.desc) { > uint16_t nheads; > nheads = vring_avail_idx(&vdev->vq[i]) - > vdev->vq[i].last_avail_idx; "virtio: add missing region cache init in virtio_load()" should take care of that (but has not been pulled yet, it seems).