qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio: unbreak 1.0 device load with region cache
@ 2017-03-03  8:51 Jason Wang
  2017-03-03  9:02 ` no-reply
  2017-03-03  9:15 ` Cornelia Huck
  0 siblings, 2 replies; 6+ messages in thread
From: Jason Wang @ 2017-03-03  8:51 UTC (permalink / raw)
  To: mst, qemu-devel; +Cc: Jason Wang, Paolo Bonzini

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 <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-03  9:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-03  8:51 [Qemu-devel] [PATCH] virtio: unbreak 1.0 device load with region cache Jason Wang
2017-03-03  9:02 ` no-reply
2017-03-03  9:18   ` Fam Zheng
2017-03-03  9:45     ` Jason Wang
2017-03-03  9:15 ` Cornelia Huck
2017-03-03  9:39   ` Jason Wang

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).