qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] virtio: unbreak 1.0 device load with region cache


From: Jason Wang
Subject: [Qemu-devel] [PATCH] virtio: unbreak 1.0 device load with region cache
Date: Fri, 3 Mar 2017 16:51:28 +0800

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 <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]