From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH] virtio: unbreak 1.0 device load with region cache
Date: Fri, 3 Mar 2017 16:51:28 +0800 [thread overview]
Message-ID: <1488531088-12483-1-git-send-email-jasowang@redhat.com> (raw)
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
next reply other threads:[~2017-03-03 8:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 8:51 Jason Wang [this message]
2017-03-03 9:02 ` [Qemu-devel] [PATCH] virtio: unbreak 1.0 device load with region cache 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1488531088-12483-1-git-send-email-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).